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

Commit 0a703480 authored by Chris Li's avatar Chris Li Committed by Automerger Merge Worker
Browse files

Merge "Remove TaskInfo#topActivityToken usage in size compat for security"...

Merge "Remove TaskInfo#topActivityToken usage in size compat for security" into sc-dev am: e7ed99bf

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

Change-Id: Ieaa6eb5bc5dc023644d4f6c19dbb583f7e022f5b
parents f597490e e7ed99bf
Loading
Loading
Loading
Loading
+0 −13
Original line number Original line Diff line number Diff line
@@ -431,19 +431,6 @@ public class ActivityClient {
        }
        }
    }
    }


    /**
     * Restart the process and activity to adopt the latest configuration for size compat mode.
     * This only takes effect for visible activity because invisible background activity can be
     * restarted naturally when it becomes visible.
     */
    public void restartActivityProcessIfVisible(IBinder token) {
        try {
            getActivityClientController().restartActivityProcessIfVisible(token);
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
    }

    /** Removes the snapshot of home task. */
    /** Removes the snapshot of home task. */
    public void invalidateHomeTaskSnapshot(IBinder homeToken) {
    public void invalidateHomeTaskSnapshot(IBinder homeToken) {
        try {
        try {
+0 −10
Original line number Original line Diff line number Diff line
@@ -116,16 +116,6 @@ interface IActivityClientController {
    /** See {@link android.app.Activity#setDisablePreviewScreenshots}. */
    /** See {@link android.app.Activity#setDisablePreviewScreenshots}. */
    oneway void setDisablePreviewScreenshots(in IBinder token, boolean disable);
    oneway void setDisablePreviewScreenshots(in IBinder token, boolean disable);


    /**
     * Restarts the activity by killing its process if it is visible. If the activity is not
     * visible, the activity will not be restarted immediately and just keep the activity record in
     * the stack. It also resets the current override configuration so the activity will use the
     * configuration according to the latest state.
     *
     * @param activityToken The token of the target activity to restart.
     */
    void restartActivityProcessIfVisible(in IBinder activityToken);

    /**
    /**
     * It should only be called from home activity to remove its outdated snapshot. The home
     * It should only be called from home activity to remove its outdated snapshot. The home
     * snapshot is used to speed up entering home from screen off. If the content of home activity
     * snapshot is used to speed up entering home from screen off. If the content of home activity
+1 −12
Original line number Original line Diff line number Diff line
@@ -186,13 +186,6 @@ public class TaskInfo {
    @Nullable
    @Nullable
    public ActivityInfo topActivityInfo;
    public ActivityInfo topActivityInfo;


    /**
     * The top activity in this task.
     * @hide
     */
    @Nullable
    public IBinder topActivityToken;

    /**
    /**
     * Whether the direct top activity is in size compat mode on foreground.
     * Whether the direct top activity is in size compat mode on foreground.
     * @hide
     * @hide
@@ -356,8 +349,7 @@ public class TaskInfo {
        return displayId == that.displayId
        return displayId == that.displayId
                && taskId == that.taskId
                && taskId == that.taskId
                && topActivityInSizeCompat == that.topActivityInSizeCompat
                && topActivityInSizeCompat == that.topActivityInSizeCompat
                // TopActivityToken and bounds are important if top activity is in size compat
                // Bounds are important if top activity is in size compat
                && (!topActivityInSizeCompat || topActivityToken.equals(that.topActivityToken))
                && (!topActivityInSizeCompat || configuration.windowConfiguration.getBounds()
                && (!topActivityInSizeCompat || configuration.windowConfiguration.getBounds()
                    .equals(that.configuration.windowConfiguration.getBounds()))
                    .equals(that.configuration.windowConfiguration.getBounds()))
                && (!topActivityInSizeCompat || configuration.getLayoutDirection()
                && (!topActivityInSizeCompat || configuration.getLayoutDirection()
@@ -396,7 +388,6 @@ public class TaskInfo {
        parentTaskId = source.readInt();
        parentTaskId = source.readInt();
        isFocused = source.readBoolean();
        isFocused = source.readBoolean();
        isVisible = source.readBoolean();
        isVisible = source.readBoolean();
        topActivityToken = source.readStrongBinder();
        topActivityInSizeCompat = source.readBoolean();
        topActivityInSizeCompat = source.readBoolean();
        mTopActivityLocusId = source.readTypedObject(LocusId.CREATOR);
        mTopActivityLocusId = source.readTypedObject(LocusId.CREATOR);
    }
    }
@@ -434,7 +425,6 @@ public class TaskInfo {
        dest.writeInt(parentTaskId);
        dest.writeInt(parentTaskId);
        dest.writeBoolean(isFocused);
        dest.writeBoolean(isFocused);
        dest.writeBoolean(isVisible);
        dest.writeBoolean(isVisible);
        dest.writeStrongBinder(topActivityToken);
        dest.writeBoolean(topActivityInSizeCompat);
        dest.writeBoolean(topActivityInSizeCompat);
        dest.writeTypedObject(mTopActivityLocusId, flags);
        dest.writeTypedObject(mTopActivityLocusId, flags);
    }
    }
@@ -462,7 +452,6 @@ public class TaskInfo {
                + " parentTaskId=" + parentTaskId
                + " parentTaskId=" + parentTaskId
                + " isFocused=" + isFocused
                + " isFocused=" + isFocused
                + " isVisible=" + isVisible
                + " isVisible=" + isVisible
                + " topActivityToken=" + topActivityToken
                + " topActivityInSizeCompat=" + topActivityInSizeCompat
                + " topActivityInSizeCompat=" + topActivityInSizeCompat
                + " locusId= " + mTopActivityLocusId
                + " locusId= " + mTopActivityLocusId
                + "}";
                + "}";
+5 −0
Original line number Original line Diff line number Diff line
@@ -61,4 +61,9 @@ interface ITaskOrganizerController {
     */
     */
    void setInterceptBackPressedOnTaskRoot(in WindowContainerToken task,
    void setInterceptBackPressedOnTaskRoot(in WindowContainerToken task,
            boolean interceptBackPressed);
            boolean interceptBackPressed);

    /**
     * Restarts the top activity in the given task by killing its process if it is visible.
     */
    void restartTaskTopActivityProcessIfVisible(in WindowContainerToken task);
}
}
+13 −0
Original line number Original line Diff line number Diff line
@@ -222,6 +222,19 @@ public class TaskOrganizer extends WindowOrganizer {
        }
        }
    }
    }


    /**
     * Restarts the top activity in the given task by killing its process if it is visible.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    public void restartTaskTopActivityProcessIfVisible(@NonNull WindowContainerToken task) {
        try {
            mTaskOrganizerController.restartTaskTopActivityProcessIfVisible(task);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
    /**
     * Gets the executor to run callbacks on.
     * Gets the executor to run callbacks on.
     * @hide
     * @hide
Loading