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

Commit 057e584a authored by Jorge Gil's avatar Jorge Gil Committed by Android (Google) Code Review
Browse files

Merge "Move caption insets WCT to the shell bg thread" into main

parents fce8a8a1 693d6b4b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -211,6 +211,7 @@ public abstract class WMShellModule {
            @ShellMainThread ShellExecutor mainExecutor,
            @ShellMainThread Handler mainHandler,
            @ShellMainThread Choreographer mainChoreographer,
            @ShellBackgroundThread ShellExecutor bgExecutor,
            ShellInit shellInit,
            IWindowManager windowManager,
            ShellCommandHandler shellCommandHandler,
@@ -229,6 +230,7 @@ public abstract class WMShellModule {
                    mainExecutor,
                    mainHandler,
                    mainChoreographer,
                    bgExecutor,
                    shellInit,
                    shellCommandHandler,
                    windowManager,
@@ -246,6 +248,7 @@ public abstract class WMShellModule {
                context,
                mainHandler,
                mainExecutor,
                bgExecutor,
                mainChoreographer,
                windowManager,
                shellInit,
+5 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.SyncTransactionQueue;
import com.android.wm.shell.freeform.FreeformTaskTransitionStarter;
import com.android.wm.shell.shared.annotations.ShellBackgroundThread;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.sysui.ShellInit;
import com.android.wm.shell.transition.Transitions;
@@ -72,6 +73,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
    private final IWindowManager mWindowManager;
    private final Context mContext;
    private final Handler mMainHandler;
    private final @ShellBackgroundThread ShellExecutor mBgExecutor;
    private final ShellExecutor mMainExecutor;
    private final Choreographer mMainChoreographer;
    private final DisplayController mDisplayController;
@@ -108,6 +110,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
    public CaptionWindowDecorViewModel(
            Context context,
            Handler mainHandler,
            @ShellBackgroundThread ShellExecutor bgExecutor,
            ShellExecutor shellExecutor,
            Choreographer mainChoreographer,
            IWindowManager windowManager,
@@ -120,6 +123,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
        mContext = context;
        mMainExecutor = shellExecutor;
        mMainHandler = mainHandler;
        mBgExecutor = bgExecutor;
        mWindowManager = windowManager;
        mMainChoreographer = mainChoreographer;
        mTaskOrganizer = taskOrganizer;
@@ -289,6 +293,7 @@ public class CaptionWindowDecorViewModel implements WindowDecorViewModel {
                        taskInfo,
                        taskSurface,
                        mMainHandler,
                        mBgExecutor,
                        mMainChoreographer,
                        mSyncQueue);
        mWindowDecorByTaskId.put(taskInfo.taskId, windowDecoration);
+8 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.getLarge
import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.getResizeEdgeHandleSize;

import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.WindowConfiguration;
@@ -48,7 +49,9 @@ import com.android.wm.shell.R;
import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.SyncTransactionQueue;
import com.android.wm.shell.shared.annotations.ShellBackgroundThread;
import com.android.wm.shell.windowdecor.extension.TaskInfoKt;

/**
@@ -58,6 +61,7 @@ import com.android.wm.shell.windowdecor.extension.TaskInfoKt;
 */
public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearLayout> {
    private final Handler mHandler;
    private final @ShellBackgroundThread ShellExecutor mBgExecutor;
    private final Choreographer mChoreographer;
    private final SyncTransactionQueue mSyncQueue;

@@ -78,10 +82,12 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
            RunningTaskInfo taskInfo,
            SurfaceControl taskSurface,
            Handler handler,
            @ShellBackgroundThread ShellExecutor bgExecutor,
            Choreographer choreographer,
            SyncTransactionQueue syncQueue) {
        super(context, displayController, taskOrganizer, taskInfo, taskSurface);
        mHandler = handler;
        mBgExecutor = bgExecutor;
        mChoreographer = choreographer;
        mSyncQueue = syncQueue;
    }
@@ -218,6 +224,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
        relayoutParams.mOccludingCaptionElements.add(controlsElement);
    }

    @SuppressLint("MissingPermission")
    void relayout(RunningTaskInfo taskInfo,
            SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT,
            boolean applyStartTransactionOnDraw, boolean setTaskCropAndPosition) {
@@ -235,7 +242,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL
        relayout(mRelayoutParams, startT, finishT, wct, oldRootView, mResult);
        // After this line, mTaskInfo is up-to-date and should be used instead of taskInfo

        mTaskOrganizer.applyTransaction(wct);
        mBgExecutor.execute(() -> mTaskOrganizer.applyTransaction(wct));

        if (mResult.mRootView == null) {
            // This means something blocks the window decor from showing, e.g. the task is hidden.
+7 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ import com.android.wm.shell.desktopmode.DesktopTasksController;
import com.android.wm.shell.desktopmode.DesktopTasksController.SnapPosition;
import com.android.wm.shell.desktopmode.DesktopWallpaperActivity;
import com.android.wm.shell.freeform.FreeformTaskTransitionStarter;
import com.android.wm.shell.shared.annotations.ShellBackgroundThread;
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
import com.android.wm.shell.splitscreen.SplitScreen;
import com.android.wm.shell.splitscreen.SplitScreen.StageType;
@@ -132,6 +133,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
    private final ShellController mShellController;
    private final Context mContext;
    private final Handler mMainHandler;
    private final @ShellBackgroundThread ShellExecutor mBgExecutor;
    private final Choreographer mMainChoreographer;
    private final DisplayController mDisplayController;
    private final SyncTransactionQueue mSyncQueue;
@@ -183,6 +185,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
            ShellExecutor shellExecutor,
            Handler mainHandler,
            Choreographer mainChoreographer,
            @ShellBackgroundThread ShellExecutor bgExecutor,
            ShellInit shellInit,
            ShellCommandHandler shellCommandHandler,
            IWindowManager windowManager,
@@ -201,6 +204,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
                shellExecutor,
                mainHandler,
                mainChoreographer,
                bgExecutor,
                shellInit,
                shellCommandHandler,
                windowManager,
@@ -225,6 +229,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
            ShellExecutor shellExecutor,
            Handler mainHandler,
            Choreographer mainChoreographer,
            @ShellBackgroundThread ShellExecutor bgExecutor,
            ShellInit shellInit,
            ShellCommandHandler shellCommandHandler,
            IWindowManager windowManager,
@@ -245,6 +250,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
        mMainExecutor = shellExecutor;
        mMainHandler = mainHandler;
        mMainChoreographer = mainChoreographer;
        mBgExecutor = bgExecutor;
        mActivityTaskManager = mContext.getSystemService(ActivityTaskManager.class);
        mTaskOrganizer = taskOrganizer;
        mShellController = shellController;
@@ -1095,6 +1101,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
                        taskInfo,
                        taskSurface,
                        mMainHandler,
                        mBgExecutor,
                        mMainChoreographer,
                        mSyncQueue,
                        mRootTaskDisplayAreaOrganizer);
+12 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.getLarge
import static com.android.wm.shell.windowdecor.DragResizeWindowGeometry.getResizeEdgeHandleSize;

import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.WindowConfiguration.WindowingMode;
import android.content.ComponentName;
@@ -68,7 +69,9 @@ import com.android.wm.shell.RootTaskDisplayAreaOrganizer;
import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.SyncTransactionQueue;
import com.android.wm.shell.shared.annotations.ShellBackgroundThread;
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.windowdecor.common.OnTaskActionClickListener;
@@ -95,6 +98,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
    static final long CLOSE_MAXIMIZE_MENU_DELAY_MS = 150L;

    private final Handler mHandler;
    private final @ShellBackgroundThread ShellExecutor mBgExecutor;
    private final Choreographer mChoreographer;
    private final SyncTransactionQueue mSyncQueue;

@@ -151,11 +155,12 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
            ActivityManager.RunningTaskInfo taskInfo,
            SurfaceControl taskSurface,
            Handler handler,
            @ShellBackgroundThread ShellExecutor bgExecutor,
            Choreographer choreographer,
            SyncTransactionQueue syncQueue,
            RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer) {
        this (context, displayController, taskOrganizer, taskInfo, taskSurface,
                handler, choreographer, syncQueue, rootTaskDisplayAreaOrganizer,
                handler, bgExecutor, choreographer, syncQueue, rootTaskDisplayAreaOrganizer,
                SurfaceControl.Builder::new, SurfaceControl.Transaction::new,
                WindowContainerTransaction::new, SurfaceControl::new,
                new SurfaceControlViewHostFactory() {}, DefaultMaximizeMenuFactory.INSTANCE);
@@ -168,6 +173,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
            ActivityManager.RunningTaskInfo taskInfo,
            SurfaceControl taskSurface,
            Handler handler,
            @ShellBackgroundThread ShellExecutor bgExecutor,
            Choreographer choreographer,
            SyncTransactionQueue syncQueue,
            RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer,
@@ -182,6 +188,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
                windowContainerTransactionSupplier, surfaceControlSupplier,
                surfaceControlViewHostFactory);
        mHandler = handler;
        mBgExecutor = bgExecutor;
        mChoreographer = choreographer;
        mSyncQueue = syncQueue;
        mRootTaskDisplayAreaOrganizer = rootTaskDisplayAreaOrganizer;
@@ -327,6 +334,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        mHandler.post(mCurrentViewHostRunnable);
    }

    @SuppressLint("MissingPermission")
    private void updateRelayoutParamsAndSurfaces(ActivityManager.RunningTaskInfo taskInfo,
            SurfaceControl.Transaction startT, SurfaceControl.Transaction finishT,
            boolean applyStartTransactionOnDraw, boolean shouldSetTaskPositionAndCrop) {
@@ -353,7 +361,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
        // After this line, mTaskInfo is up-to-date and should be used instead of taskInfo

        Trace.beginSection("DesktopModeWindowDecoration#relayout-applyWCT");
        mTaskOrganizer.applyTransaction(wct);
        mBgExecutor.execute(() -> mTaskOrganizer.applyTransaction(wct));
        Trace.endSection();

        if (mResult.mRootView == null) {
@@ -1147,6 +1155,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
                ActivityManager.RunningTaskInfo taskInfo,
                SurfaceControl taskSurface,
                Handler handler,
                @ShellBackgroundThread ShellExecutor bgExecutor,
                Choreographer choreographer,
                SyncTransactionQueue syncQueue,
                RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer) {
@@ -1157,6 +1166,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
                    taskInfo,
                    taskSurface,
                    handler,
                    bgExecutor,
                    choreographer,
                    syncQueue,
                    rootTaskDisplayAreaOrganizer);
Loading