summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2013-08-21 21:04:12 -0400
committerJohn Spurlock <jspurlock@google.com>2013-08-23 08:08:24 -0400
commitb77edbfdab54531023c8bbea7d89b6cefc42096c (patch)
tree2138c9be5d8392b167a1d288eb1526c3187bd9c2 /policy
parent9e104087978553f43fcb7767ff2ee265dbd15d2c (diff)
downloadframeworks_base-b77edbfdab54531023c8bbea7d89b6cefc42096c.zip
frameworks_base-b77edbfdab54531023c8bbea7d89b6cefc42096c.tar.gz
frameworks_base-b77edbfdab54531023c8bbea7d89b6cefc42096c.tar.bz2
Improve transparent bar transitions.
1. Migrate transparent transitions to the new optimized background color animations. 2. Ensure sysui animation transparent -> opaque has enough time to run before window manager crops off the content area. 3. Lose the individual alpha on each status bar icon if the bars are not opaque. Animate the alpha if visible, make sure they play together. 4. Documentation typo fix found in AnimatorSet. Bug:10344949 Change-Id: I615668ce3c552d3df15dbba5cdeeca67549a0220
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/BarController.java19
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java15
2 files changed, 28 insertions, 6 deletions
diff --git a/policy/src/com/android/internal/policy/impl/BarController.java b/policy/src/com/android/internal/policy/impl/BarController.java
index bcecff2..554fd1cc 100644
--- a/policy/src/com/android/internal/policy/impl/BarController.java
+++ b/policy/src/com/android/internal/policy/impl/BarController.java
@@ -20,6 +20,7 @@ import android.app.StatusBarManager;
import android.os.Handler;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.SystemClock;
import android.util.Slog;
import android.view.View;
import android.view.WindowManagerPolicy.WindowState;
@@ -38,9 +39,12 @@ public class BarController {
private static final int TRANSIENT_BAR_SHOWING = 1;
private static final int TRANSIENT_BAR_HIDING = 2;
+ private static final int TRANSPARENT_ANIMATION_DELAY_MS = 1000;
+
private final String mTag;
private final int mTransientFlag;
private final int mUnhideFlag;
+ private final int mTransparentFlag;
private final int mStatusBarManagerId;
private final Handler mHandler;
private final Object mServiceAquireLock = new Object();
@@ -50,11 +54,14 @@ public class BarController {
private int mState;
private int mTransientBarState;
private boolean mPendingShow;
+ private long mLastTransparent;
- public BarController(String tag, int transientFlag, int unhideFlag, int statusBarManagerId) {
+ public BarController(String tag, int transientFlag, int unhideFlag, int transparentFlag,
+ int statusBarManagerId) {
mTag = "BarController." + tag;
mTransientFlag = transientFlag;
mUnhideFlag = unhideFlag;
+ mTransparentFlag = transparentFlag;
mStatusBarManagerId = statusBarManagerId;
mHandler = new Handler();
}
@@ -77,6 +84,10 @@ public class BarController {
return mTransientBarState == TRANSIENT_BAR_SHOWING;
}
+ public boolean wasRecentlyTransparent() {
+ return (SystemClock.uptimeMillis() - mLastTransparent) < TRANSPARENT_ANIMATION_DELAY_MS;
+ }
+
public void adjustSystemUiVisibilityLw(int oldVis, int vis) {
if (mWin != null && mTransientBarState == TRANSIENT_BAR_SHOWING &&
(vis & mTransientFlag) == 0) {
@@ -181,11 +192,17 @@ public class BarController {
vis |= mTransientFlag; // ignore clear requests until transition completes
vis &= ~View.SYSTEM_UI_FLAG_LOW_PROFILE; // never show transient bars in low profile
}
+ if ((vis & mTransparentFlag) != 0 || (oldVis & mTransparentFlag) != 0) {
+ mLastTransparent = SystemClock.uptimeMillis();
+ }
return vis;
}
private void setTransientBarState(int state) {
if (mWin != null && state != mTransientBarState) {
+ if (mTransientBarState == TRANSIENT_BAR_SHOWING || state == TRANSIENT_BAR_SHOWING) {
+ mLastTransparent = SystemClock.uptimeMillis();
+ }
mTransientBarState = state;
if (DEBUG) Slog.d(mTag, "New state: " + transientBarStateToString(state));
}
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index f3e7f0a..da98f27 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -556,11 +556,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
private final BarController mStatusBarController = new BarController("StatusBar",
View.STATUS_BAR_TRANSIENT,
View.STATUS_BAR_UNHIDE,
+ View.SYSTEM_UI_FLAG_TRANSPARENT_STATUS,
StatusBarManager.WINDOW_STATUS_BAR);
private final BarController mNavigationBarController = new BarController("NavigationBar",
View.NAVIGATION_BAR_TRANSIENT,
View.NAVIGATION_BAR_UNHIDE,
+ View.SYSTEM_UI_FLAG_TRANSPARENT_NAVIGATION,
StatusBarManager.WINDOW_NAVIGATION_BAR);
private TransientNavigationConfirmation mTransientNavigationConfirmation;
@@ -2739,7 +2741,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// We currently want to hide the navigation UI.
mNavigationBarController.setBarShowingLw(false);
}
- if (navVisible && !navTransparent && !mNavigationBar.isAnimatingLw()) {
+ if (navVisible && !navTransparent && !mNavigationBar.isAnimatingLw()
+ && !mNavigationBarController.wasRecentlyTransparent()) {
// If the opaque nav 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.
@@ -2762,7 +2765,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
// We currently want to hide the navigation UI.
mNavigationBarController.setBarShowingLw(false);
}
- if (navVisible && !navTransparent && !mNavigationBar.isAnimatingLw()) {
+ if (navVisible && !navTransparent && !mNavigationBar.isAnimatingLw()
+ && !mNavigationBarController.wasRecentlyTransparent()) {
// If the nav 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.
@@ -2832,7 +2836,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
mCurLeft, mCurTop, mCurRight, mCurBottom));
}
if (mStatusBar.isVisibleLw() && !mStatusBar.isAnimatingLw()
- && !statusBarTransient && !statusBarTransparent) {
+ && !statusBarTransient && !statusBarTransparent
+ && !mStatusBarController.wasRecentlyTransparent()) {
// If the opaque 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.
@@ -5011,7 +5016,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
if (mForcingShowNavBar && mFocusedWindow.getSurfaceLayer() < mForcingShowNavBarLayer) {
tmpVisibility &= ~View.SYSTEM_UI_CLEARABLE_FLAGS;
}
- final int visibility = updateTransientBarsLw(mLastSystemUiFlags, tmpVisibility);
+ final int visibility = updateSystemBarsLw(mLastSystemUiFlags, tmpVisibility);
final int diff = visibility ^ mLastSystemUiFlags;
final boolean needsMenu = mFocusedWindow.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
if (diff == 0 && mLastFocusNeedsMenu == needsMenu
@@ -5039,7 +5044,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
return diff;
}
- private int updateTransientBarsLw(int oldVis, int vis) {
+ private int updateSystemBarsLw(int oldVis, int vis) {
if (ImmersiveModeTesting.enabled) {
vis = ImmersiveModeTesting.applyForced(mFocusedWindow, vis);
}