Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 406a5a93 authored by Matt Pietal's avatar Matt Pietal
Browse files

Sharesheet - Fix crash when suspended app is selected

After selecting a suspended app, the package monitor would be
unregistered even though the app would never be launched. This would
cause an IllegalStateException on the next selection of any target,
and crash the sharesheet. Check for a suspended target before
unregistering.

Fixes: 160015744
Test: manual, follow BR steps and pause an app
Change-Id: I1b0c79bad0fa75aea6a543b6f8a4848720faa0c8
parent f629b618
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -1279,6 +1279,9 @@ public class ResolverActivity extends Activity implements
    }

    private void safelyStartActivityInternal(TargetInfo cti) {
        // If the target is suspended, the activity will not be successfully launched.
        // Do not unregister from package manager updates in this case
        if (!cti.isSuspended()) {
            if (mPersonalPackageMonitor != null) {
                mPersonalPackageMonitor.unregister();
            }
@@ -1286,6 +1289,7 @@ public class ResolverActivity extends Activity implements
                mWorkPackageMonitor.unregister();
            }
            mRegistered = false;
        }
        // If needed, show that intent is forwarded
        // from managed profile to owner or other way around.
        if (mProfileSwitchMessageId != -1) {