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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user