Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31821c5b authored by John Spurlock's avatar John Spurlock Committed by Android Git Automerger
Browse files

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

* commit '780a13b0':
  Fix nav bar glitch when quickly turning screen off then on.
parents 5d3f8599 780a13b0
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -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);
+7 −0
Original line number Diff line number Diff line
@@ -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);
            }
        }
    };
+7 −0
Original line number Diff line number Diff line
@@ -1308,6 +1308,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;