From 99c6e072aa6681b581a4c2308d7cd4a72948e27c Mon Sep 17 00:00:00 2001 From: Maurice Lam Date: Mon, 28 Apr 2014 18:24:28 -0700 Subject: Disable swipe-to-reveal nav bar / status bar during setup Make the system refuse to show system navigation bar when immersive mode is on before finishing setup. Change-Id: Id6383e13bdb7e4c4b93b2fbaf83c154c387af694 --- .../internal/policy/impl/ImmersiveModeConfirmation.java | 5 +++-- .../com/android/internal/policy/impl/PhoneWindowManager.java | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'policy') diff --git a/policy/src/com/android/internal/policy/impl/ImmersiveModeConfirmation.java b/policy/src/com/android/internal/policy/impl/ImmersiveModeConfirmation.java index 5602206..a4c2ddd 100644 --- a/policy/src/com/android/internal/policy/impl/ImmersiveModeConfirmation.java +++ b/policy/src/com/android/internal/policy/impl/ImmersiveModeConfirmation.java @@ -115,13 +115,14 @@ public class ImmersiveModeConfirmation { } } - public void immersiveModeChanged(String pkg, boolean isImmersiveMode) { + public void immersiveModeChanged(String pkg, boolean isImmersiveMode, + boolean userSetupComplete) { mHandler.removeMessages(H.SHOW); if (isImmersiveMode) { final boolean disabled = PolicyControl.disableImmersiveConfirmation(pkg); if (DEBUG) Slog.d(TAG, String.format("immersiveModeChanged() disabled=%s mConfirmed=%s", disabled, mConfirmed)); - if (!disabled && (DEBUG_SHOW_EVERY_TIME || !mConfirmed)) { + if (!disabled && (DEBUG_SHOW_EVERY_TIME || !mConfirmed) && userSetupComplete) { mHandler.sendEmptyMessageDelayed(H.SHOW, mShowDelayMs); } } else { diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 6390a69..d0305e0 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -775,6 +775,11 @@ public class PhoneWindowManager implements WindowManagerPolicy { mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; } + boolean isUserSetupComplete() { + return Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0; + } + private void handleLongPressOnHome() { if (mLongPressOnHomeBehavior != LONG_PRESS_HOME_NOTHING) { mHomeConsumed = true; @@ -4294,6 +4299,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { private void requestTransientBars(WindowState swipeTarget) { synchronized (mWindowManagerFuncs.getWindowManagerLock()) { + if (!isUserSetupComplete()) { + // Swipe-up for navigation bar is disabled during setup + return; + } boolean sb = mStatusBarController.checkShowTransientBarLw(); boolean nb = mNavigationBarController.checkShowTransientBarLw(); if (sb || nb) { @@ -5270,7 +5279,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean newImmersiveMode = isImmersiveMode(vis); if (win != null && oldImmersiveMode != newImmersiveMode) { final String pkg = win.getOwningPackage(); - mImmersiveModeConfirmation.immersiveModeChanged(pkg, newImmersiveMode); + mImmersiveModeConfirmation.immersiveModeChanged(pkg, newImmersiveMode, + isUserSetupComplete()); } vis = mNavigationBarController.updateVisibilityLw(transientNavBarAllowed, oldVis, vis); -- cgit v1.1