Skip to content

IllegalStateException @ PlayerServiceConnection.stop #6665

Closed

Description

@AndyScherzinger

One of the top crashes within the last 30 days reported on GPlay dev console:

java.lang.IllegalStateException: 
  at android.app.ContextImpl.startServiceCommon (ContextImpl.java:1688)
  at android.app.ContextImpl.startService (ContextImpl.java:1633)
  at android.content.ContextWrapper.startService (ContextWrapper.java:683)
  at android.content.ContextWrapper.startService (ContextWrapper.java:683)
  at com.nextcloud.client.media.PlayerServiceConnection.stop (PlayerServiceConnection.kt:72)
  at com.owncloud.android.ui.preview.PreviewMediaFragment.stopAudio (PreviewMediaFragment.java:336)
  at com.owncloud.android.ui.preview.PreviewMediaFragment.onStart (PreviewMediaFragment.java:329)
  at androidx.fragment.app.Fragment.performStart (Fragment.java:2632)
  at androidx.fragment.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:915)
  at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState (FragmentManagerImpl.java:1238)
  at androidx.fragment.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1303)
  at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange (FragmentManagerImpl.java:2659)
  at androidx.fragment.app.FragmentManagerImpl.dispatchStart (FragmentManagerImpl.java:2619)
  at androidx.fragment.app.FragmentController.dispatchStart (FragmentController.java:257)
  at androidx.fragment.app.FragmentActivity.onStart (FragmentActivity.java:551)
  at androidx.appcompat.app.AppCompatActivity.onStart (AppCompatActivity.java:210)
  at com.owncloud.android.ui.activity.DrawerActivity.onStart (DrawerActivity.java:1415)
  at com.owncloud.android.ui.activity.FileActivity.onStart (FileActivity.java:208)
  at com.owncloud.android.ui.activity.FileDisplayActivity.onStart (FileDisplayActivity.java:2561)
  at android.app.Instrumentation.callActivityOnStart (Instrumentation.java:1433)
  at android.app.Activity.performStart (Activity.java:7980)
  at android.app.ActivityThread.handleStartActivity (ActivityThread.java:3646)
  at android.app.servertransaction.TransactionExecutor.performLifecycleSequence (TransactionExecutor.java:221)
  at android.app.servertransaction.TransactionExecutor.cycleToPath (TransactionExecutor.java:201)
  at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:173)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2261)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:8107)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)

Any ideas @ezaquarii? :)

Reports for

  • Android 10 (SDK 29)
  • Android 9 (SDK 28)

and

  • 3.12.0
  • 3.12.1

Activity

  1. ezaquarii commented on Aug 24, 2020

    @ezaquarii
    Collaborator

    Looks like package name is "?".

    According to this
    https://developer.android.com/about/versions/oreo/android-8.0-changes#back-all
    this exception is thrown if the app is not allowed to create background services and is in fact part of the interface contract.

    I think we should handle this exception, although I'm curious when does it happen?

        private ComponentName startServiceCommon(Intent service, boolean requireForeground,
                UserHandle user) {
            try {
                validateServiceIntent(service);
                service.prepareToLeaveProcess(this);
                ComponentName cn = ActivityManager.getService().startService(
                    mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded(
                                getContentResolver()), requireForeground,
                                getOpPackageName(), user.getIdentifier());
                if (cn != null) {
                    if (cn.getPackageName().equals("!")) {
                        throw new SecurityException(
                                "Not allowed to start service " + service
                                + " without permission " + cn.getClassName());
                    } else if (cn.getPackageName().equals("!!")) {
                        throw new SecurityException(
                                "Unable to start service " + service
                                + ": " + cn.getClassName());
                    } else if (cn.getPackageName().equals("?")) {
                        throw new IllegalStateException(
                                "Not allowed to start service " + service + ": " + cn.getClassName());
                    }
                }
                return cn;
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }

    @AndyScherzinger Any OS versions? Phone models in reports?
    @tobiasKaminsky Did we change target API level recently?

  2. added a commit that references this issue on Aug 24, 2020
    eb6cba0
  3. added 3 commits that reference this issue on Aug 25, 2020
    9c7cb6c
    3c0157c
    6feedf8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions