Loading core/java/android/view/SurfaceControlViewHost.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -303,6 +303,7 @@ public class SurfaceControlViewHost { /** @hide */ /** @hide */ public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d, public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d, @NonNull WindowlessWindowManager wwm, @NonNull String callsite) { @NonNull WindowlessWindowManager wwm, @NonNull String callsite) { mSurfaceControl = wwm.mRootSurface; mWm = wwm; mWm = wwm; mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout()); mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout()); mCloseGuard.openWithCallSite("release", callsite); mCloseGuard.openWithCallSite("release", callsite); Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +13 −13 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ImageView; import android.widget.TextView; import android.widget.TextView; import android.window.SurfaceSyncGroup; import android.window.WindowContainerTransaction; import android.window.WindowContainerTransaction; import com.android.launcher3.icons.IconProvider; import com.android.launcher3.icons.IconProvider; Loading Loading @@ -311,51 +312,50 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin * Create and display handle menu window * Create and display handle menu window */ */ void createHandleMenu() { void createHandleMenu() { final SurfaceSyncGroup ssg = new SurfaceSyncGroup(TAG); final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); updateHandleMenuPillPositions(); updateHandleMenuPillPositions(); createAppInfoPill(t); createAppInfoPill(t, ssg); // Only show windowing buttons in proto2. Proto1 uses a system-level mode only. // Only show windowing buttons in proto2. Proto1 uses a system-level mode only. final boolean shouldShowWindowingPill = DesktopModeStatus.isProto2Enabled(); final boolean shouldShowWindowingPill = DesktopModeStatus.isProto2Enabled(); if (shouldShowWindowingPill) { if (shouldShowWindowingPill) { createWindowingPill(t); createWindowingPill(t, ssg); } } createMoreActionsPill(t); createMoreActionsPill(t, ssg); mSyncQueue.runInSync(transaction -> { ssg.addTransaction(t); transaction.merge(t); ssg.markSyncReady(); t.close(); }); setupHandleMenu(shouldShowWindowingPill); setupHandleMenu(shouldShowWindowingPill); } } private void createAppInfoPill(SurfaceControl.Transaction t) { private void createAppInfoPill(SurfaceControl.Transaction t, SurfaceSyncGroup ssg) { final int x = (int) mHandleMenuAppInfoPillPosition.x; final int x = (int) mHandleMenuAppInfoPillPosition.x; final int y = (int) mHandleMenuAppInfoPillPosition.y; final int y = (int) mHandleMenuAppInfoPillPosition.y; mHandleMenuAppInfoPill = addWindow( mHandleMenuAppInfoPill = addWindow( R.layout.desktop_mode_window_decor_handle_menu_app_info_pill, R.layout.desktop_mode_window_decor_handle_menu_app_info_pill, "Menu's app info pill", "Menu's app info pill", t, x, y, mMenuWidth, mAppInfoPillHeight, mShadowRadius, mCornerRadius); t, ssg, x, y, mMenuWidth, mAppInfoPillHeight, mShadowRadius, mCornerRadius); } } private void createWindowingPill(SurfaceControl.Transaction t) { private void createWindowingPill(SurfaceControl.Transaction t, SurfaceSyncGroup ssg) { final int x = (int) mHandleMenuWindowingPillPosition.x; final int x = (int) mHandleMenuWindowingPillPosition.x; final int y = (int) mHandleMenuWindowingPillPosition.y; final int y = (int) mHandleMenuWindowingPillPosition.y; mHandleMenuWindowingPill = addWindow( mHandleMenuWindowingPill = addWindow( R.layout.desktop_mode_window_decor_handle_menu_windowing_pill, R.layout.desktop_mode_window_decor_handle_menu_windowing_pill, "Menu's windowing pill", "Menu's windowing pill", t, x, y, mMenuWidth, mWindowingPillHeight, mShadowRadius, mCornerRadius); t, ssg, x, y, mMenuWidth, mWindowingPillHeight, mShadowRadius, mCornerRadius); } } private void createMoreActionsPill(SurfaceControl.Transaction t) { private void createMoreActionsPill(SurfaceControl.Transaction t, SurfaceSyncGroup ssg) { final int x = (int) mHandleMenuMoreActionsPillPosition.x; final int x = (int) mHandleMenuMoreActionsPillPosition.x; final int y = (int) mHandleMenuMoreActionsPillPosition.y; final int y = (int) mHandleMenuMoreActionsPillPosition.y; mHandleMenuMoreActionsPill = addWindow( mHandleMenuMoreActionsPill = addWindow( R.layout.desktop_mode_window_decor_handle_menu_more_actions_pill, R.layout.desktop_mode_window_decor_handle_menu_more_actions_pill, "Menu's more actions pill", "Menu's more actions pill", t, x, y, mMenuWidth, mMoreActionsPillHeight, mShadowRadius, mCornerRadius); t, ssg, x, y, mMenuWidth, mMoreActionsPillHeight, mShadowRadius, mCornerRadius); } } private void setupHandleMenu(boolean windowingPillShown) { private void setupHandleMenu(boolean windowingPillShown) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java +14 −11 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.view.ViewRootImpl; import android.view.WindowInsets; import android.view.WindowInsets; import android.view.WindowManager; import android.view.WindowManager; import android.view.WindowlessWindowManager; import android.view.WindowlessWindowManager; import android.window.SurfaceSyncGroup; import android.window.TaskConstants; import android.window.TaskConstants; import android.window.WindowContainerTransaction; import android.window.WindowContainerTransaction; Loading Loading @@ -382,6 +383,7 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> /** /** * Create a window associated with this WindowDecoration. * Create a window associated with this WindowDecoration. * Note that subclass must dispose of this when the task is hidden/closed. * Note that subclass must dispose of this when the task is hidden/closed. * * @param layoutId layout to make the window from * @param layoutId layout to make the window from * @param t the transaction to apply * @param t the transaction to apply * @param xPos x position of new window * @param xPos x position of new window Loading @@ -393,7 +395,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> * @return the {@link AdditionalWindow} that was added. * @return the {@link AdditionalWindow} that was added. */ */ AdditionalWindow addWindow(int layoutId, String namePrefix, SurfaceControl.Transaction t, AdditionalWindow addWindow(int layoutId, String namePrefix, SurfaceControl.Transaction t, int xPos, int yPos, int width, int height, int shadowRadius, int cornerRadius) { SurfaceSyncGroup ssg, int xPos, int yPos, int width, int height, int shadowRadius, int cornerRadius) { final SurfaceControl.Builder builder = mSurfaceControlBuilderSupplier.get(); final SurfaceControl.Builder builder = mSurfaceControlBuilderSupplier.get(); SurfaceControl windowSurfaceControl = builder SurfaceControl windowSurfaceControl = builder .setName(namePrefix + " of Task=" + mTaskInfo.taskId) .setName(namePrefix + " of Task=" + mTaskInfo.taskId) Loading @@ -417,7 +420,7 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> windowSurfaceControl, null /* hostInputToken */); windowSurfaceControl, null /* hostInputToken */); SurfaceControlViewHost viewHost = mSurfaceControlViewHostFactory SurfaceControlViewHost viewHost = mSurfaceControlViewHostFactory .create(mDecorWindowContext, mDisplay, windowManager); .create(mDecorWindowContext, mDisplay, windowManager); viewHost.setView(v, lp); ssg.add(viewHost.getSurfacePackage(), () -> viewHost.setView(v, lp)); return new AdditionalWindow(windowSurfaceControl, viewHost, return new AdditionalWindow(windowSurfaceControl, viewHost, mSurfaceControlTransactionSupplier); mSurfaceControlTransactionSupplier); } } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/WindowDecorationTests.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -49,6 +49,7 @@ import android.view.View; import android.view.ViewRootImpl; import android.view.ViewRootImpl; import android.view.WindowInsets; import android.view.WindowInsets; import android.view.WindowManager.LayoutParams; import android.view.WindowManager.LayoutParams; import android.window.SurfaceSyncGroup; import android.window.TaskConstants; import android.window.TaskConstants; import android.window.WindowContainerTransaction; import android.window.WindowContainerTransaction; Loading Loading @@ -100,6 +101,8 @@ public class WindowDecorationTests extends ShellTestCase { private TestView mMockView; private TestView mMockView; @Mock @Mock private WindowContainerTransaction mMockWindowContainerTransaction; private WindowContainerTransaction mMockWindowContainerTransaction; @Mock private SurfaceSyncGroup mMockSurfaceSyncGroup; private final List<SurfaceControl.Transaction> mMockSurfaceControlTransactions = private final List<SurfaceControl.Transaction> mMockSurfaceControlTransactions = new ArrayList<>(); new ArrayList<>(); Loading Loading @@ -553,7 +556,7 @@ public class WindowDecorationTests extends ShellTestCase { String name = "Test Window"; String name = "Test Window"; WindowDecoration.AdditionalWindow additionalWindow = WindowDecoration.AdditionalWindow additionalWindow = addWindow(R.layout.desktop_mode_window_decor_handle_menu_app_info_pill, name, addWindow(R.layout.desktop_mode_window_decor_handle_menu_app_info_pill, name, mMockSurfaceControlAddWindowT, x, y, mMockSurfaceControlAddWindowT, mMockSurfaceSyncGroup, x, y, width, height, shadowRadius, cornerRadius); width, height, shadowRadius, cornerRadius); return additionalWindow; return additionalWindow; } } Loading Loading
core/java/android/view/SurfaceControlViewHost.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -303,6 +303,7 @@ public class SurfaceControlViewHost { /** @hide */ /** @hide */ public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d, public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d, @NonNull WindowlessWindowManager wwm, @NonNull String callsite) { @NonNull WindowlessWindowManager wwm, @NonNull String callsite) { mSurfaceControl = wwm.mRootSurface; mWm = wwm; mWm = wwm; mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout()); mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout()); mCloseGuard.openWithCallSite("release", callsite); mCloseGuard.openWithCallSite("release", callsite); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +13 −13 Original line number Original line Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.widget.Button; import android.widget.ImageButton; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ImageView; import android.widget.TextView; import android.widget.TextView; import android.window.SurfaceSyncGroup; import android.window.WindowContainerTransaction; import android.window.WindowContainerTransaction; import com.android.launcher3.icons.IconProvider; import com.android.launcher3.icons.IconProvider; Loading Loading @@ -311,51 +312,50 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin * Create and display handle menu window * Create and display handle menu window */ */ void createHandleMenu() { void createHandleMenu() { final SurfaceSyncGroup ssg = new SurfaceSyncGroup(TAG); final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); updateHandleMenuPillPositions(); updateHandleMenuPillPositions(); createAppInfoPill(t); createAppInfoPill(t, ssg); // Only show windowing buttons in proto2. Proto1 uses a system-level mode only. // Only show windowing buttons in proto2. Proto1 uses a system-level mode only. final boolean shouldShowWindowingPill = DesktopModeStatus.isProto2Enabled(); final boolean shouldShowWindowingPill = DesktopModeStatus.isProto2Enabled(); if (shouldShowWindowingPill) { if (shouldShowWindowingPill) { createWindowingPill(t); createWindowingPill(t, ssg); } } createMoreActionsPill(t); createMoreActionsPill(t, ssg); mSyncQueue.runInSync(transaction -> { ssg.addTransaction(t); transaction.merge(t); ssg.markSyncReady(); t.close(); }); setupHandleMenu(shouldShowWindowingPill); setupHandleMenu(shouldShowWindowingPill); } } private void createAppInfoPill(SurfaceControl.Transaction t) { private void createAppInfoPill(SurfaceControl.Transaction t, SurfaceSyncGroup ssg) { final int x = (int) mHandleMenuAppInfoPillPosition.x; final int x = (int) mHandleMenuAppInfoPillPosition.x; final int y = (int) mHandleMenuAppInfoPillPosition.y; final int y = (int) mHandleMenuAppInfoPillPosition.y; mHandleMenuAppInfoPill = addWindow( mHandleMenuAppInfoPill = addWindow( R.layout.desktop_mode_window_decor_handle_menu_app_info_pill, R.layout.desktop_mode_window_decor_handle_menu_app_info_pill, "Menu's app info pill", "Menu's app info pill", t, x, y, mMenuWidth, mAppInfoPillHeight, mShadowRadius, mCornerRadius); t, ssg, x, y, mMenuWidth, mAppInfoPillHeight, mShadowRadius, mCornerRadius); } } private void createWindowingPill(SurfaceControl.Transaction t) { private void createWindowingPill(SurfaceControl.Transaction t, SurfaceSyncGroup ssg) { final int x = (int) mHandleMenuWindowingPillPosition.x; final int x = (int) mHandleMenuWindowingPillPosition.x; final int y = (int) mHandleMenuWindowingPillPosition.y; final int y = (int) mHandleMenuWindowingPillPosition.y; mHandleMenuWindowingPill = addWindow( mHandleMenuWindowingPill = addWindow( R.layout.desktop_mode_window_decor_handle_menu_windowing_pill, R.layout.desktop_mode_window_decor_handle_menu_windowing_pill, "Menu's windowing pill", "Menu's windowing pill", t, x, y, mMenuWidth, mWindowingPillHeight, mShadowRadius, mCornerRadius); t, ssg, x, y, mMenuWidth, mWindowingPillHeight, mShadowRadius, mCornerRadius); } } private void createMoreActionsPill(SurfaceControl.Transaction t) { private void createMoreActionsPill(SurfaceControl.Transaction t, SurfaceSyncGroup ssg) { final int x = (int) mHandleMenuMoreActionsPillPosition.x; final int x = (int) mHandleMenuMoreActionsPillPosition.x; final int y = (int) mHandleMenuMoreActionsPillPosition.y; final int y = (int) mHandleMenuMoreActionsPillPosition.y; mHandleMenuMoreActionsPill = addWindow( mHandleMenuMoreActionsPill = addWindow( R.layout.desktop_mode_window_decor_handle_menu_more_actions_pill, R.layout.desktop_mode_window_decor_handle_menu_more_actions_pill, "Menu's more actions pill", "Menu's more actions pill", t, x, y, mMenuWidth, mMoreActionsPillHeight, mShadowRadius, mCornerRadius); t, ssg, x, y, mMenuWidth, mMoreActionsPillHeight, mShadowRadius, mCornerRadius); } } private void setupHandleMenu(boolean windowingPillShown) { private void setupHandleMenu(boolean windowingPillShown) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java +14 −11 Original line number Original line Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.view.ViewRootImpl; import android.view.WindowInsets; import android.view.WindowInsets; import android.view.WindowManager; import android.view.WindowManager; import android.view.WindowlessWindowManager; import android.view.WindowlessWindowManager; import android.window.SurfaceSyncGroup; import android.window.TaskConstants; import android.window.TaskConstants; import android.window.WindowContainerTransaction; import android.window.WindowContainerTransaction; Loading Loading @@ -382,6 +383,7 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> /** /** * Create a window associated with this WindowDecoration. * Create a window associated with this WindowDecoration. * Note that subclass must dispose of this when the task is hidden/closed. * Note that subclass must dispose of this when the task is hidden/closed. * * @param layoutId layout to make the window from * @param layoutId layout to make the window from * @param t the transaction to apply * @param t the transaction to apply * @param xPos x position of new window * @param xPos x position of new window Loading @@ -393,7 +395,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> * @return the {@link AdditionalWindow} that was added. * @return the {@link AdditionalWindow} that was added. */ */ AdditionalWindow addWindow(int layoutId, String namePrefix, SurfaceControl.Transaction t, AdditionalWindow addWindow(int layoutId, String namePrefix, SurfaceControl.Transaction t, int xPos, int yPos, int width, int height, int shadowRadius, int cornerRadius) { SurfaceSyncGroup ssg, int xPos, int yPos, int width, int height, int shadowRadius, int cornerRadius) { final SurfaceControl.Builder builder = mSurfaceControlBuilderSupplier.get(); final SurfaceControl.Builder builder = mSurfaceControlBuilderSupplier.get(); SurfaceControl windowSurfaceControl = builder SurfaceControl windowSurfaceControl = builder .setName(namePrefix + " of Task=" + mTaskInfo.taskId) .setName(namePrefix + " of Task=" + mTaskInfo.taskId) Loading @@ -417,7 +420,7 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> windowSurfaceControl, null /* hostInputToken */); windowSurfaceControl, null /* hostInputToken */); SurfaceControlViewHost viewHost = mSurfaceControlViewHostFactory SurfaceControlViewHost viewHost = mSurfaceControlViewHostFactory .create(mDecorWindowContext, mDisplay, windowManager); .create(mDecorWindowContext, mDisplay, windowManager); viewHost.setView(v, lp); ssg.add(viewHost.getSurfacePackage(), () -> viewHost.setView(v, lp)); return new AdditionalWindow(windowSurfaceControl, viewHost, return new AdditionalWindow(windowSurfaceControl, viewHost, mSurfaceControlTransactionSupplier); mSurfaceControlTransactionSupplier); } } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/WindowDecorationTests.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -49,6 +49,7 @@ import android.view.View; import android.view.ViewRootImpl; import android.view.ViewRootImpl; import android.view.WindowInsets; import android.view.WindowInsets; import android.view.WindowManager.LayoutParams; import android.view.WindowManager.LayoutParams; import android.window.SurfaceSyncGroup; import android.window.TaskConstants; import android.window.TaskConstants; import android.window.WindowContainerTransaction; import android.window.WindowContainerTransaction; Loading Loading @@ -100,6 +101,8 @@ public class WindowDecorationTests extends ShellTestCase { private TestView mMockView; private TestView mMockView; @Mock @Mock private WindowContainerTransaction mMockWindowContainerTransaction; private WindowContainerTransaction mMockWindowContainerTransaction; @Mock private SurfaceSyncGroup mMockSurfaceSyncGroup; private final List<SurfaceControl.Transaction> mMockSurfaceControlTransactions = private final List<SurfaceControl.Transaction> mMockSurfaceControlTransactions = new ArrayList<>(); new ArrayList<>(); Loading Loading @@ -553,7 +556,7 @@ public class WindowDecorationTests extends ShellTestCase { String name = "Test Window"; String name = "Test Window"; WindowDecoration.AdditionalWindow additionalWindow = WindowDecoration.AdditionalWindow additionalWindow = addWindow(R.layout.desktop_mode_window_decor_handle_menu_app_info_pill, name, addWindow(R.layout.desktop_mode_window_decor_handle_menu_app_info_pill, name, mMockSurfaceControlAddWindowT, x, y, mMockSurfaceControlAddWindowT, mMockSurfaceSyncGroup, x, y, width, height, shadowRadius, cornerRadius); width, height, shadowRadius, cornerRadius); return additionalWindow; return additionalWindow; } } Loading