Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +14 −17 Original line number Diff line number Diff line Loading @@ -50,19 +50,22 @@ public class LockIcon extends KeyguardAffordanceView { static final int STATE_BIOMETRICS_ERROR = 3; private float mDozeAmount; private int mIconColor; private StateProvider mStateProvider; private int mOldState; private int mState; private boolean mPulsing; private boolean mDozing; private boolean mKeyguardJustShown; private boolean mPredrawRegistered; private final SparseArray<Drawable> mDrawableCache = new SparseArray<>(); private final OnPreDrawListener mOnPreDrawListener = new OnPreDrawListener() { @Override public boolean onPreDraw() { getViewTreeObserver().removeOnPreDrawListener(this); mPredrawRegistered = false; int newState = mStateProvider.getState(); int newState = mState; mOldState = mState; Drawable icon = getIcon(newState); setImageDrawable(icon, false); Loading @@ -80,7 +83,7 @@ public class LockIcon extends KeyguardAffordanceView { @Override public void onAnimationEnd(Drawable drawable) { if (getDrawable() == animation && newState == mStateProvider.getState() && newState == mState && newState == STATE_SCANNING_FACE) { animation.start(); } else { Loading @@ -100,10 +103,6 @@ public class LockIcon extends KeyguardAffordanceView { super(context, attrs); } void setStateProvider(StateProvider stateProvider) { mStateProvider = stateProvider; } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading Loading @@ -135,14 +134,17 @@ public class LockIcon extends KeyguardAffordanceView { return false; } void update(int oldState, boolean pulsing, boolean dozing, boolean keyguardJustShown) { mOldState = oldState; void update(int newState, boolean pulsing, boolean dozing, boolean keyguardJustShown) { mState = newState; mPulsing = pulsing; mDozing = dozing; mKeyguardJustShown = keyguardJustShown; if (!mPredrawRegistered) { mPredrawRegistered = true; getViewTreeObserver().addOnPreDrawListener(mOnPreDrawListener); } } void setDozeAmount(float dozeAmount) { mDozeAmount = dozeAmount; Loading Loading @@ -175,7 +177,7 @@ public class LockIcon extends KeyguardAffordanceView { return mDrawableCache.get(iconRes); } static int getIconForState(int state) { private static int getIconForState(int state) { int iconRes; switch (state) { case STATE_LOCKED: Loading @@ -196,7 +198,7 @@ public class LockIcon extends KeyguardAffordanceView { return iconRes; } static int getAnimationIndexForTransition(int oldState, int newState, boolean pulsing, private static int getAnimationIndexForTransition(int oldState, int newState, boolean pulsing, boolean dozing, boolean keyguardJustShown) { // Never animate when screen is off Loading Loading @@ -260,9 +262,4 @@ public class LockIcon extends KeyguardAffordanceView { } return LOCK_ANIM_RES_IDS[0][lockAnimIndex]; } interface StateProvider { int getState(); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java +1 −2 Original line number Diff line number Diff line Loading @@ -352,7 +352,6 @@ public class LockscreenLockIconController { mLockIcon.setOnClickListener(this::handleClick); mLockIcon.setOnLongClickListener(this::handleLongClick); mLockIcon.setAccessibilityDelegate(mAccessibilityDelegate); mLockIcon.setStateProvider(this::getState); if (mLockIcon.isAttachedToWindow()) { mOnAttachStateChangeListener.onViewAttachedToWindow(mLockIcon); Loading Loading @@ -462,7 +461,7 @@ public class LockscreenLockIconController { shouldUpdate = false; } if (shouldUpdate && mLockIcon != null) { mLockIcon.update(mLastState, mPulsing, mDozing, mKeyguardJustShown); mLockIcon.update(state, mPulsing, mDozing, mKeyguardJustShown); } mLastState = state; mKeyguardJustShown = false; Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java +14 −17 Original line number Diff line number Diff line Loading @@ -50,19 +50,22 @@ public class LockIcon extends KeyguardAffordanceView { static final int STATE_BIOMETRICS_ERROR = 3; private float mDozeAmount; private int mIconColor; private StateProvider mStateProvider; private int mOldState; private int mState; private boolean mPulsing; private boolean mDozing; private boolean mKeyguardJustShown; private boolean mPredrawRegistered; private final SparseArray<Drawable> mDrawableCache = new SparseArray<>(); private final OnPreDrawListener mOnPreDrawListener = new OnPreDrawListener() { @Override public boolean onPreDraw() { getViewTreeObserver().removeOnPreDrawListener(this); mPredrawRegistered = false; int newState = mStateProvider.getState(); int newState = mState; mOldState = mState; Drawable icon = getIcon(newState); setImageDrawable(icon, false); Loading @@ -80,7 +83,7 @@ public class LockIcon extends KeyguardAffordanceView { @Override public void onAnimationEnd(Drawable drawable) { if (getDrawable() == animation && newState == mStateProvider.getState() && newState == mState && newState == STATE_SCANNING_FACE) { animation.start(); } else { Loading @@ -100,10 +103,6 @@ public class LockIcon extends KeyguardAffordanceView { super(context, attrs); } void setStateProvider(StateProvider stateProvider) { mStateProvider = stateProvider; } @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Loading Loading @@ -135,14 +134,17 @@ public class LockIcon extends KeyguardAffordanceView { return false; } void update(int oldState, boolean pulsing, boolean dozing, boolean keyguardJustShown) { mOldState = oldState; void update(int newState, boolean pulsing, boolean dozing, boolean keyguardJustShown) { mState = newState; mPulsing = pulsing; mDozing = dozing; mKeyguardJustShown = keyguardJustShown; if (!mPredrawRegistered) { mPredrawRegistered = true; getViewTreeObserver().addOnPreDrawListener(mOnPreDrawListener); } } void setDozeAmount(float dozeAmount) { mDozeAmount = dozeAmount; Loading Loading @@ -175,7 +177,7 @@ public class LockIcon extends KeyguardAffordanceView { return mDrawableCache.get(iconRes); } static int getIconForState(int state) { private static int getIconForState(int state) { int iconRes; switch (state) { case STATE_LOCKED: Loading @@ -196,7 +198,7 @@ public class LockIcon extends KeyguardAffordanceView { return iconRes; } static int getAnimationIndexForTransition(int oldState, int newState, boolean pulsing, private static int getAnimationIndexForTransition(int oldState, int newState, boolean pulsing, boolean dozing, boolean keyguardJustShown) { // Never animate when screen is off Loading Loading @@ -260,9 +262,4 @@ public class LockIcon extends KeyguardAffordanceView { } return LOCK_ANIM_RES_IDS[0][lockAnimIndex]; } interface StateProvider { int getState(); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java +1 −2 Original line number Diff line number Diff line Loading @@ -352,7 +352,6 @@ public class LockscreenLockIconController { mLockIcon.setOnClickListener(this::handleClick); mLockIcon.setOnLongClickListener(this::handleLongClick); mLockIcon.setAccessibilityDelegate(mAccessibilityDelegate); mLockIcon.setStateProvider(this::getState); if (mLockIcon.isAttachedToWindow()) { mOnAttachStateChangeListener.onViewAttachedToWindow(mLockIcon); Loading Loading @@ -462,7 +461,7 @@ public class LockscreenLockIconController { shouldUpdate = false; } if (shouldUpdate && mLockIcon != null) { mLockIcon.update(mLastState, mPulsing, mDozing, mKeyguardJustShown); mLockIcon.update(state, mPulsing, mDozing, mKeyguardJustShown); } mLastState = state; mKeyguardJustShown = false; Loading