Loading core/java/android/view/ViewRootImpl.java +8 −0 Original line number Diff line number Diff line Loading @@ -300,6 +300,14 @@ public final class ViewRootImpl implements ViewParent, public static final boolean CAPTION_ON_SHELL = SystemProperties.getBoolean("persist.wm.debug.caption_on_shell", true); /** * Whether the client (system UI) is handling the transient gesture and the corresponding * animation. * @hide */ public static final boolean CLIENT_TRANSIENT = SystemProperties.getBoolean("persist.wm.debug.client_transient", false); /** * Whether the client should compute the window frame on its own. * @hide Loading services/core/java/com/android/server/wm/DisplayPolicy.java +146 −127 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.view.InsetsFrameProvider.SOURCE_ARBITRARY_RECTANGLE; import static android.view.InsetsFrameProvider.SOURCE_CONTAINER_BOUNDS; import static android.view.InsetsFrameProvider.SOURCE_DISPLAY; import static android.view.InsetsFrameProvider.SOURCE_FRAME; import static android.view.ViewRootImpl.CLIENT_TRANSIENT; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS; Loading Loading @@ -213,7 +214,8 @@ public class DisplayPolicy { } } private final SystemGesturesPointerEventListener mSystemGestures; // Will be null in client transient mode. private SystemGesturesPointerEventListener mSystemGestures; final DecorInsets mDecorInsets; Loading Loading @@ -408,7 +410,8 @@ public class DisplayPolicy { final Looper looper = UiThread.getHandler().getLooper(); mHandler = new PolicyHandler(looper); // TODO(b/181821798) Migrate SystemGesturesPointerEventListener to use window context. mSystemGestures = new SystemGesturesPointerEventListener(mUiContext, mHandler, if (!CLIENT_TRANSIENT) { SystemGesturesPointerEventListener.Callbacks gesturesPointerEventCallbacks = new SystemGesturesPointerEventListener.Callbacks() { private static final long MOUSE_GESTURE_DELAY_MS = 500; Loading Loading @@ -558,8 +561,11 @@ public class DisplayPolicy { public void onMouseLeaveFromBottom() { mHandler.removeCallbacks(mOnSwipeFromBottom); } }); }; mSystemGestures = new SystemGesturesPointerEventListener(mUiContext, mHandler, gesturesPointerEventCallbacks); displayContent.registerPointerEventListener(mSystemGestures); } mAppTransitionListener = new WindowManagerInternal.AppTransitionListener() { private Runnable mAppTransitionPending = () -> { Loading Loading @@ -645,7 +651,9 @@ public class DisplayPolicy { mContext, () -> { synchronized (mLock) { onConfigurationChanged(); if (!CLIENT_TRANSIENT) { mSystemGestures.onConfigurationChanged(); } mDisplayContent.updateSystemGestureExclusion(); } }); Loading @@ -667,7 +675,9 @@ public class DisplayPolicy { } void systemReady() { if (!CLIENT_TRANSIENT) { mSystemGestures.systemReady(); } if (mService.mPointerLocationEnabled) { setPointerLocationEnabled(true); } Loading Loading @@ -1308,8 +1318,10 @@ public class DisplayPolicy { } void onDisplayInfoChanged(DisplayInfo info) { if (!CLIENT_TRANSIENT) { mSystemGestures.onDisplayInfoChanged(info); } } /** * Called for each window attached to the window manager as layout is proceeding. The Loading Loading @@ -1681,8 +1693,10 @@ public class DisplayPolicy { // Update the latest display size, cutout. mDisplayContent.updateDisplayInfo(); onConfigurationChanged(); if (!CLIENT_TRANSIENT) { mSystemGestures.onConfigurationChanged(); } } /** * Called when the configuration has changed, and it's safe to load new values from resources. Loading Loading @@ -1960,6 +1974,9 @@ public class DisplayPolicy { @VisibleForTesting void requestTransientBars(WindowState swipeTarget, boolean isGestureOnSystemBar) { if (CLIENT_TRANSIENT) { return; } if (swipeTarget == null || !mService.mPolicy.isUserSetupComplete()) { // Swipe-up for navigation bar is disabled during setup return; Loading Loading @@ -2608,7 +2625,9 @@ public class DisplayPolicy { final DecorInsets.Info info = mDecorInsets.mInfoForRotation[rotation]; pw.println(prefixInner + Surface.rotationToString(rotation) + "=" + info); } if (!CLIENT_TRANSIENT) { mSystemGestures.dump(pw, prefix); } pw.print(prefix); pw.println("Looper state:"); mHandler.getLooper().dump(new PrintWriterPrinter(pw), prefix + " "); Loading services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java +4 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.view.RoundedCorners.NO_ROUNDED_CORNERS; import static android.view.Surface.ROTATION_0; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.view.ViewRootImpl.CLIENT_TRANSIENT; import static android.view.WindowInsets.Type.navigationBars; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; Loading Loading @@ -63,6 +64,7 @@ import android.view.WindowManager; import androidx.test.filters.SmallTest; import org.junit.Assume; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -388,6 +390,7 @@ public class DisplayPolicyTests extends WindowTestsBase { @SetupWindows(addWindows = { W_ACTIVITY, W_NAVIGATION_BAR }) @Test public void testCanSystemBarsBeShownByUser() { Assume.assumeFalse(CLIENT_TRANSIENT); ((TestWindowManagerPolicy) mWm.mPolicy).mIsUserSetupComplete = true; mAppWindow.mAttrs.insetsFlags.behavior = BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; mAppWindow.setRequestedVisibleTypes(0, navigationBars()); Loading @@ -409,6 +412,7 @@ public class DisplayPolicyTests extends WindowTestsBase { @UseTestDisplay(addWindows = { W_NAVIGATION_BAR }) @Test public void testTransientBarsSuppressedOnDreams() { Assume.assumeFalse(CLIENT_TRANSIENT); final WindowState win = createDreamWindow(); ((TestWindowManagerPolicy) mWm.mPolicy).mIsUserSetupComplete = true; Loading Loading
core/java/android/view/ViewRootImpl.java +8 −0 Original line number Diff line number Diff line Loading @@ -300,6 +300,14 @@ public final class ViewRootImpl implements ViewParent, public static final boolean CAPTION_ON_SHELL = SystemProperties.getBoolean("persist.wm.debug.caption_on_shell", true); /** * Whether the client (system UI) is handling the transient gesture and the corresponding * animation. * @hide */ public static final boolean CLIENT_TRANSIENT = SystemProperties.getBoolean("persist.wm.debug.client_transient", false); /** * Whether the client should compute the window frame on its own. * @hide Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +146 −127 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.view.InsetsFrameProvider.SOURCE_ARBITRARY_RECTANGLE; import static android.view.InsetsFrameProvider.SOURCE_CONTAINER_BOUNDS; import static android.view.InsetsFrameProvider.SOURCE_DISPLAY; import static android.view.InsetsFrameProvider.SOURCE_FRAME; import static android.view.ViewRootImpl.CLIENT_TRANSIENT; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS; Loading Loading @@ -213,7 +214,8 @@ public class DisplayPolicy { } } private final SystemGesturesPointerEventListener mSystemGestures; // Will be null in client transient mode. private SystemGesturesPointerEventListener mSystemGestures; final DecorInsets mDecorInsets; Loading Loading @@ -408,7 +410,8 @@ public class DisplayPolicy { final Looper looper = UiThread.getHandler().getLooper(); mHandler = new PolicyHandler(looper); // TODO(b/181821798) Migrate SystemGesturesPointerEventListener to use window context. mSystemGestures = new SystemGesturesPointerEventListener(mUiContext, mHandler, if (!CLIENT_TRANSIENT) { SystemGesturesPointerEventListener.Callbacks gesturesPointerEventCallbacks = new SystemGesturesPointerEventListener.Callbacks() { private static final long MOUSE_GESTURE_DELAY_MS = 500; Loading Loading @@ -558,8 +561,11 @@ public class DisplayPolicy { public void onMouseLeaveFromBottom() { mHandler.removeCallbacks(mOnSwipeFromBottom); } }); }; mSystemGestures = new SystemGesturesPointerEventListener(mUiContext, mHandler, gesturesPointerEventCallbacks); displayContent.registerPointerEventListener(mSystemGestures); } mAppTransitionListener = new WindowManagerInternal.AppTransitionListener() { private Runnable mAppTransitionPending = () -> { Loading Loading @@ -645,7 +651,9 @@ public class DisplayPolicy { mContext, () -> { synchronized (mLock) { onConfigurationChanged(); if (!CLIENT_TRANSIENT) { mSystemGestures.onConfigurationChanged(); } mDisplayContent.updateSystemGestureExclusion(); } }); Loading @@ -667,7 +675,9 @@ public class DisplayPolicy { } void systemReady() { if (!CLIENT_TRANSIENT) { mSystemGestures.systemReady(); } if (mService.mPointerLocationEnabled) { setPointerLocationEnabled(true); } Loading Loading @@ -1308,8 +1318,10 @@ public class DisplayPolicy { } void onDisplayInfoChanged(DisplayInfo info) { if (!CLIENT_TRANSIENT) { mSystemGestures.onDisplayInfoChanged(info); } } /** * Called for each window attached to the window manager as layout is proceeding. The Loading Loading @@ -1681,8 +1693,10 @@ public class DisplayPolicy { // Update the latest display size, cutout. mDisplayContent.updateDisplayInfo(); onConfigurationChanged(); if (!CLIENT_TRANSIENT) { mSystemGestures.onConfigurationChanged(); } } /** * Called when the configuration has changed, and it's safe to load new values from resources. Loading Loading @@ -1960,6 +1974,9 @@ public class DisplayPolicy { @VisibleForTesting void requestTransientBars(WindowState swipeTarget, boolean isGestureOnSystemBar) { if (CLIENT_TRANSIENT) { return; } if (swipeTarget == null || !mService.mPolicy.isUserSetupComplete()) { // Swipe-up for navigation bar is disabled during setup return; Loading Loading @@ -2608,7 +2625,9 @@ public class DisplayPolicy { final DecorInsets.Info info = mDecorInsets.mInfoForRotation[rotation]; pw.println(prefixInner + Surface.rotationToString(rotation) + "=" + info); } if (!CLIENT_TRANSIENT) { mSystemGestures.dump(pw, prefix); } pw.print(prefix); pw.println("Looper state:"); mHandler.getLooper().dump(new PrintWriterPrinter(pw), prefix + " "); Loading
services/tests/wmtests/src/com/android/server/wm/DisplayPolicyTests.java +4 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.view.RoundedCorners.NO_ROUNDED_CORNERS; import static android.view.Surface.ROTATION_0; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; import static android.view.ViewRootImpl.CLIENT_TRANSIENT; import static android.view.WindowInsets.Type.navigationBars; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; Loading Loading @@ -63,6 +64,7 @@ import android.view.WindowManager; import androidx.test.filters.SmallTest; import org.junit.Assume; import org.junit.Test; import org.junit.runner.RunWith; Loading Loading @@ -388,6 +390,7 @@ public class DisplayPolicyTests extends WindowTestsBase { @SetupWindows(addWindows = { W_ACTIVITY, W_NAVIGATION_BAR }) @Test public void testCanSystemBarsBeShownByUser() { Assume.assumeFalse(CLIENT_TRANSIENT); ((TestWindowManagerPolicy) mWm.mPolicy).mIsUserSetupComplete = true; mAppWindow.mAttrs.insetsFlags.behavior = BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; mAppWindow.setRequestedVisibleTypes(0, navigationBars()); Loading @@ -409,6 +412,7 @@ public class DisplayPolicyTests extends WindowTestsBase { @UseTestDisplay(addWindows = { W_NAVIGATION_BAR }) @Test public void testTransientBarsSuppressedOnDreams() { Assume.assumeFalse(CLIENT_TRANSIENT); final WindowState win = createDreamWindow(); ((TestWindowManagerPolicy) mWm.mPolicy).mIsUserSetupComplete = true; Loading