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

Commit 5d777977 authored by Peter Kalauskas's avatar Peter Kalauskas Committed by Automerger Merge Worker
Browse files

Merge "Fix doze bug in keyguard user switcher" into sc-dev am: e7283b94

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13758547

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib8edc4747ea9fa5fdba972d0c3f64fe64d94c443
parents a66feaa0 e7283b94
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -405,14 +405,19 @@ public class KeyguardSliceView extends LinearLayout {
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        }
        }


        /**
         * Set the amount (ratio) that the device has transitioned to doze.
         *
         * @param darkAmount Amount of transition to doze: 1f for doze and 0f for awake.
         */
        public void setDarkAmount(float darkAmount) {
        public void setDarkAmount(float darkAmount) {
            boolean isAwake = darkAmount != 0;
            boolean isDozing = darkAmount != 0;
            boolean wasAwake = mDarkAmount != 0;
            boolean wasDozing = mDarkAmount != 0;
            if (isAwake == wasAwake) {
            if (isDozing == wasDozing) {
                return;
                return;
            }
            }
            mDarkAmount = darkAmount;
            mDarkAmount = darkAmount;
            setLayoutAnimationListener(isAwake ? null : mKeepAwakeListener);
            setLayoutAnimationListener(isDozing ? null : mKeepAwakeListener);
        }
        }


        @Override
        @Override
+0 −23
Original line number Original line Diff line number Diff line
@@ -94,15 +94,6 @@ public class KeyguardQsUserSwitchController extends ViewController<UserAvatarVie
                            goingToFullShade,
                            goingToFullShade,
                            oldState);
                            oldState);
                }
                }

                @Override
                public void onDozeAmountChanged(float linearAmount, float amount) {
                    if (DEBUG) {
                        Log.d(TAG, String.format("onDozeAmountChanged: linearAmount=%f amount=%f",
                                linearAmount, amount));
                    }
                    setDarkAmount(amount);
                }
            };
            };


    @Inject
    @Inject
@@ -294,20 +285,6 @@ public class KeyguardQsUserSwitchController extends ViewController<UserAvatarVie
        }
        }
    }
    }


    /**
     * Set the amount (ratio) that the device has transitioned to doze.
     *
     * @param darkAmount Amount of transition to doze: 1f for doze and 0f for awake.
     */
    private void setDarkAmount(float darkAmount) {
        boolean isAwake = darkAmount != 0;
        if (darkAmount == mDarkAmount) {
            return;
        }
        mDarkAmount = darkAmount;
        mView.setVisibility(isAwake ? View.VISIBLE : View.GONE);
    }

    private boolean isListAnimating() {
    private boolean isListAnimating() {
        return mKeyguardVisibilityHelper.isVisibilityAnimating();
        return mKeyguardVisibilityHelper.isVisibilityAnimating();
    }
    }
+3 −4
Original line number Original line Diff line number Diff line
@@ -205,7 +205,7 @@ public class KeyguardUserSwitcherController extends ViewController<KeyguardUserS
    protected void onViewAttached() {
    protected void onViewAttached() {
        if (DEBUG) Log.d(TAG, "onViewAttached");
        if (DEBUG) Log.d(TAG, "onViewAttached");
        mAdapter.registerDataSetObserver(mDataSetObserver);
        mAdapter.registerDataSetObserver(mDataSetObserver);
        mDataSetObserver.onChanged();
        mAdapter.notifyDataSetChanged();
        mKeyguardUpdateMonitor.registerCallback(mInfoCallback);
        mKeyguardUpdateMonitor.registerCallback(mInfoCallback);
        mStatusBarStateController.addCallback(mStatusBarStateListener);
        mStatusBarStateController.addCallback(mStatusBarStateListener);
        mScreenLifecycle.addObserver(mScreenObserver);
        mScreenLifecycle.addObserver(mScreenObserver);
@@ -373,14 +373,13 @@ public class KeyguardUserSwitcherController extends ViewController<KeyguardUserS
     * @param darkAmount Amount of transition to doze: 1f for doze and 0f for awake.
     * @param darkAmount Amount of transition to doze: 1f for doze and 0f for awake.
     */
     */
    private void setDarkAmount(float darkAmount) {
    private void setDarkAmount(float darkAmount) {
        boolean isAwake = darkAmount != 0;
        boolean isFullyDozed = darkAmount == 1;
        if (darkAmount == mDarkAmount) {
        if (darkAmount == mDarkAmount) {
            return;
            return;
        }
        }
        mDarkAmount = darkAmount;
        mDarkAmount = darkAmount;
        mListView.setDarkAmount(darkAmount);
        mListView.setDarkAmount(darkAmount);
        mView.setVisibility(isAwake ? View.VISIBLE : View.GONE);
        if (isFullyDozed) {
        if (!isAwake) {
            closeSwitcherIfOpenAndNotSimple(false);
            closeSwitcherIfOpenAndNotSimple(false);
        }
        }
    }
    }