summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Beverly <beverlyt@google.com> 2020-12-03 14:16:43 -0500
committer Beverly Tai <beverlyt@google.com> 2020-12-03 22:52:17 +0000
commit24b68453e8ec5ded70de21bc914b844cb0dd9b76 (patch)
tree0ab265d72d2fde0b34cc80b4b536fced2d5a0df8
parent6f3ed806b6f8a29be0add6fd6db49386849ac8eb (diff)
Bring back lock icon w/ wallpaper color on LS
Current POR is to only hide the lock icon when udfps is enrolled On the LS, change the color of the lock icon based on the wallpaper color, else use textColorPrimary for the bouncer where the bouncer is background is white. Test: manual Bug: 170228350 Change-Id: Iddedb3c7338f7a995e4787d1ec55bbee960b780d
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java46
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java5
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() {