summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2013-03-11 10:16:47 -0400
committerJohn Spurlock <jspurlock@google.com>2013-04-16 11:03:40 -0400
commit32beb2c6b1ed87e122973d2c30d990cfe90514b5 (patch)
treeb9b5bdc299cb34ee6e7091107a4d8edfd7c13f59 /policy
parent9c3b3aec40f62d3685f56135ef9b09f9758b7cc6 (diff)
downloadframeworks_base-32beb2c6b1ed87e122973d2c30d990cfe90514b5.zip
frameworks_base-32beb2c6b1ed87e122973d2c30d990cfe90514b5.tar.gz
frameworks_base-32beb2c6b1ed87e122973d2c30d990cfe90514b5.tar.bz2
Hideybars part I - Overlay status bar via an intent.
Implement new mode for status bar, allowing it to overlay windows that use WM.LP.FLAG_FULLSCREEN, and introduce transparency. No gesture is implemented yet, for now the auto-hiding status bar can be shown using a debugging intent. android.intent.action.HIDEYBARS The auto-hiding status bar hides 3 seconds after shown, or 3 seconds after last user-interaction with the shade. Change-Id: Ie4bd625b9cbcddea8f818154719c7a6075972f2a
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java72
1 files changed, 69 insertions, 3 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 9283243..2988727 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -146,6 +146,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
static public final String SYSTEM_DIALOG_REASON_HOME_KEY = "homekey";
static public final String SYSTEM_DIALOG_REASON_ASSIST = "assist";
+ static public final String ACTION_HIDEYBARS = "android.intent.action.HIDEYBARS";
+
/**
* These are the system UI flags that, when changing, can cause the layout
* of the screen to change.
@@ -544,6 +546,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
MyOrientationListener mOrientationListener;
+ private static final int HIDEYBARS_NONE = 0;
+ private static final int HIDEYBARS_SHOWING = 1;
+ private static final int HIDEYBARS_HIDING = 2;
+ private int mHideybars;
+
+ BroadcastReceiver mHideybarsReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ receivedHideybars(intent.getAction());
+ }
+ };
+
IStatusBarService getStatusBarService() {
synchronized (mServiceAquireLock) {
if (mStatusBarService == null) {
@@ -892,6 +906,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
filter = new IntentFilter(Intent.ACTION_USER_SWITCHED);
context.registerReceiver(mMultiuserReceiver, filter);
+ // register for hideybars
+ filter = new IntentFilter();
+ filter.addAction(ACTION_HIDEYBARS);
+ context.registerReceiver(mHideybarsReceiver, filter);
+
mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
mLongPressVibePattern = getLongIntArray(mContext.getResources(),
com.android.internal.R.array.config_longPressVibePattern);
@@ -2480,6 +2499,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
@Override
public int adjustSystemUiVisibilityLw(int visibility) {
+ if (mHideybars == HIDEYBARS_SHOWING && 0 == (visibility & View.STATUS_BAR_OVERLAY)) {
+ mHideybars = HIDEYBARS_HIDING;
+ mStatusBar.hideLw(true);
+ }
// Reset any bits in mForceClearingStatusBarVisibility that
// are now clear.
mResettingSystemUiFlags &= visibility;
@@ -2715,9 +2738,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// For layout, the status bar is always at the top with our fixed height.
mStableTop = mUnrestrictedScreenTop + mStatusBarHeight;
+ boolean statusBarOverlay = (mLastSystemUiFlags & View.STATUS_BAR_OVERLAY) != 0;
+
// If the status bar is hidden, we don't want to cause
// windows behind it to scroll.
- if (mStatusBar.isVisibleLw()) {
+ if (mStatusBar.isVisibleLw() && !statusBarOverlay) {
// Status bar may go away, so the screen area it occupies
// is available to apps but just covering them when the
// status bar is visible.
@@ -2735,12 +2760,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mContentLeft, mContentTop, mContentRight, mContentBottom,
mCurLeft, mCurTop, mCurRight, mCurBottom));
}
- if (mStatusBar.isVisibleLw() && !mStatusBar.isAnimatingLw()) {
+ if (mStatusBar.isVisibleLw() && !mStatusBar.isAnimatingLw() && !statusBarOverlay) {
// If the status bar is currently requested to be visible,
// and not in the process of animating on or off, then
// we can tell the app that it is covered by it.
mSystemTop = mUnrestrictedScreenTop + mStatusBarHeight;
}
+ if (mHideybars == HIDEYBARS_HIDING && !mStatusBar.isVisibleLw()) {
+ // Hideybars have finished animating out, cleanup and reset alpha
+ mHideybars = HIDEYBARS_NONE;
+ updateSystemUiVisibilityLw();
+ }
}
}
}
@@ -3320,7 +3350,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// and mTopIsFullscreen is that that mTopIsFullscreen is set only if the window
// has the FLAG_FULLSCREEN set. Not sure if there is another way that to be the
// case though.
- if (topIsFullscreen) {
+ if (mHideybars == HIDEYBARS_SHOWING) {
+ if (mStatusBar.showLw(true)) {
+ changes |= FINISH_LAYOUT_REDO_LAYOUT;
+ }
+ } else if (topIsFullscreen) {
if (DEBUG_LAYOUT) Log.v(TAG, "** HIDING status bar");
if (mStatusBar.hideLw(true)) {
changes |= FINISH_LAYOUT_REDO_LAYOUT;
@@ -4060,6 +4094,23 @@ public class PhoneWindowManager implements WindowManagerPolicy {
}
};
+ private void receivedHideybars(String action) {
+ synchronized(mLock) {
+ if (action.equals(ACTION_HIDEYBARS)) {
+ if (mHideybars == HIDEYBARS_SHOWING) {
+ if (DEBUG) Slog.d(TAG, "Not showing hideybars, already shown");
+ return;
+ }
+ if (mStatusBar.isDisplayedLw()) {
+ if (DEBUG) Slog.d(TAG, "Not showing hideybars, status bar already visible");
+ return;
+ }
+ mHideybars = HIDEYBARS_SHOWING;
+ updateSystemUiVisibilityLw();
+ }
+ }
+ }
+
@Override
public void screenTurnedOff(int why) {
EventLog.writeEvent(70000, 0);
@@ -4794,12 +4845,27 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// will quickly lose focus once it correctly gets hidden.
return 0;
}
+
int tmpVisibility = mFocusedWindow.getSystemUiVisibility()
& ~mResettingSystemUiFlags
& ~mForceClearedSystemUiFlags;
if (mForcingShowNavBar && mFocusedWindow.getSurfaceLayer() < mForcingShowNavBarLayer) {
tmpVisibility &= ~View.SYSTEM_UI_CLEARABLE_FLAGS;
}
+
+ boolean hideybarsAllowed =
+ (mFocusedWindow.getAttrs().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0
+ || mFocusedWindow.getAttrs().type == TYPE_STATUS_BAR;
+ if (mHideybars == HIDEYBARS_SHOWING) {
+ if (!hideybarsAllowed) {
+ mHideybars = HIDEYBARS_NONE;
+ } else {
+ tmpVisibility |= View.STATUS_BAR_OVERLAY;
+ if ((mLastSystemUiFlags & View.STATUS_BAR_OVERLAY) == 0) {
+ mStatusBar.showLw(true);
+ }
+ }
+ }
final int visibility = tmpVisibility;
int diff = visibility ^ mLastSystemUiFlags;
final boolean needsMenu = mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);