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

Commit 8f988ac4 authored by Christophe Pinelli's avatar Christophe Pinelli Committed by Automerger Merge Worker
Browse files

Merge "Restrict activity launch when caller is running in the background" into...

Merge "Restrict activity launch when caller is running in the background" into tm-dev am: 5f74ebdf am: e3f384b9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23265596



Change-Id: If553cbe9ad51fc8a3a8657c3aecf0c0fbe5dc788
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4e813976 e3f384b9
Loading
Loading
Loading
Loading
+31 −22
Original line number Diff line number Diff line
@@ -1416,6 +1416,17 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {

            final long origId = Binder.clearCallingIdentity();
            // TODO(b/64750076): Check if calling pid should really be -1.
            try {
                if (options == null) {
                    options = new SafeActivityOptions(ActivityOptions.makeBasic());
                }
                // Fixes b/230492947
                // Prevents background activity launch through #startNextMatchingActivity
                // An activity going into the background could still go back to the foreground
                // if the intent used matches both:
                // - the activity in the background
                // - a second activity.
                options.getOptions(r).setAvoidMoveToFront();
                final int res = getActivityStartController()
                        .obtainStarter(intent, "startNextMatchingActivity")
                        .setCaller(r.app.getThread())
@@ -1432,13 +1443,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                        .setRealCallingUid(r.launchedFromUid)
                        .setActivityOptions(options)
                        .execute();
            Binder.restoreCallingIdentity(origId);

                r.finishing = wasFinishing;
            if (res != ActivityManager.START_SUCCESS) {
                return false;
                return res == ActivityManager.START_SUCCESS;
            } finally {
                Binder.restoreCallingIdentity(origId);
            }
            return true;
        }
    }