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

Commit f3aa1c8d authored by Christoph Studer's avatar Christoph Studer Committed by Android (Google) Code Review
Browse files

Merge "SysUI: Use mScreenOnFromKeyguard for panel visibility" into lmp-mr1-dev

parents 7ed62e4e e8e2865b
Loading
Loading
Loading
Loading
+42 −18
Original line number Original line Diff line number Diff line
@@ -159,9 +159,6 @@ public abstract class BaseStatusBar extends SystemUI implements
    protected HeadsUpNotificationView mHeadsUpNotificationView;
    protected HeadsUpNotificationView mHeadsUpNotificationView;
    protected int mHeadsUpNotificationDecay;
    protected int mHeadsUpNotificationDecay;


    // used to notify status bar for suppressing notification LED
    protected boolean mPanelSlightlyVisible;

    // Search panel
    // Search panel
    protected SearchPanelView mSearchPanelView;
    protected SearchPanelView mSearchPanelView;


@@ -173,6 +170,20 @@ public abstract class BaseStatusBar extends SystemUI implements


    // on-screen navigation buttons
    // on-screen navigation buttons
    protected NavigationBarView mNavigationBarView = null;
    protected NavigationBarView mNavigationBarView = null;

    protected Boolean mScreenOn;

    // The second field is a bit different from the first one because it only listens to screen on/
    // screen of events from Keyguard. We need this so we don't have a race condition with the
    // broadcast. In the future, we should remove the first field altogether and rename the second
    // field.
    protected boolean mScreenOnFromKeyguard;

    protected boolean mVisible;

    // mScreenOnFromKeyguard && mVisible.
    private boolean mVisibleToUser;

    private Locale mLocale;
    private Locale mLocale;
    private float mFontScale;
    private float mFontScale;


