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

Commit 7b82af14 authored by Hani Kazmi's avatar Hani Kazmi Committed by Android (Google) Code Review
Browse files

Merge "ASM Opt-In flag clean up." into main

parents 1593d5fd 2a0d6fee
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -9601,9 +9601,9 @@ public class Activity extends ContextThemeWrapper
     * Specifies whether the activities below this one in the task can also start other activities
     * or finish the task.
     * <p>
     * Starting from Target SDK Level {@link android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE}, apps
     * are blocked from starting new activities or finishing their task unless the top activity of
     * such task belong to the same UID for security reasons.
     * Starting from Target SDK Level {@link android.os.Build.VERSION_CODES#VANILLA_ICE_CREAM}, apps
     * may be blocked from starting new activities or finishing their task unless the top activity
     * of such task belong to the same UID for security reasons.
     * <p>
     * Setting this flag to {@code true} will allow the launching app to ignore the restriction if
     * this activity is on top. Apps matching the UID of this activity are always exempt.
+2 −1
Original line number Diff line number Diff line
@@ -506,7 +506,8 @@ class ActivityClientController extends IActivityClientController.Stub {
                    // keep backwards compatibility we remove the task from recents when finishing
                    // task with root activity.
                    mTaskSupervisor.removeTask(tr, false /*killProcess*/,
                            finishWithRootActivity, "finish-activity", r.getUid(), r.info.name);
                            finishWithRootActivity, "finish-activity", r.getUid(), r.getPid(),
                            r.info.name);
                    res = true;
                    // Explicitly dismissing the activity so reset its relaunch flag.
                    r.mRelaunchReason = RELAUNCH_REASON_NONE;
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ class ActivitySecurityModelFeatureFlags {
    static final String DOC_LINK = "go/android-asm";

    /** Used to determine which version of the ASM logic was used in logs while we iterate */
    static final int ASM_VERSION = 9;
    static final int ASM_VERSION = 10;

    private static final String NAMESPACE = NAMESPACE_WINDOW_MANAGER;
    private static final String KEY_ASM_PREFIX = "ActivitySecurity__";
+1 −1
Original line number Diff line number Diff line
@@ -2089,7 +2089,7 @@ class ActivityStarter {

        if (!mSupervisor.getBackgroundActivityLaunchController().checkActivityAllowedToStart(
                mSourceRecord, r, newTask, avoidMoveToFront(), targetTask, mLaunchFlags, mBalCode,
                mCallingUid, mRealCallingUid)) {
                mCallingUid, mRealCallingUid, mPreferredTaskDisplayArea)) {
            return START_ABORTED;
        }

+8 −7
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import static android.content.pm.PackageManager.NOTIFY_PACKAGE_USE_ACTIVITY;
import static android.content.pm.PackageManager.PERMISSION_DENIED;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.os.PowerManager.PARTIAL_WAKE_LOCK;
import static android.os.Process.INVALID_PID;
import static android.os.Process.INVALID_UID;
import static android.os.Process.SYSTEM_UID;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
@@ -1652,11 +1653,11 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
     * @return Returns true if the given task was found and removed.
     */
    boolean removeTaskById(int taskId, boolean killProcess, boolean removeFromRecents,
            String reason, int callingUid) {
            String reason, int callingUid, int callingPid) {
        final Task task =
                mRootWindowContainer.anyTaskForId(taskId, MATCH_ATTACHED_TASK_OR_RECENT_TASKS);
        if (task != null) {
            removeTask(task, killProcess, removeFromRecents, reason, callingUid, null);
            removeTask(task, killProcess, removeFromRecents, reason, callingUid, callingPid, null);
            return true;
        }
        Slog.w(TAG, "Request to remove task ignored for non-existent task " + taskId);
@@ -1664,11 +1665,11 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
    }

    void removeTask(Task task, boolean killProcess, boolean removeFromRecents, String reason) {
        removeTask(task, killProcess, removeFromRecents, reason, SYSTEM_UID, null);
        removeTask(task, killProcess, removeFromRecents, reason, SYSTEM_UID, INVALID_PID, null);
    }

    void removeTask(Task task, boolean killProcess, boolean removeFromRecents, String reason,
            int callingUid, String callerActivityClassName) {
            int callingUid, int callingPid, String callerActivityClassName) {
        if (task.mInRemoveTask) {
            // Prevent recursion.
            return;
@@ -1705,8 +1706,8 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            if (task.isPersistable) {
                mService.notifyTaskPersisterLocked(null, true);
            }
            mBalController
                    .checkActivityAllowedToClearTask(task, callingUid, callerActivityClassName);
            mBalController.checkActivityAllowedToClearTask(
                            task, callingUid, callingPid, callerActivityClassName);
        } finally {
            task.mInRemoveTask = false;
        }
@@ -1874,7 +1875,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
            // Task was trimmed from the recent tasks list -- remove the active task record as well
            // since the user won't really be able to go back to it
            removeTaskById(task.mTaskId, killProcess, false /* removeFromRecents */,
                    "recent-task-trimmed", SYSTEM_UID);
                    "recent-task-trimmed", SYSTEM_UID, INVALID_PID);
        }
        task.removedFromRecents();
    }
Loading