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

Commit 71f12724 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Only allow sysui or system to set a Task to always-on-top" into main

parents 377ad55b 096fce8b
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -361,10 +361,13 @@ public class SafeActivityOptions {
        }

        // If launched from bubble is specified, then ensure that the caller is system or sysui.
        if (options.getLaunchedFromBubble() && !isSystemOrSystemUI(callingPid, callingUid)) {
        if ((options.getLaunchedFromBubble() || options.getTaskAlwaysOnTop())
                && !isSystemOrSystemUI(callingPid, callingUid)) {
            final String msg = "Permission Denial: starting " + getIntentString(intent)
                    + " from " + callerApp + " (pid=" + callingPid
                    + ", uid=" + callingUid + ") with launchedFromBubble=true";
                    + ", uid=" + callingUid + ") with"
                    + (options.getLaunchedFromBubble() ? " launchedFromBubble=true" : "")
                    + (options.getTaskAlwaysOnTop() ? " taskAlwaysOnTop=true" : "");
            Slog.w(TAG, msg);
            throw new SecurityException(msg);
        }
+4 −0
Original line number Diff line number Diff line
@@ -161,6 +161,10 @@ public class SafeActivityOptionsTest {
            activityOptions.setLaunchedFromBubble(true);
            verifySecureExceptionThrown(activityOptions, taskSupervisor);

            activityOptions = ActivityOptions.makeBasic();
            activityOptions.setTaskAlwaysOnTop(true);
            verifySecureExceptionThrown(activityOptions, taskSupervisor);

            activityOptions = ActivityOptions.makeBasic();
            activityOptions.setLaunchDisplayId(DEFAULT_DISPLAY);
            verifySecureExceptionThrown(activityOptions, taskSupervisor);