@@ -1599,21 +1610,35 @@ public abstract class BaseStatusBar extends SystemUI implements
        }
        }
    }
    }


    protected void visibilityChanged(boolean visible) {
        if (mVisible != visible) {
            mVisible = visible;
            if (!visible) {
                dismissPopups();
            }
        }
        updateVisibleToUser();
    }

    protected void updateVisibleToUser() {
        boolean oldVisibleToUser = mVisibleToUser;
        mVisibleToUser = mVisible && mScreenOnFromKeyguard;

        if (oldVisibleToUser != mVisibleToUser) {
            handleVisibleToUserChanged(mVisibleToUser);
        }
    }

    /**
    /**
     * The LEDs are turned o)ff when the notification panel is shown, even just a little bit.
     * The LEDs are turned off when the notification panel is shown, even just a little bit.
     * This was added last-minute and is inconsistent with the way the rest of the notifications
     * This was added last-minute and is inconsistent with the way the rest of the notifications
     * are handled, because the notification isn't really cancelled.  The lights are just
     * are handled, because the notification isn't really cancelled.  The lights are just
     * turned off.  If any other notifications happen, the lights will turn back on.  Steve says
     * turned off.  If any other notifications happen, the lights will turn back on.  Steve says
     * this is what he wants. (see bug 1131461)
     * this is what he wants. (see bug 1131461)
     */
     */
    protected void visibilityChanged(boolean visible) {
    protected void handleVisibleToUserChanged(boolean visibleToUser) {
        if (mPanelSlightlyVisible != visible) {
            mPanelSlightlyVisible = visible;
            if (!visible) {
                dismissPopups();
            }
        try {
        try {
                if (visible) {
            if (visibleToUser) {
                mBarService.onPanelRevealed();
                mBarService.onPanelRevealed();
            } else {
            } else {
                mBarService.onPanelHidden();
                mBarService.onPanelHidden();
@@ -1622,7 +1647,6 @@ public abstract class BaseStatusBar extends SystemUI implements
            // Won't fail unless the world has ended.
            // Won't fail unless the world has ended.
        }
        }
    }
    }
    }


    /**
    /**
     * Cancel this notification and tell the StatusBarManagerService / NotificationManagerService
     * Cancel this notification and tell the StatusBarManagerService / NotificationManagerService
+16 −28
Original line number Original line Diff line number Diff line
@@ -55,7 +55,6 @@ import android.graphics.Point;
import android.graphics.PorterDuff;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.Xfermode;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.inputmethodservice.InputMethodService;
import android.inputmethodservice.InputMethodService;
@@ -98,7 +97,6 @@ import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
import android.view.WindowManagerGlobal;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.Animation;
@@ -409,13 +407,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    private boolean mAutohideSuspended;
    private boolean mAutohideSuspended;
    private int mStatusBarMode;
    private int mStatusBarMode;
    private int mNavigationBarMode;
    private int mNavigationBarMode;
    private Boolean mScreenOn;

    // The second field is a bit different from the first one because it only listens to screen on/
    // screen of events from Keyguard. We need this so we don't have a race condition with the
    // broadcast. In the future, we should remove the first field altogether and rename the second
    // field.
    private boolean mScreenOnFromKeyguard;


    private ViewMediatorCallback mKeyguardViewMediatorCallback;
    private ViewMediatorCallback mKeyguardViewMediatorCallback;
    private ScrimController mScrimController;
    private ScrimController mScrimController;
@@ -429,7 +420,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
            }
            }
        }};
        }};


    private boolean mVisible;
    private boolean mWaitingForKeyguardExit;
    private boolean mWaitingForKeyguardExit;
    private boolean mDozing;
    private boolean mDozing;
    private boolean mScrimSrcModeEnabled;
    private boolean mScrimSrcModeEnabled;
@@ -3077,7 +3067,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                notifyNavigationBarScreenOn(false);
                notifyNavigationBarScreenOn(false);
                notifyHeadsUpScreenOn(false);
                notifyHeadsUpScreenOn(false);
                finishBarAnimations();
                finishBarAnimations();
                stopNotificationLogging();
                resetUserExpandedStates();
                resetUserExpandedStates();
            }
            }
            else if (Intent.ACTION_SCREEN_ON.equals(action)) {
            else if (Intent.ACTION_SCREEN_ON.equals(action)) {
@@ -3085,7 +3074,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
                // 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);
                notifyNavigationBarScreenOn(true);
                startNotificationLoggingIfScreenOnAndVisible();
            }
            }
            else if (ACTION_DEMO.equals(action)) {
            else if (ACTION_DEMO.equals(action)) {
                Bundle bundle = intent.getExtras();
                Bundle bundle = intent.getExtras();
@@ -3274,14 +3262,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    // Visibility reporting
    // Visibility reporting


    @Override
    @Override
    protected void visibilityChanged(boolean visible) {
    protected void handleVisibleToUserChanged(boolean visibleToUser) {
        mVisible = visible;
        if (visibleToUser) {
        if (visible) {
            super.handleVisibleToUserChanged(visibleToUser);
            startNotificationLoggingIfScreenOnAndVisible();
            startNotificationLogging();
        } else {
        } else {
            stopNotificationLogging();
            stopNotificationLogging();
            super.handleVisibleToUserChanged(visibleToUser);
        }
        }
        super.visibilityChanged(visible);
    }
    }


    private void stopNotificationLogging() {
    private void stopNotificationLogging() {
@@ -3296,10 +3284,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mStackScroller.setChildLocationsChangedListener(null);
        mStackScroller.setChildLocationsChangedListener(null);
    }
    }


    private void startNotificationLoggingIfScreenOnAndVisible() {
    private void startNotificationLogging() {
        if (mVisible && mScreenOn) {
        mStackScroller.setChildLocationsChangedListener(mNotificationLocationsChangedListener);
        mStackScroller.setChildLocationsChangedListener(mNotificationLocationsChangedListener);
            // Some transitions like mScreenOn=false -> mScreenOn=true don't
        // Some transitions like mVisibleToUser=false -> mVisibleToUser=true don't
        // cause the scroller to emit child location events. Hence generate
        // cause the scroller to emit child location events. Hence generate
        // one ourselves to guarantee that we're reporting visible
        // one ourselves to guarantee that we're reporting visible
        // notifications.
        // notifications.
@@ -3307,7 +3294,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        // additional event doesn't break anything.)
        // additional event doesn't break anything.)
        mNotificationLocationsChangedListener.onChildLocationsChanged(mStackScroller);
        mNotificationLocationsChangedListener.onChildLocationsChanged(mStackScroller);
    }
    }
    }


    private void logNotificationVisibilityChanges(
    private void logNotificationVisibilityChanges(
            Collection<String> newlyVisible, Collection<String> noLongerVisible) {
            Collection<String> newlyVisible, Collection<String> noLongerVisible) {
@@ -3942,6 +3928,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mScreenOnFromKeyguard = false;
        mScreenOnFromKeyguard = false;
        mScreenOnComingFromTouch = false;
        mScreenOnComingFromTouch = false;
        mStackScroller.setAnimationsEnabled(false);
        mStackScroller.setAnimationsEnabled(false);
        updateVisibleToUser();
    }
    }


    public void onScreenTurnedOn() {
    public void onScreenTurnedOn() {
@@ -3949,6 +3936,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mStackScroller.setAnimationsEnabled(true);
        mStackScroller.setAnimationsEnabled(true);
        mNotificationPanel.onScreenTurnedOn();
        mNotificationPanel.onScreenTurnedOn();
        mNotificationPanel.setTouchDisabled(false);
        mNotificationPanel.setTouchDisabled(false);
        updateVisibleToUser();
    }
    }


    /**
    /**