summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author John Spurlock <jspurlock@google.com> 2012-10-19 11:09:32 -0400
committer John Spurlock <jspurlock@google.com> 2012-10-22 17:10:25 -0400
commit1bbd49d72eee001137b6d6e6ab3f353fe2c0433c (patch)
treed46a3d848c2d63c15aa08b04e797c247eb8ff9b5
parent23d622418b5c67dc43faabd930d1c59c5ce34f6a (diff)
Fix nav bar glitch when quickly turning screen off then on.
Keyguard now disables all navbar buttons when turning screen off instead of only recents. Navbar is told about screen off/on and disables the layout transition animation on screen off - if the user quickly turns the screen back on they do not see the end of the fade out animation. Bug:7377776 Change-Id: I96a050d58c6c9ce8537f50408655006fadbfcd4f
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java18
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java7
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java7
3 files changed, 32 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 770ae6db4736..eef54460d8af 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
+import android.animation.LayoutTransition;
import android.app.StatusBarManager;
import android.content.Context;
import android.content.res.Resources;
@@ -34,6 +35,7 @@ import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
import android.view.Surface;
+import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -62,6 +64,7 @@ public class NavigationBarView extends LinearLayout {
int mBarSize;
boolean mVertical;
+ boolean mScreenOn;
boolean mHidden, mLowProfile, mShowMenu;
int mDisabledFlags = 0;
@@ -169,6 +172,11 @@ public class NavigationBarView extends LinearLayout {
mBackAltLandIcon = res.getDrawable(R.drawable.ic_sysbar_back_ime);
}
+ public void notifyScreenOn(boolean screenOn) {
+ mScreenOn = screenOn;
+ setDisabledFlags(mDisabledFlags, true);
+ }
+
View.OnTouchListener mLightsOutListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent ev) {
@@ -231,6 +239,16 @@ public class NavigationBarView extends LinearLayout {
setSlippery(disableHome && disableRecent && disableBack);
+ if (!mScreenOn && mCurrentView != null) {
+ ViewGroup navButtons = (ViewGroup) mCurrentView.findViewById(R.id.nav_buttons);
+ LayoutTransition lt = navButtons == null ? null : navButtons.getLayoutTransition();
+ if (lt != null) {
+ lt.disableTransitionType(
+ LayoutTransition.CHANGE_APPEARING | LayoutTransition.CHANGE_DISAPPEARING |
+ LayoutTransition.APPEARING | LayoutTransition.DISAPPEARING);
+ }
+ }
+
getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index f906176650e7..1e0ab1bb3d45 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -783,6 +783,11 @@ public class PhoneStatusBar extends BaseStatusBar {
mWindowManager.updateViewLayout(mNavigationBarView, getNavigationBarLayoutParams());
}
+ private void notifyNavigationBarScreenOn(boolean screenOn) {
+ if (mNavigationBarView == null) return;
+ mNavigationBarView.notifyScreenOn(screenOn);
+ }
+
private WindowManager.LayoutParams getNavigationBarLayoutParams() {
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
@@ -2256,6 +2261,7 @@ public class PhoneStatusBar extends BaseStatusBar {
else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
// no waiting!
makeExpandedInvisible();
+ notifyNavigationBarScreenOn(false);
}
else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
if (DEBUG) {
@@ -2271,6 +2277,7 @@ public class PhoneStatusBar extends BaseStatusBar {
else if (Intent.ACTION_SCREEN_ON.equals(action)) {
// work around problem where mDisplay.getRotation() is not stable while screen is off (bug 7086018)
repositionNavigationBar();
+ notifyNavigationBarScreenOn(true);
}
}
};
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
index ceb032559c57..cb70922e01ba 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
@@ -1306,6 +1306,13 @@ public class KeyguardViewMediator {
// (like recents). Temporary enable/disable (e.g. the "back" button) are
// done in KeyguardHostView.
flags |= StatusBarManager.DISABLE_RECENT;
+ if (!mScreenOn) {
+ // Disable all navbar buttons on screen off. The navigation bar will hide
+ // these immediately to avoid seeing the end of layout transition animations
+ // if quickly turning back on.
+ flags |= StatusBarManager.DISABLE_HOME;
+ flags |= StatusBarManager.DISABLE_BACK;
+ }
if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
// showing secure lockscreen; disable expanding.
flags |= StatusBarManager.DISABLE_EXPAND;