diff options
4 files changed, 67 insertions, 11 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 9854f5450df1..4ca9c5db013c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -289,6 +289,8 @@ public class KeyguardBouncer { SysUiStatsLog.KEYGUARD_BOUNCER_STATE_CHANGED__STATE__HIDDEN); mDismissCallbackRegistry.notifyDismissCancelled(); } + mExpansion = EXPANSION_HIDDEN; + dispatchExpansionChanged(); mIsScrimmed = false; mFalsingCollector.onBouncerHidden(); mCallback.onBouncerVisiblityChanged(false /* shown */); @@ -377,6 +379,7 @@ public class KeyguardBouncer { */ public void setExpansion(float fraction) { float oldExpansion = mExpansion; + boolean expansionChanged = mExpansion != fraction; mExpansion = fraction; if (mKeyguardViewController != null && !mIsAnimatingAway) { mKeyguardViewController.setExpansion(fraction); @@ -394,6 +397,10 @@ public class KeyguardBouncer { mKeyguardViewController.onStartingToHide(); } } + + if (expansionChanged) { + dispatchExpansionChanged(); + } } public boolean willDismissWithAction() { @@ -518,6 +525,12 @@ public class KeyguardBouncer { } } + private void dispatchExpansionChanged() { + for (BouncerExpansionCallback callback : mExpansionCallbacks) { + callback.onExpansionChanged(mExpansion); + } + } + public void dump(PrintWriter pw) { pw.println("KeyguardBouncer"); pw.println(" isShowing(): " + isShowing()); @@ -534,6 +547,12 @@ public class KeyguardBouncer { void onStartingToHide(); void onStartingToShow(); void onFullyHidden(); + + /** + * From 0f {@link KeyguardBouncer#EXPANSION_VISIBLE} when fully visible + * to 1f {@link KeyguardBouncer#EXPANSION_HIDDEN} when fully hidden + */ + default void onExpansionChanged(float bouncerHideAmount) {} } /** Create a {@link KeyguardBouncer} once a container and bouncer callback are available. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java index 0e7e2fd8173c..547a3705266a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java @@ -23,6 +23,7 @@ import static com.android.systemui.statusbar.phone.LockIcon.STATE_LOCKED; import static com.android.systemui.statusbar.phone.LockIcon.STATE_LOCK_OPEN; import static com.android.systemui.statusbar.phone.LockIcon.STATE_SCANNING_FACE; +import android.animation.ArgbEvaluator; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; @@ -38,6 +39,7 @@ import com.android.internal.logging.nano.MetricsProto; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; +import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; @@ -84,7 +86,7 @@ public class LockscreenLockIconController { private boolean mDocked; private boolean mWakeAndUnlockRunning; private boolean mShowingLaunchAffordance; - private boolean mBouncerShowing; + private float mBouncerHiddenAmount = KeyguardBouncer.EXPANSION_HIDDEN; private boolean mBouncerShowingScrimmed; private boolean mFingerprintUnlock; private int mStatusBarState = StatusBarState.SHADE; @@ -104,6 +106,8 @@ public class LockscreenLockIconController { mSimLocked = mKeyguardUpdateMonitor.isSimPinSecure(); mConfigurationListener.onThemeChanged(); + + updateColor(); update(); } @@ -348,7 +352,6 @@ public class LockscreenLockIconController { */ public void attach(LockIcon lockIcon) { mLockIcon = lockIcon; - updateColor(); mLockIcon.setOnClickListener(this::handleClick); mLockIcon.setOnLongClickListener(this::handleLongClick); @@ -408,20 +411,44 @@ public class LockscreenLockIconController { /** Sets whether the bouncer is showing. */ public void setBouncerShowingScrimmed(boolean showing, boolean scrimmed) { - mBouncerShowing = showing; mBouncerShowingScrimmed = scrimmed; update(); } + /** + * Sets how hidden the bouncer is, where 0f is fully visible and 1f is fully hidden + * See {@link KeyguardBouncer#EXPANSION_VISIBLE} and {@link KeyguardBouncer#EXPANSION_HIDDEN}. + */ + public void setBouncerHideAmount(float hideAmount) { + mBouncerHiddenAmount = hideAmount; + updateColor(); + } + private void updateColor() { if (mLockIcon == null) { return; } - TypedArray typedArray = mLockIcon.getContext().getTheme().obtainStyledAttributes( - null, new int[]{ android.R.attr.textColorPrimary }, 0, 0); - int iconColor = typedArray.getColor(0, Color.WHITE); - typedArray.recycle(); + int iconColor = -1; + if (mBouncerHiddenAmount == KeyguardBouncer.EXPANSION_VISIBLE) { + TypedArray typedArray = mLockIcon.getContext().getTheme().obtainStyledAttributes( + null, new int[]{ android.R.attr.textColorPrimary }, 0, 0); + iconColor = typedArray.getColor(0, Color.WHITE); + typedArray.recycle(); + } else if (mBouncerHiddenAmount == KeyguardBouncer.EXPANSION_HIDDEN) { + iconColor = Utils.getColorAttrDefaultColor( + mLockIcon.getContext(), com.android.systemui.R.attr.wallpaperTextColor); + } else { + // bouncer is transitioning + TypedArray typedArray = mLockIcon.getContext().getTheme().obtainStyledAttributes( + null, new int[]{ android.R.attr.textColorPrimary }, 0, 0); + int bouncerIconColor = typedArray.getColor(0, Color.WHITE); + typedArray.recycle(); + int keyguardIconColor = Utils.getColorAttrDefaultColor( + mLockIcon.getContext(), com.android.systemui.R.attr.wallpaperTextColor); + iconColor = (int) new ArgbEvaluator().evaluate( + mBouncerHiddenAmount, bouncerIconColor, keyguardIconColor); + } mLockIcon.updateColor(iconColor); } @@ -520,10 +547,7 @@ public class LockscreenLockIconController { return changed; } boolean onAodOrDocked = mStatusBarStateController.isDozing() || mDocked; - boolean onKeyguardWithoutBouncer = mStatusBarState == StatusBarState.KEYGUARD - && !mBouncerShowing; - boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance - || onKeyguardWithoutBouncer; + boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance; boolean fingerprintOrBypass = mFingerprintUnlock || mKeyguardBypassController.getBypassEnabled(); if (fingerprintOrBypass && !mBouncerShowingScrimmed) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 9e872ab65591..981f9a662deb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3794,6 +3794,14 @@ public class StatusBar extends SystemUI implements DemoMode, } /** + * Sets how hidden the bouncer is, where 0f is fully visible and 1f is fully hidden + * See {@link KeyguardBouncer#EXPANSION_VISIBLE} and {@link KeyguardBouncer#EXPANSION_HIDDEN}. + */ + public void setBouncerHideAmount(float hideAmount) { + mLockscreenLockIconController.setBouncerHideAmount(hideAmount); + } + + /** * Collapses the notification shade if it is tracking or expanded. */ public void collapseShade() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index b912614ba3e8..055b78a2c000 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -130,6 +130,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb updateStates(); updateLockIcon(); } + + @Override + public void onExpansionChanged(float hideAmount) { + mStatusBar.setBouncerHideAmount(hideAmount); + } }; private final DockManager.DockEventListener mDockEventListener = new DockManager.DockEventListener() { |