summaryrefslogtreecommitdiffstats
path: root/policy/src
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2013-10-12 17:50:42 -0400
committerJohn Spurlock <jspurlock@google.com>2013-10-14 13:11:21 -0400
commitf1a36648ca099d7ffa8a19e403673820d4b8417a (patch)
treefa729e97bfa743f2bdceba92a57c373067e42502 /policy/src
parent69f49434ec7240b3b1195b41348ddedba1bd1e98 (diff)
downloadframeworks_base-f1a36648ca099d7ffa8a19e403673820d4b8417a.zip
frameworks_base-f1a36648ca099d7ffa8a19e403673820d4b8417a.tar.gz
frameworks_base-f1a36648ca099d7ffa8a19e403673820d4b8417a.tar.bz2
Implement new SYSTEM_UI_FLAG_IMMERSIVE_STICKY.
Migrate transient bar mode to IMMERSIVE_STICKY, and introduce new behavior for IMMERSIVE: namely the opaque bars are revealed by clearing the flags on swipe. Remove low-profile optimization that confuses api demos and other apps using low-profile as a signal. TransientNavigationConfirmation renamed to ImmersiveModeConfirmation, and its associated resources, since the confirmation is now shown when the nav bar is shown in either of the two immersive modes. Remove unused Toast.makeBar and associated hidden framework bits now that the confirmation uses a cling instead. Bug:11062108 Change-Id: Iae49d31973940b9bee9f5b1827756db5eaa76aa3
Diffstat (limited to 'policy/src')
-rw-r--r--policy/src/com/android/internal/policy/impl/ImmersiveModeConfirmation.java (renamed from policy/src/com/android/internal/policy/impl/TransientNavigationConfirmation.java)39
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java78
2 files changed, 65 insertions, 52 deletions
diff --git a/policy/src/com/android/internal/policy/impl/TransientNavigationConfirmation.java b/policy/src/com/android/internal/policy/impl/ImmersiveModeConfirmation.java
index 3c7902c..dfdcdad5 100644
--- a/policy/src/com/android/internal/policy/impl/TransientNavigationConfirmation.java
+++ b/policy/src/com/android/internal/policy/impl/ImmersiveModeConfirmation.java
@@ -49,11 +49,11 @@ import com.android.internal.R;
import java.util.Arrays;
/**
- * Helper to manage showing/hiding a confirmation prompt when the transient navigation bar
- * is hidden.
+ * Helper to manage showing/hiding a confirmation prompt when the navigation bar is hidden
+ * entering immersive mode.
*/
-public class TransientNavigationConfirmation {
- private static final String TAG = "TransientNavigationConfirmation";
+public class ImmersiveModeConfirmation {
+ private static final String TAG = "ImmersiveModeConfirmation";
private static final boolean DEBUG = false;
private static final boolean DEBUG_SHOW_EVERY_TIME = false; // super annoying, use with caution
@@ -70,12 +70,12 @@ public class TransientNavigationConfirmation {
private String mPanicPackage;
private WindowManager mWindowManager;
- public TransientNavigationConfirmation(Context context) {
+ public ImmersiveModeConfirmation(Context context) {
mContext = context;
mHandler = new H();
mShowDelayMs = getNavBarExitDuration() * 3;
mPanicThresholdMs = context.getResources()
- .getInteger(R.integer.config_transient_navigation_confirmation_panic);
+ .getInteger(R.integer.config_immersive_mode_confirmation_panic);
mWindowManager = (WindowManager)
mContext.getSystemService(Context.WINDOW_SERVICE);
}
@@ -91,7 +91,7 @@ public class TransientNavigationConfirmation {
String packages = null;
try {
packages = Settings.Secure.getStringForUser(mContext.getContentResolver(),
- Settings.Secure.TRANSIENT_NAV_CONFIRMATIONS,
+ Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS,
UserHandle.USER_CURRENT);
if (packages != null) {
mConfirmedPackages.addAll(Arrays.asList(packages.split(",")));
@@ -107,7 +107,7 @@ public class TransientNavigationConfirmation {
try {
final String packages = TextUtils.join(",", mConfirmedPackages);
Settings.Secure.putStringForUser(mContext.getContentResolver(),
- Settings.Secure.TRANSIENT_NAV_CONFIRMATIONS,
+ Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS,
packages,
UserHandle.USER_CURRENT);
if (DEBUG) Slog.d(TAG, "Saved packages=" + packages);
@@ -116,12 +116,12 @@ public class TransientNavigationConfirmation {
}
}
- public void transientNavigationChanged(String pkg, boolean isNavTransient) {
+ public void immersiveModeChanged(String pkg, boolean isImmersiveMode) {
if (pkg == null) {
return;
}
mHandler.removeMessages(H.SHOW);
- if (isNavTransient) {
+ if (isImmersiveMode) {
mLastPackage = pkg;
if (DEBUG_SHOW_EVERY_TIME || !mConfirmedPackages.contains(pkg)) {
mHandler.sendMessageDelayed(mHandler.obtainMessage(H.SHOW, pkg), mShowDelayMs);
@@ -132,13 +132,13 @@ public class TransientNavigationConfirmation {
}
}
- public void onPowerKeyDown(boolean isScreenOn, long time, boolean transientNavigationAllowed) {
+ public void onPowerKeyDown(boolean isScreenOn, long time, boolean inImmersiveMode) {
if (mPanicPackage != null && !isScreenOn && (time - mPanicTime < mPanicThresholdMs)) {
// turning the screen back on within the panic threshold
unconfirmPackage(mPanicPackage);
}
- if (isScreenOn && transientNavigationAllowed) {
- // turning the screen off, remember if we were hiding the transient nav
+ if (isScreenOn && inImmersiveMode) {
+ // turning the screen off, remember if we were in immersive mode
mPanicTime = time;
mPanicPackage = mLastPackage;
} else {
@@ -153,7 +153,7 @@ public class TransientNavigationConfirmation {
private void unconfirmPackage(String pkg) {
if (pkg != null) {
- if (DEBUG) Slog.d(TAG, "Unconfirming transient navigation for " + pkg);
+ if (DEBUG) Slog.d(TAG, "Unconfirming immersive mode confirmation for " + pkg);
mConfirmedPackages.remove(pkg);
saveSetting();
}
@@ -161,8 +161,7 @@ public class TransientNavigationConfirmation {
private void handleHide() {
if (mClingWindow != null) {
- if (DEBUG) Slog.d(TAG,
- "Hiding transient navigation confirmation for " + mPromptPackage);
+ if (DEBUG) Slog.d(TAG, "Hiding immersive mode confirmation for " + mPromptPackage);
mWindowManager.removeView(mClingWindow);
mClingWindow = null;
}
@@ -179,7 +178,7 @@ public class TransientNavigationConfirmation {
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
,
PixelFormat.TRANSLUCENT);
- lp.setTitle("TransientNavigationConfirmation");
+ lp.setTitle("ImmersiveModeConfirmation");
lp.windowAnimations = com.android.internal.R.style.Animation_RecentApplications;
lp.gravity = Gravity.FILL;
return lp;
@@ -230,7 +229,7 @@ public class TransientNavigationConfirmation {
// create the confirmation cling
mClingLayout = (ViewGroup)
- View.inflate(getContext(), R.layout.transient_navigation_cling, null);
+ View.inflate(getContext(), R.layout.immersive_mode_cling, null);
final Button ok = (Button) mClingLayout.findViewById(R.id.ok);
ok.setOnClickListener(new OnClickListener() {
@@ -292,7 +291,7 @@ public class TransientNavigationConfirmation {
private void handleShow(String pkg) {
mPromptPackage = pkg;
- if (DEBUG) Slog.d(TAG, "Showing transient navigation confirmation for " + pkg);
+ if (DEBUG) Slog.d(TAG, "Showing immersive mode confirmation for " + pkg);
mClingWindow = new ClingWindowView(mContext, confirmAction(pkg));
@@ -311,7 +310,7 @@ public class TransientNavigationConfirmation {
@Override
public void run() {
if (pkg != null && !mConfirmedPackages.contains(pkg)) {
- if (DEBUG) Slog.d(TAG, "Confirming transient navigation for " + pkg);
+ if (DEBUG) Slog.d(TAG, "Confirming immersive mode for " + pkg);
mConfirmedPackages.add(pkg);
saveSetting();
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 6dcaddc..5ac3ed0 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -532,7 +532,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
Settings.Secure.DEFAULT_INPUT_METHOD), false, this,
UserHandle.USER_ALL);
resolver.registerContentObserver(Settings.System.getUriFor(
- Settings.Secure.TRANSIENT_NAV_CONFIRMATIONS), false, this,
+ Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS), false, this,
UserHandle.USER_ALL);
updateSettings();
}
@@ -570,7 +570,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
StatusBarManager.WINDOW_NAVIGATION_BAR,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
- private TransientNavigationConfirmation mTransientNavigationConfirmation;
+ private ImmersiveModeConfirmation mImmersiveModeConfirmation;
private SystemGesturesPointerEventListener mSystemGestures;
@@ -953,7 +953,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// no-op
}
});
- mTransientNavigationConfirmation = new TransientNavigationConfirmation(mContext);
+ mImmersiveModeConfirmation = new ImmersiveModeConfirmation(mContext);
mWindowManagerFuncs.registerPointerEventListener(mSystemGestures);
mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
@@ -1169,8 +1169,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mHasSoftInput = hasSoftInput;
updateRotation = true;
}
- if (mTransientNavigationConfirmation != null) {
- mTransientNavigationConfirmation.loadSetting();
+ if (mImmersiveModeConfirmation != null) {
+ mImmersiveModeConfirmation.loadSetting();
}
}
if (updateRotation) {
@@ -2699,15 +2699,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
final int sysui = mLastSystemUiFlags;
boolean navVisible = (sysui & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
boolean navTranslucent = (sysui & View.NAVIGATION_BAR_TRANSLUCENT) != 0;
- boolean transientAllowed = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0;
- navTranslucent &= !transientAllowed; // transient trumps translucent
+ boolean immersive = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0;
+ boolean immersiveSticky = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0;
+ boolean navAllowedHidden = immersive || immersiveSticky;
+ navTranslucent &= !immersiveSticky; // transient trumps translucent
navTranslucent &= isTranslucentNavigationAllowed();
// When the navigation bar isn't visible, we put up a fake
// input window to catch all touch events. This way we can
// detect when the user presses anywhere to bring back the nav
// bar and ensure the application doesn't see the event.
- if (navVisible || transientAllowed) {
+ if (navVisible || navAllowedHidden) {
if (mHideNavFakeWindow != null) {
mHideNavFakeWindow.dismiss();
mHideNavFakeWindow = null;
@@ -3945,8 +3947,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
case KeyEvent.KEYCODE_POWER: {
result &= ~ACTION_PASS_TO_USER;
if (down) {
- mTransientNavigationConfirmation.onPowerKeyDown(isScreenOn, event.getDownTime(),
- isTransientNavigationAllowed(mLastSystemUiFlags));
+ mImmersiveModeConfirmation.onPowerKeyDown(isScreenOn, event.getDownTime(),
+ isImmersiveMode(mLastSystemUiFlags));
if (isScreenOn && !mPowerKeyTriggered
&& (event.getFlags() & KeyEvent.FLAG_FALLBACK) == 0) {
mPowerKeyTriggered = true;
@@ -4225,7 +4227,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
if (sb) mStatusBarController.showTransient();
if (nb) mNavigationBarController.showTransient();
- mTransientNavigationConfirmation.confirmCurrentPrompt();
+ mImmersiveModeConfirmation.confirmCurrentPrompt();
updateSystemUiVisibilityLw();
}
}
@@ -5108,6 +5110,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
int flags = View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE
+ | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.STATUS_BAR_TRANSLUCENT
| View.NAVIGATION_BAR_TRANSLUCENT;
vis = (vis & ~flags) | (oldVis & flags);
@@ -5118,53 +5121,64 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
// update status bar
- boolean transientAllowed =
- (vis & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0;
+ boolean immersiveSticky =
+ (vis & View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0;
boolean hideStatusBarWM =
mTopFullscreenOpaqueWindowState != null &&
(mTopFullscreenOpaqueWindowState.getAttrs().flags
& WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
boolean hideStatusBarSysui =
(vis & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0;
+ boolean hideNavBarSysui =
+ (vis & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0;
boolean transientStatusBarAllowed =
mStatusBar != null && (
hideStatusBarWM
- || (hideStatusBarSysui && transientAllowed)
+ || (hideStatusBarSysui && immersiveSticky)
|| statusBarHasFocus);
- if (mStatusBarController.isTransientShowing()
- && !transientStatusBarAllowed && hideStatusBarSysui) {
+ boolean transientNavBarAllowed =
+ mNavigationBar != null &&
+ hideNavBarSysui && immersiveSticky;
+
+ boolean denyTransientStatus = mStatusBarController.isTransientShowing()
+ && !transientStatusBarAllowed && hideStatusBarSysui;
+ boolean denyTransientNav = mNavigationBarController.isTransientShowing()
+ && !transientNavBarAllowed;
+ if (denyTransientStatus || denyTransientNav) {
// clear the clearable flags instead
- int newVal = mResettingSystemUiFlags | View.SYSTEM_UI_CLEARABLE_FLAGS;
- if (newVal != mResettingSystemUiFlags) {
- mResettingSystemUiFlags = newVal;
- mWindowManagerFuncs.reevaluateStatusBarVisibility();
- }
+ clearClearableFlagsLw();
}
vis = mStatusBarController.updateVisibilityLw(transientStatusBarAllowed, oldVis, vis);
// update navigation bar
- boolean oldTransientNav = isTransientNavigationAllowed(oldVis);
- boolean isTransientNav = isTransientNavigationAllowed(vis);
- if (win != null && oldTransientNav != isTransientNav) {
+ boolean oldImmersiveMode = isImmersiveMode(oldVis);
+ boolean newImmersiveMode = isImmersiveMode(vis);
+ if (win != null && oldImmersiveMode != newImmersiveMode) {
final String pkg = win.getOwningPackage();
- mTransientNavigationConfirmation.transientNavigationChanged(pkg, isTransientNav);
+ mImmersiveModeConfirmation.immersiveModeChanged(pkg, newImmersiveMode);
}
- vis = mNavigationBarController.updateVisibilityLw(isTransientNav, oldVis, vis);
- // don't send low profile updates if the system bars are hidden
- if (mStatusBarController.isHidden() && mNavigationBarController.isHidden()) {
- vis &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE;
- }
+ vis = mNavigationBarController.updateVisibilityLw(transientNavBarAllowed, oldVis, vis);
+
return vis;
}
- private boolean isTransientNavigationAllowed(int vis) {
+ private void clearClearableFlagsLw() {
+ int newVal = mResettingSystemUiFlags | View.SYSTEM_UI_CLEARABLE_FLAGS;
+ if (newVal != mResettingSystemUiFlags) {
+ mResettingSystemUiFlags = newVal;
+ mWindowManagerFuncs.reevaluateStatusBarVisibility();
+ }
+ }
+
+ private boolean isImmersiveMode(int vis) {
+ final int flags = View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
return mNavigationBar != null
&& (vis & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0
- && (vis & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0;
+ && (vis & flags) != 0;
}
/**