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

Commit 916213b8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Support excluding caption bar from task snapshot" into main

parents 7b67879c 0de21dad
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.window.ITaskOrganizer;
import android.window.TaskAppearedInfo;
import android.window.WindowContainerToken;
import android.window.WindowContainerTransaction;
import android.view.SurfaceControl;

/** @hide */
interface ITaskOrganizerController {
@@ -69,4 +70,23 @@ interface ITaskOrganizerController {
     * Restarts the top activity in the given task by killing its process if it is visible.
     */
    void restartTaskTopActivityProcessIfVisible(in WindowContainerToken task);

    /**
     * Set layers to be excluded when taking a task snapshot.
     *
     * Warning: MUST NOT pass layers that are managed by the Window Manager (e.g., from a Task or
     * Activity). Doing so may cause the corresponding layer to be destroyed when
     * clearExcludeLayersFromTaskSnapshot is called.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
            + "android.Manifest.permission.MANAGE_ACTIVITY_TASKS)")
    void setExcludeLayersFromTaskSnapshot(in WindowContainerToken task,
            in SurfaceControl[] layers);

    /**
     * Clears all layers that were registered for exclusion via setExcludeLayersFromTaskSnapshot.
     */
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(value = "
            + "android.Manifest.permission.MANAGE_ACTIVITY_TASKS)")
    void clearExcludeLayersFromTaskSnapshot(in WindowContainerToken task);
}
+31 −0
Original line number Diff line number Diff line
@@ -320,6 +320,37 @@ public class TaskOrganizer extends WindowOrganizer {
        }
    }

    /**
     * Set layers to be excluded when taking a task snapshot.
     *
     * Warning: MUST NOT pass layers that are managed by the Window Manager (e.g., from a Task or
     * Activity). Doing so may cause the corresponding layer to be destroyed when
     * clearExcludeLayersFromTaskSnapshot is called.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    public void setExcludeLayersFromTaskSnapshot(@NonNull WindowContainerToken task,
            SurfaceControl[] layers) {
        try {
            mTaskOrganizerController.setExcludeLayersFromTaskSnapshot(task, layers);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Clears all layers that were set for exclusion via setExcludeLayersFromTaskSnapshot.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    public void clearExcludeLayersFromTaskSnapshot(@NonNull WindowContainerToken task) {
        try {
            mTaskOrganizerController.clearExcludeLayersFromTaskSnapshot(task);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Gets the executor to run callbacks on.
     * @hide
+1 −3
Original line number Diff line number Diff line
@@ -81,7 +81,6 @@ import java.util.function.BiFunction;
public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearLayout> {
    private final Handler mHandler;
    private final @ShellMainThread ShellExecutor mMainExecutor;
    private final @ShellBackgroundThread ShellExecutor mBgExecutor;
    private final Choreographer mChoreographer;
    private final SyncTransactionQueue mSyncQueue;
    private final DesktopConfig mDesktopConfig;
@@ -111,10 +110,9 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
            @NonNull WindowDecorViewHostSupplier<WindowDecorViewHost> windowDecorViewHostSupplier,
            DesktopConfig desktopConfig) {
        super(context, handler, transitions, userContext, displayController, taskOrganizer,
                taskInfo, taskSurface, windowDecorViewHostSupplier);
                taskInfo, taskSurface, windowDecorViewHostSupplier, bgExecutor);
        mHandler = handler;
        mMainExecutor = mainExecutor;
        mBgExecutor = bgExecutor;
        mChoreographer = choreographer;
        mSyncQueue = syncQueue;
        mDesktopConfig = desktopConfig;
+1 −3
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import com.android.wm.shell.windowdecor.common.viewhost.WindowDecorViewHostSuppl
 */
public class CarWindowDecoration extends WindowDecoration<WindowDecorLinearLayout> {
    private WindowDecorLinearLayout mRootView;
    private @ShellBackgroundThread final ShellExecutor mBgExecutor;
    private final View.OnClickListener mClickListener;
    private final RelayoutParams mRelayoutParams = new RelayoutParams();
    private final RelayoutResult<WindowDecorLinearLayout> mResult = new RelayoutResult<>();
@@ -66,8 +65,7 @@ public class CarWindowDecoration extends WindowDecoration<WindowDecorLinearLayou
            WindowDecorViewHostSupplier<WindowDecorViewHost> windowDecorViewHostSupplier,
            View.OnClickListener clickListener) {
        super(context, handler, transitions, userContext, displayController, taskOrganizer,
                taskInfo, taskSurface, windowDecorViewHostSupplier);
        mBgExecutor = bgExecutor;
                taskInfo, taskSurface, windowDecorViewHostSupplier, bgExecutor);
        mClickListener = clickListener;
    }

+1 −3
Original line number Diff line number Diff line
@@ -159,7 +159,6 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
    private final @ShellMainThread MainCoroutineDispatcher mMainDispatcher;
    private final @ShellMainThread CoroutineScope mMainScope;
    private final @ShellBackgroundThread CoroutineScope mBgScope;
    private final @ShellBackgroundThread ShellExecutor mBgExecutor;
    private final Transitions mTransitions;
    private final Choreographer mChoreographer;
    private final SyncTransactionQueue mSyncQueue;
@@ -335,14 +334,13 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
                taskInfo, taskSurface, surfaceControlBuilderSupplier,
                surfaceControlTransactionSupplier, windowContainerTransactionSupplier,
                surfaceControlSupplier, surfaceControlViewHostFactory, windowDecorViewHostSupplier,
                desktopModeEventLogger);
                desktopModeEventLogger, bgExecutor);
        mSplitScreenController = splitScreenController;
        mHandler = handler;
        mMainExecutor = mainExecutor;
        mMainDispatcher = mainDispatcher;
        mMainScope = mainScope;
        mBgScope = bgScope;
        mBgExecutor = bgExecutor;
        mTransitions = transitions;
        mChoreographer = choreographer;
        mSyncQueue = syncQueue;
Loading