Merge "Fix nav bar glitch when quickly turning screen off then on." into jb-mr1-dev

This commit is contained in:
John Spurlock
2012-10-23 04:10:28 -07:00
committed by Android (Google) Code Review
3 changed files with 32 additions and 0 deletions

View File

@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.phone;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
import android.animation.LayoutTransition;
import android.app.StatusBarManager; import android.app.StatusBarManager;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
@@ -34,6 +35,7 @@ import android.view.Display;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.Surface; import android.view.Surface;
import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@@ -62,6 +64,7 @@ public class NavigationBarView extends LinearLayout {
int mBarSize; int mBarSize;
boolean mVertical; boolean mVertical;
boolean mScreenOn;
boolean mHidden, mLowProfile, mShowMenu; boolean mHidden, mLowProfile, mShowMenu;
int mDisabledFlags = 0; int mDisabledFlags = 0;
@@ -169,6 +172,11 @@ public class NavigationBarView extends LinearLayout {
mBackAltLandIcon = res.getDrawable(R.drawable.ic_sysbar_back_ime); 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() { View.OnTouchListener mLightsOutListener = new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent ev) { public boolean onTouch(View v, MotionEvent ev) {
@@ -231,6 +239,16 @@ public class NavigationBarView extends LinearLayout {
setSlippery(disableHome && disableRecent && disableBack); 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); getBackButton() .setVisibility(disableBack ? View.INVISIBLE : View.VISIBLE);
getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE); getHomeButton() .setVisibility(disableHome ? View.INVISIBLE : View.VISIBLE);
getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE); getRecentsButton().setVisibility(disableRecent ? View.INVISIBLE : View.VISIBLE);

View File

@@ -783,6 +783,11 @@ public class PhoneStatusBar extends BaseStatusBar {
mWindowManager.updateViewLayout(mNavigationBarView, getNavigationBarLayoutParams()); mWindowManager.updateViewLayout(mNavigationBarView, getNavigationBarLayoutParams());
} }
private void notifyNavigationBarScreenOn(boolean screenOn) {
if (mNavigationBarView == null) return;
mNavigationBarView.notifyScreenOn(screenOn);
}
private WindowManager.LayoutParams getNavigationBarLayoutParams() { private WindowManager.LayoutParams getNavigationBarLayoutParams() {
WindowManager.LayoutParams lp = new WindowManager.LayoutParams( WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT,
@@ -2256,6 +2261,7 @@ public class PhoneStatusBar extends BaseStatusBar {
else if (Intent.ACTION_SCREEN_OFF.equals(action)) { else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
// no waiting! // no waiting!
makeExpandedInvisible(); makeExpandedInvisible();
notifyNavigationBarScreenOn(false);
} }
else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) { else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
if (DEBUG) { if (DEBUG) {
@@ -2271,6 +2277,7 @@ public class PhoneStatusBar extends BaseStatusBar {
else if (Intent.ACTION_SCREEN_ON.equals(action)) { else if (Intent.ACTION_SCREEN_ON.equals(action)) {
// work around problem where mDisplay.getRotation() is not stable while screen is off (bug 7086018) // work around problem where mDisplay.getRotation() is not stable while screen is off (bug 7086018)
repositionNavigationBar(); repositionNavigationBar();
notifyNavigationBarScreenOn(true);
} }
} }
}; };

View File

@@ -1306,6 +1306,13 @@ public class KeyguardViewMediator {
// (like recents). Temporary enable/disable (e.g. the "back" button) are // (like recents). Temporary enable/disable (e.g. the "back" button) are
// done in KeyguardHostView. // done in KeyguardHostView.
flags |= StatusBarManager.DISABLE_RECENT; 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) { if (isSecure() || !ENABLE_INSECURE_STATUS_BAR_EXPAND) {
// showing secure lockscreen; disable expanding. // showing secure lockscreen; disable expanding.
flags |= StatusBarManager.DISABLE_EXPAND; flags |= StatusBarManager.DISABLE_EXPAND;