Loading core/res/res/values/config.xml +9 −0 Original line number Diff line number Diff line Loading @@ -757,6 +757,15 @@ bar for all apps. --> <bool name="config_remoteInsetsControllerControlsSystemBars">false</bool> <!-- Control whether the system bars can be requested when using a remote insets control target. This allows for specifying whether or not system bars can be shown by the user (via swipe or other means) when they are hidden by the logic defined by the remote insets controller. This is useful for cases where the system provides alternative affordances for showing and hiding the bars or for cases in which it's desired the bars not be shown for any reason. This configuration will only apply when config_remoteInsetsControllerControlsSystemBars. is set to true. --> <bool name="config_remoteInsetsControllerSystemBarsCanBeShownByUserAction">false</bool> <!-- HDMI behavior --> <!-- The number of degrees to rotate the display when the device has HDMI connected Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1732,6 +1732,7 @@ <java-symbol type="bool" name="config_enableLockBeforeUnlockScreen" /> <java-symbol type="bool" name="config_enableLockScreenRotation" /> <java-symbol type="bool" name="config_remoteInsetsControllerControlsSystemBars" /> <java-symbol type="bool" name="config_remoteInsetsControllerSystemBarsCanBeShownByUserAction" /> <java-symbol type="bool" name="config_lidControlsScreenLock" /> <java-symbol type="bool" name="config_lidControlsSleep" /> <java-symbol type="bool" name="config_lockDayNightMode" /> Loading services/core/java/com/android/server/wm/DisplayContent.java +13 −4 Original line number Diff line number Diff line Loading @@ -230,6 +230,7 @@ import android.window.DisplayWindowPolicyController; import android.window.IDisplayAreaOrganizer; import android.window.TransitionRequestInfo; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; Loading Loading @@ -1075,7 +1076,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mDisplayPolicy = new DisplayPolicy(mWmService, this); mDisplayRotation = new DisplayRotation(mWmService, this); mCloseToSquareMaxAspectRatio = mWmService.mContext.getResources().getFloat( com.android.internal.R.dimen.config_closeToSquareDisplayMaxAspectRatio); R.dimen.config_closeToSquareDisplayMaxAspectRatio); if (isDefaultDisplay) { // The policy may be invoked right after here, so it requires the necessary default // fields of this display content. Loading Loading @@ -1567,7 +1568,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mAtmService.mContext.createConfigurationContext(getConfiguration()); final float minimalSize = displayConfigurationContext.getResources().getDimension( com.android.internal.R.dimen.default_minimal_size_resizable_task); R.dimen.default_minimal_size_resizable_task); if (Double.compare(mDisplayMetrics.density, 0.0) == 0) { throw new IllegalArgumentException("Display with ID=" + getDisplayId() + "has invalid " + "DisplayMetrics.density= 0.0"); Loading Loading @@ -4571,9 +4572,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // if the wallpaper service is disabled on the device, we're never going to have // wallpaper, don't bother waiting for it boolean wallpaperEnabled = mWmService.mContext.getResources().getBoolean( com.android.internal.R.bool.config_enableWallpaperService) R.bool.config_enableWallpaperService) && mWmService.mContext.getResources().getBoolean( com.android.internal.R.bool.config_checkWallpaperAtBoot) R.bool.config_checkWallpaperAtBoot) && !mWmService.mOnlyCore; final boolean haveBootMsg = drawnWindowTypes.get(TYPE_BOOT_PROGRESS); Loading Loading @@ -6534,9 +6535,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp class RemoteInsetsControlTarget implements InsetsControlTarget { private final IDisplayWindowInsetsController mRemoteInsetsController; private final InsetsVisibilities mRequestedVisibilities = new InsetsVisibilities(); private final boolean mCanShowTransient; RemoteInsetsControlTarget(IDisplayWindowInsetsController controller) { mRemoteInsetsController = controller; mCanShowTransient = mWmService.mContext.getResources().getBoolean( R.bool.config_remoteInsetsControllerSystemBarsCanBeShownByUserAction); } /** Loading Loading @@ -6592,6 +6596,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } @Override public boolean canShowTransient() { return mCanShowTransient; } @Override public boolean getRequestedVisibility(@InternalInsetsType int type) { if (type == ITYPE_IME) { Loading services/core/java/com/android/server/wm/DisplayPolicy.java +17 −2 Original line number Diff line number Diff line Loading @@ -220,6 +220,7 @@ public class DisplayPolicy { @Px private int mRightGestureInset; private boolean mCanSystemBarsBeShownByUser; private boolean mNavButtonForcedVisible; StatusBarManagerInternal getStatusBarManagerInternal() { Loading Loading @@ -425,6 +426,9 @@ public class DisplayPolicy { final Resources r = mContext.getResources(); mCarDockEnablesAccelerometer = r.getBoolean(R.bool.config_carDockEnablesAccelerometer); mDeskDockEnablesAccelerometer = r.getBoolean(R.bool.config_deskDockEnablesAccelerometer); mCanSystemBarsBeShownByUser = !r.getBoolean( R.bool.config_remoteInsetsControllerControlsSystemBars) || r.getBoolean( R.bool.config_remoteInsetsControllerSystemBarsCanBeShownByUserAction); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService( Context.ACCESSIBILITY_SERVICE); Loading Loading @@ -617,7 +621,7 @@ public class DisplayPolicy { displayContent.mAppTransition.registerListenerLocked(mAppTransitionListener); displayContent.mTransitionController.registerLegacyListener(mAppTransitionListener); mImmersiveModeConfirmation = new ImmersiveModeConfirmation(mContext, looper, mService.mVrModeEnabled); mService.mVrModeEnabled, mCanSystemBarsBeShownByUser); // TODO: Make it can take screenshot on external display mScreenshotHelper = displayContent.isDefaultDisplay Loading Loading @@ -2024,6 +2028,11 @@ public class DisplayPolicy { return lp.width; } @VisibleForTesting void setCanSystemBarsBeShownByUser(boolean canBeShown) { mCanSystemBarsBeShownByUser = canBeShown; } void notifyDisplayReady() { mHandler.post(() -> { final int displayId = getDisplayId(); Loading Loading @@ -2261,11 +2270,17 @@ public class DisplayPolicy { updateSystemBarAttributes(); } private void requestTransientBars(WindowState swipeTarget, boolean isGestureOnSystemBar) { @VisibleForTesting void requestTransientBars(WindowState swipeTarget, boolean isGestureOnSystemBar) { if (swipeTarget == null || !mService.mPolicy.isUserSetupComplete()) { // Swipe-up for navigation bar is disabled during setup return; } if (!mCanSystemBarsBeShownByUser) { Slog.d(TAG, "Remote insets controller disallows showing system bars - ignoring " + "request"); return; } final InsetsSourceProvider provider = swipeTarget.getControllableInsetProvider(); final InsetsControlTarget controlTarget = provider != null ? provider.getControlTarget() : null; Loading services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java +5 −1 Original line number Diff line number Diff line Loading @@ -99,9 +99,11 @@ public class ImmersiveModeConfirmation { // Local copy of vr mode enabled state, to avoid calling into VrManager with // the lock held. private boolean mVrModeEnabled; private boolean mCanSystemBarsBeShownByUser; private int mLockTaskState = LOCK_TASK_MODE_NONE; ImmersiveModeConfirmation(Context context, Looper looper, boolean vrModeEnabled) { ImmersiveModeConfirmation(Context context, Looper looper, boolean vrModeEnabled, boolean canSystemBarsBeShownByUser) { final Display display = context.getDisplay(); final Context uiContext = ActivityThread.currentActivityThread().getSystemUiContext(); mContext = display.getDisplayId() == DEFAULT_DISPLAY Loading @@ -111,6 +113,7 @@ public class ImmersiveModeConfirmation { mPanicThresholdMs = context.getResources() .getInteger(R.integer.config_immersive_mode_confirmation_panic); mVrModeEnabled = vrModeEnabled; mCanSystemBarsBeShownByUser = canSystemBarsBeShownByUser; } private long getNavBarExitDuration() { Loading Loading @@ -171,6 +174,7 @@ public class ImmersiveModeConfirmation { if ((DEBUG_SHOW_EVERY_TIME || !sConfirmed) && userSetupComplete && !mVrModeEnabled && mCanSystemBarsBeShownByUser && !navBarEmpty && !UserManager.isDeviceInDemoMode(mContext) && (mLockTaskState != LOCK_TASK_MODE_LOCKED)) { Loading Loading
core/res/res/values/config.xml +9 −0 Original line number Diff line number Diff line Loading @@ -757,6 +757,15 @@ bar for all apps. --> <bool name="config_remoteInsetsControllerControlsSystemBars">false</bool> <!-- Control whether the system bars can be requested when using a remote insets control target. This allows for specifying whether or not system bars can be shown by the user (via swipe or other means) when they are hidden by the logic defined by the remote insets controller. This is useful for cases where the system provides alternative affordances for showing and hiding the bars or for cases in which it's desired the bars not be shown for any reason. This configuration will only apply when config_remoteInsetsControllerControlsSystemBars. is set to true. --> <bool name="config_remoteInsetsControllerSystemBarsCanBeShownByUserAction">false</bool> <!-- HDMI behavior --> <!-- The number of degrees to rotate the display when the device has HDMI connected Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1732,6 +1732,7 @@ <java-symbol type="bool" name="config_enableLockBeforeUnlockScreen" /> <java-symbol type="bool" name="config_enableLockScreenRotation" /> <java-symbol type="bool" name="config_remoteInsetsControllerControlsSystemBars" /> <java-symbol type="bool" name="config_remoteInsetsControllerSystemBarsCanBeShownByUserAction" /> <java-symbol type="bool" name="config_lidControlsScreenLock" /> <java-symbol type="bool" name="config_lidControlsSleep" /> <java-symbol type="bool" name="config_lockDayNightMode" /> Loading
services/core/java/com/android/server/wm/DisplayContent.java +13 −4 Original line number Diff line number Diff line Loading @@ -230,6 +230,7 @@ import android.window.DisplayWindowPolicyController; import android.window.IDisplayAreaOrganizer; import android.window.TransitionRequestInfo; import com.android.internal.R; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; Loading Loading @@ -1075,7 +1076,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mDisplayPolicy = new DisplayPolicy(mWmService, this); mDisplayRotation = new DisplayRotation(mWmService, this); mCloseToSquareMaxAspectRatio = mWmService.mContext.getResources().getFloat( com.android.internal.R.dimen.config_closeToSquareDisplayMaxAspectRatio); R.dimen.config_closeToSquareDisplayMaxAspectRatio); if (isDefaultDisplay) { // The policy may be invoked right after here, so it requires the necessary default // fields of this display content. Loading Loading @@ -1567,7 +1568,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mAtmService.mContext.createConfigurationContext(getConfiguration()); final float minimalSize = displayConfigurationContext.getResources().getDimension( com.android.internal.R.dimen.default_minimal_size_resizable_task); R.dimen.default_minimal_size_resizable_task); if (Double.compare(mDisplayMetrics.density, 0.0) == 0) { throw new IllegalArgumentException("Display with ID=" + getDisplayId() + "has invalid " + "DisplayMetrics.density= 0.0"); Loading Loading @@ -4571,9 +4572,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // if the wallpaper service is disabled on the device, we're never going to have // wallpaper, don't bother waiting for it boolean wallpaperEnabled = mWmService.mContext.getResources().getBoolean( com.android.internal.R.bool.config_enableWallpaperService) R.bool.config_enableWallpaperService) && mWmService.mContext.getResources().getBoolean( com.android.internal.R.bool.config_checkWallpaperAtBoot) R.bool.config_checkWallpaperAtBoot) && !mWmService.mOnlyCore; final boolean haveBootMsg = drawnWindowTypes.get(TYPE_BOOT_PROGRESS); Loading Loading @@ -6534,9 +6535,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp class RemoteInsetsControlTarget implements InsetsControlTarget { private final IDisplayWindowInsetsController mRemoteInsetsController; private final InsetsVisibilities mRequestedVisibilities = new InsetsVisibilities(); private final boolean mCanShowTransient; RemoteInsetsControlTarget(IDisplayWindowInsetsController controller) { mRemoteInsetsController = controller; mCanShowTransient = mWmService.mContext.getResources().getBoolean( R.bool.config_remoteInsetsControllerSystemBarsCanBeShownByUserAction); } /** Loading Loading @@ -6592,6 +6596,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } @Override public boolean canShowTransient() { return mCanShowTransient; } @Override public boolean getRequestedVisibility(@InternalInsetsType int type) { if (type == ITYPE_IME) { Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +17 −2 Original line number Diff line number Diff line Loading @@ -220,6 +220,7 @@ public class DisplayPolicy { @Px private int mRightGestureInset; private boolean mCanSystemBarsBeShownByUser; private boolean mNavButtonForcedVisible; StatusBarManagerInternal getStatusBarManagerInternal() { Loading Loading @@ -425,6 +426,9 @@ public class DisplayPolicy { final Resources r = mContext.getResources(); mCarDockEnablesAccelerometer = r.getBoolean(R.bool.config_carDockEnablesAccelerometer); mDeskDockEnablesAccelerometer = r.getBoolean(R.bool.config_deskDockEnablesAccelerometer); mCanSystemBarsBeShownByUser = !r.getBoolean( R.bool.config_remoteInsetsControllerControlsSystemBars) || r.getBoolean( R.bool.config_remoteInsetsControllerSystemBarsCanBeShownByUserAction); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService( Context.ACCESSIBILITY_SERVICE); Loading Loading @@ -617,7 +621,7 @@ public class DisplayPolicy { displayContent.mAppTransition.registerListenerLocked(mAppTransitionListener); displayContent.mTransitionController.registerLegacyListener(mAppTransitionListener); mImmersiveModeConfirmation = new ImmersiveModeConfirmation(mContext, looper, mService.mVrModeEnabled); mService.mVrModeEnabled, mCanSystemBarsBeShownByUser); // TODO: Make it can take screenshot on external display mScreenshotHelper = displayContent.isDefaultDisplay Loading Loading @@ -2024,6 +2028,11 @@ public class DisplayPolicy { return lp.width; } @VisibleForTesting void setCanSystemBarsBeShownByUser(boolean canBeShown) { mCanSystemBarsBeShownByUser = canBeShown; } void notifyDisplayReady() { mHandler.post(() -> { final int displayId = getDisplayId(); Loading Loading @@ -2261,11 +2270,17 @@ public class DisplayPolicy { updateSystemBarAttributes(); } private void requestTransientBars(WindowState swipeTarget, boolean isGestureOnSystemBar) { @VisibleForTesting void requestTransientBars(WindowState swipeTarget, boolean isGestureOnSystemBar) { if (swipeTarget == null || !mService.mPolicy.isUserSetupComplete()) { // Swipe-up for navigation bar is disabled during setup return; } if (!mCanSystemBarsBeShownByUser) { Slog.d(TAG, "Remote insets controller disallows showing system bars - ignoring " + "request"); return; } final InsetsSourceProvider provider = swipeTarget.getControllableInsetProvider(); final InsetsControlTarget controlTarget = provider != null ? provider.getControlTarget() : null; Loading
services/core/java/com/android/server/wm/ImmersiveModeConfirmation.java +5 −1 Original line number Diff line number Diff line Loading @@ -99,9 +99,11 @@ public class ImmersiveModeConfirmation { // Local copy of vr mode enabled state, to avoid calling into VrManager with // the lock held. private boolean mVrModeEnabled; private boolean mCanSystemBarsBeShownByUser; private int mLockTaskState = LOCK_TASK_MODE_NONE; ImmersiveModeConfirmation(Context context, Looper looper, boolean vrModeEnabled) { ImmersiveModeConfirmation(Context context, Looper looper, boolean vrModeEnabled, boolean canSystemBarsBeShownByUser) { final Display display = context.getDisplay(); final Context uiContext = ActivityThread.currentActivityThread().getSystemUiContext(); mContext = display.getDisplayId() == DEFAULT_DISPLAY Loading @@ -111,6 +113,7 @@ public class ImmersiveModeConfirmation { mPanicThresholdMs = context.getResources() .getInteger(R.integer.config_immersive_mode_confirmation_panic); mVrModeEnabled = vrModeEnabled; mCanSystemBarsBeShownByUser = canSystemBarsBeShownByUser; } private long getNavBarExitDuration() { Loading Loading @@ -171,6 +174,7 @@ public class ImmersiveModeConfirmation { if ((DEBUG_SHOW_EVERY_TIME || !sConfirmed) && userSetupComplete && !mVrModeEnabled && mCanSystemBarsBeShownByUser && !navBarEmpty && !UserManager.isDeviceInDemoMode(mContext) && (mLockTaskState != LOCK_TASK_MODE_LOCKED)) { Loading