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

Commit 734edc15 authored by d34d's avatar d34d Committed by Gerrit Code Review
Browse files

Lls: Use LlsController for checking LLS focus

We're trying to keep track of this state in too many places.  The
LiveLockScreenController keeps track of the LLS focus so this patch
adds a method to get the state of the LLS focus and use that instead
of cached values that may not be in sync.

Change-Id: I2cbf1122b8a27cb1b0ee1ed93379a362308db5bd
TICKET: CYNGNOS-2849
parent 7ace8287
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -258,7 +258,6 @@ public class NotificationPanelView extends PanelView implements
    private SwipeLockedDirection mLockedDirection;

    private SwipeHelper mSwipeHelper;
    public boolean mShowingExternalKeyguard;
    private final int mMinimumFlingVelocity;
    private final int mScreenHeight;
    private LiveLockScreenController mLiveLockscreenController;
@@ -292,7 +291,6 @@ public class NotificationPanelView extends PanelView implements

        @Override
        public void onChildDismissed(View v) {
            mShowingExternalKeyguard = true;
            mCanDismissKeyguard = false;
            mStatusBar.focusKeyguardExternalView();
            mLiveLockscreenController.onLiveLockScreenFocusChanged(true /* hasFocus */);
@@ -359,7 +357,6 @@ public class NotificationPanelView extends PanelView implements
                    return false;
                }
                mCanDismissKeyguard = true;
                mShowingExternalKeyguard = false;
                mStatusBar.showBouncer();
                return true;
            }
@@ -448,7 +445,7 @@ public class NotificationPanelView extends PanelView implements
            @Override
            public boolean onInterceptTouchEvent(MotionEvent e) {
                boolean intercept = false;
                if (mShowingExternalKeyguard) {
                if (mLiveLockscreenController.getLiveLockScreenHasFocus()) {
                    // Handles swipe up to fade/dismiss when showing
                    // live lock screen
                    intercept = mAfforanceHelper.onInterceptTouchEvent(e);
@@ -473,7 +470,7 @@ public class NotificationPanelView extends PanelView implements
                }

                boolean intercept = false;
                if (mShowingExternalKeyguard) {
                if (mLiveLockscreenController.getLiveLockScreenHasFocus()) {
                    intercept = mAfforanceHelper.onTouchEvent(e);
                    if (isCancelOrUp) {
                        mKeyguardBottomArea.expand(false);
@@ -1007,7 +1004,8 @@ public class NotificationPanelView extends PanelView implements
        }
        if ((!mIsExpanding || mHintAnimationRunning)
                && !mQsExpanded
                && (mStatusBar.getBarState() != StatusBarState.SHADE || mShowingExternalKeyguard)) {
                && (mStatusBar.getBarState() != StatusBarState.SHADE
                || mLiveLockscreenController.getLiveLockScreenHasFocus())) {
            mAfforanceHelper.onTouchEvent(event);
        }
        if (mOnlyAffordanceInThisMotion) {
@@ -1049,7 +1047,8 @@ public class NotificationPanelView extends PanelView implements
    }

    private boolean isKeyguardInteractiveAndShowing() {
        return mShowingExternalKeyguard || mStatusBar.getBarState() != StatusBarState.KEYGUARD ||
        return mLiveLockscreenController.getLiveLockScreenHasFocus() ||
                mStatusBar.getBarState() != StatusBarState.KEYGUARD ||
                !mLiveLockscreenController.isLiveLockScreenInteractive();
    }

@@ -1348,9 +1347,6 @@ public class NotificationPanelView extends PanelView implements
                statusBarState == StatusBarState.SHADE_LOCKED) {
            updateDozingVisibilities(false /* animate */);
        }
        if (statusBarState == StatusBarState.KEYGUARD) {
            mShowingExternalKeyguard = false;
        }
        resetVerticalPanelPosition();
        updateQsState();
    }
@@ -2080,7 +2076,7 @@ public class NotificationPanelView extends PanelView implements

    private void updateKeyguardBottomAreaAlpha() {
        float alpha = Math.min(getKeyguardContentsAlpha(), 1 - getQsExpansionFraction());
        if (mShowingExternalKeyguard) {
        if (mLiveLockscreenController.getLiveLockScreenHasFocus()) {
            alpha = 1f;
        }
        mKeyguardBottomArea.setAlpha(alpha);
+2 −1
Original line number Diff line number Diff line
@@ -4789,7 +4789,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
    }

    public void onTrackingStopped(boolean expand) {
        if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED || mStatusBarWindowManager.keyguardExternalViewHasFocus()) {
        if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED ||
                mLiveLockScreenController.getLiveLockScreenHasFocus()) {
            if (!expand && (!mUnlockMethodCache.canSkipBouncer() ||
                    mLiveLockScreenController.isShowingLiveLockScreenView())) {
                showBouncer();
+5 −1
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ public class LiveLockScreenController {

        @Override
        public void slideLockscreenIn() {
            if (mPanelView.mShowingExternalKeyguard) {
            if (mLlsHasFocus) {
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
@@ -262,6 +262,10 @@ public class LiveLockScreenController {
        mBar.getScrimController().forceHideScrims(false);
    }

    public boolean getLiveLockScreenHasFocus() {
        return mLlsHasFocus;
    }

    private Runnable mAddNewLiveLockScreenRunnable = new Runnable() {
        @Override
        public void run() {