Move padlock to the top of the lock screen
Test: tap on notification on lock screen
Test: tap on notification on shade locked
Test: swipe down from the top expanding QS
Test: swipe up from LS
Test: switch between pin, pattern and password
Test: add and remove locked sim card
Test: atest KeyguardBottomAreaTest
Test: atest KeyguardClockPositionAlgorithmTest
Test: atest KeyguardMessageAreaTest
Test: atest KeyguardIndicationControllerTest
Test: atest StatusBarKeyguardViewManagerTest
Test: atest KeyguardBouncerTest
Test: atest KeyguardPatternViewTest
Fixes: 130398499
Fixes: 130298363
Fixes: 129784068
Fixes: 130223966
Change-Id: Ib1706de259fa4b1f4ef13f654cbd931457733d82
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
index 4cb8d90..2ff7266 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -100,7 +100,6 @@
@Override
protected void onFinishInflate() {
mLockPatternUtils = new LockPatternUtils(mContext);
- mSecurityMessageDisplay = KeyguardMessageArea.findSecurityMessageDisplay(this);
mEcaView = findViewById(R.id.keyguard_selector_fade_container);
EmergencyButton button = findViewById(R.id.emergency_call_button);
@@ -110,6 +109,12 @@
}
@Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mSecurityMessageDisplay = KeyguardMessageArea.findSecurityMessageDisplay(this);
+ }
+
+ @Override
public void onEmergencyButtonClickedWhenInCall() {
mCallback.reset();
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java b/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
index 010ec7c..ace6f6f 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardMessageArea.java
@@ -16,8 +16,12 @@
package com.android.keyguard;
+import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
+
import android.content.Context;
import android.content.res.ColorStateList;
+import android.content.res.TypedArray;
+import android.graphics.Color;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
@@ -26,12 +30,18 @@
import android.view.View;
import android.widget.TextView;
+import com.android.systemui.statusbar.policy.ConfigurationController;
+
import java.lang.ref.WeakReference;
+import javax.inject.Inject;
+import javax.inject.Named;
+
/***
* Manages a number of views inside of the given layout. See below for a list of widgets.
*/
-class KeyguardMessageArea extends TextView implements SecurityMessageDisplay {
+public class KeyguardMessageArea extends TextView implements SecurityMessageDisplay,
+ ConfigurationController.ConfigurationListener {
/** Handler token posted with accessibility announcement runnables. */
private static final Object ANNOUNCE_TOKEN = new Object();
@@ -43,8 +53,9 @@
private static final int DEFAULT_COLOR = -1;
private final Handler mHandler;
- private final ColorStateList mDefaultColorState;
+ private final ConfigurationController mConfigurationController;
+ private ColorStateList mDefaultColorState;
private CharSequence mMessage;
private ColorStateList mNextMessageColorState = ColorStateList.valueOf(DEFAULT_COLOR);
@@ -58,30 +69,58 @@
};
public KeyguardMessageArea(Context context) {
- this(context, null);
+ super(context, null);
+ throw new IllegalStateException("This constructor should never be invoked");
}
- public KeyguardMessageArea(Context context, AttributeSet attrs) {
- this(context, attrs, KeyguardUpdateMonitor.getInstance(context));
+ @Inject
+ public KeyguardMessageArea(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
+ ConfigurationController configurationController) {
+ this(context, attrs, KeyguardUpdateMonitor.getInstance(context), configurationController);
}
- public KeyguardMessageArea(Context context, AttributeSet attrs, KeyguardUpdateMonitor monitor) {
+ public KeyguardMessageArea(Context context, AttributeSet attrs, KeyguardUpdateMonitor monitor,
+ ConfigurationController configurationController) {
super(context, attrs);
setLayerType(LAYER_TYPE_HARDWARE, null); // work around nested unclipped SaveLayer bug
monitor.registerCallback(mInfoCallback);
mHandler = new Handler(Looper.myLooper());
+ mConfigurationController = configurationController;
- mDefaultColorState = getTextColors();
+ onThemeChanged();
update();
}
@Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mConfigurationController.addCallback(this);
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mConfigurationController.removeCallback(this);
+ }
+
+ @Override
public void setNextMessageColor(ColorStateList colorState) {
mNextMessageColorState = colorState;
}
@Override
+ public void onThemeChanged() {
+ TypedArray array = mContext.obtainStyledAttributes(new int[] {
+ R.attr.wallpaperTextColor
+ });
+ ColorStateList newTextColors = ColorStateList.valueOf(array.getColor(0, Color.RED));
+ array.recycle();
+ setTextColor(newTextColors);
+ mDefaultColorState = newTextColors;
+ }
+
+ @Override
public void setMessage(CharSequence msg) {
if (!TextUtils.isEmpty(msg)) {
securityMessageChanged(msg);
@@ -108,9 +147,11 @@
setMessage(message);
}
- public static SecurityMessageDisplay findSecurityMessageDisplay(View v) {
- KeyguardMessageArea messageArea = (KeyguardMessageArea) v.findViewById(
- R.id.keyguard_message_area);
+ public static KeyguardMessageArea findSecurityMessageDisplay(View v) {
+ KeyguardMessageArea messageArea = v.findViewById(R.id.keyguard_message_area);
+ if (messageArea == null) {
+ messageArea = v.getRootView().findViewById(R.id.keyguard_message_area);
+ }
if (messageArea == null) {
throw new RuntimeException("Can't find keyguard_message_area in " + v.getClass());
}
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java
index a543d17..6808c0f 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPINView.java
@@ -67,7 +67,9 @@
@Override
protected void resetState() {
super.resetState();
- mSecurityMessageDisplay.setMessage("");
+ if (mSecurityMessageDisplay != null) {
+ mSecurityMessageDisplay.setMessage("");
+ }
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
index 185edbf..96392156 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPasswordView.java
@@ -81,7 +81,9 @@
@Override
protected void resetState() {
mPasswordEntry.setTextOperationUser(UserHandle.of(KeyguardUpdateMonitor.getCurrentUser()));
- mSecurityMessageDisplay.setMessage("");
+ if (mSecurityMessageDisplay != null) {
+ mSecurityMessageDisplay.setMessage("");
+ }
final boolean wasDisabled = mPasswordEntry.isEnabled();
// Don't set enabled password entry & showSoftInput when PasswordEntry is invisible or in
// pausing stage.
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
index 112e067..8899bd9 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPatternView.java
@@ -34,6 +34,7 @@
import android.view.animation.Interpolator;
import android.widget.LinearLayout;
+import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternChecker;
import com.android.internal.widget.LockPatternUtils;
@@ -92,7 +93,8 @@
}
};
private Rect mTempRect = new Rect();
- private KeyguardMessageArea mSecurityMessageDisplay;
+ @VisibleForTesting
+ KeyguardMessageArea mSecurityMessageDisplay;
private View mEcaView;
private ViewGroup mContainer;
private int mDisappearYTranslation;
@@ -151,8 +153,6 @@
// vibrate mode will be the same for the life of this screen
mLockPatternView.setTactileFeedbackEnabled(mLockPatternUtils.isTactileFeedbackEnabled());
- mSecurityMessageDisplay =
- (KeyguardMessageArea) KeyguardMessageArea.findSecurityMessageDisplay(this);
mEcaView = findViewById(R.id.keyguard_selector_fade_container);
mContainer = findViewById(R.id.container);
@@ -171,6 +171,12 @@
}
@Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mSecurityMessageDisplay = KeyguardMessageArea.findSecurityMessageDisplay(this);
+ }
+
+ @Override
public void onEmergencyButtonClickedWhenInCall() {
mCallback.reset();
}
@@ -201,6 +207,10 @@
mLockPatternView.setEnabled(true);
mLockPatternView.clearPattern();
+ if (mSecurityMessageDisplay == null) {
+ return;
+ }
+
// if the user is currently locked out, enforce it.
long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
KeyguardUpdateMonitor.getCurrentUser());
@@ -212,7 +222,9 @@
}
private void displayDefaultSecurityMessage() {
- mSecurityMessageDisplay.setMessage("");
+ if (mSecurityMessageDisplay != null) {
+ mSecurityMessageDisplay.setMessage("");
+ }
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
index fb4fe81..0d8a3db 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPinView.java
@@ -24,6 +24,7 @@
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -104,7 +105,9 @@
int count = TelephonyManager.getDefault().getSimCount();
Resources rez = getResources();
String msg;
- int color = Color.WHITE;
+ TypedArray array = mContext.obtainStyledAttributes(new int[] { R.attr.wallpaperTextColor });
+ int color = array.getColor(0, Color.WHITE);
+ array.recycle();
if (count < 2) {
msg = rez.getString(R.string.kg_sim_pin_instructions);
} else {
@@ -120,7 +123,9 @@
msg = rez.getString(R.string.kg_sim_lock_esim_instructions, msg);
}
- mSecurityMessageDisplay.setMessage(msg);
+ if (mSecurityMessageDisplay != null) {
+ mSecurityMessageDisplay.setMessage(msg);
+ }
mSimImageView.setImageTintList(ColorStateList.valueOf(color));
}
@@ -214,6 +219,7 @@
protected void onAttachedToWindow() {
super.onAttachedToWindow();
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback);
+ resetState();
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
index b17d117..27f71d1 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSimPukView.java
@@ -23,6 +23,7 @@
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
+import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -164,7 +165,9 @@
int count = TelephonyManager.getDefault().getSimCount();
Resources rez = getResources();
String msg;
- int color = Color.WHITE;
+ TypedArray array = mContext.obtainStyledAttributes(new int[] { R.attr.wallpaperTextColor });
+ int color = array.getColor(0, Color.WHITE);
+ array.recycle();
if (count < 2) {
msg = rez.getString(R.string.kg_puk_enter_puk_hint);
} else {
@@ -179,7 +182,9 @@
if (isEsimLocked) {
msg = rez.getString(R.string.kg_sim_lock_esim_instructions, msg);
}
- mSecurityMessageDisplay.setMessage(msg);
+ if (mSecurityMessageDisplay != null) {
+ mSecurityMessageDisplay.setMessage(msg);
+ }
mSimImageView.setImageTintList(ColorStateList.valueOf(color));
// Sending empty PUK here to query the number of remaining PIN attempts
@@ -267,6 +272,7 @@
protected void onAttachedToWindow() {
super.onAttachedToWindow();
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback);
+ resetState();
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index d70d0d8..6af7ac4 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -2074,9 +2074,9 @@
public StatusBarKeyguardViewManager registerStatusBar(StatusBar statusBar,
ViewGroup container, NotificationPanelView panelView,
- BiometricUnlockController biometricUnlockController) {
+ BiometricUnlockController biometricUnlockController, ViewGroup lockIconContainer) {
mStatusBarKeyguardViewManager.registerStatusBar(statusBar, container, panelView,
- biometricUnlockController, mDismissCallbackRegistry);
+ biometricUnlockController, mDismissCallbackRegistry, lockIconContainer);
return mStatusBarKeyguardViewManager;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index 3441591..1a54f65 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -41,6 +41,8 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.app.IBatteryStats;
+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;
@@ -51,6 +53,7 @@
import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener;
import com.android.systemui.statusbar.phone.KeyguardIndicationTextView;
import com.android.systemui.statusbar.phone.LockIcon;
+import com.android.systemui.statusbar.phone.LockscreenGestureLogger;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.policy.UserInfoController;
import com.android.systemui.util.wakelock.SettableWakeLock;
@@ -80,11 +83,13 @@
private final UserManager mUserManager;
private final IBatteryStats mBatteryInfo;
private final SettableWakeLock mWakeLock;
+ private final LockPatternUtils mLockPatternUtils;
private final int mSlowThreshold;
private final int mFastThreshold;
private final LockIcon mLockIcon;
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
+ private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private String mRestingIndication;
private CharSequence mTransientIndication;
@@ -104,14 +109,13 @@
private final DevicePolicyManager mDevicePolicyManager;
private boolean mDozing;
- private float mDarkAmount;
/**
* Creates a new KeyguardIndicationController and registers callbacks.
*/
public KeyguardIndicationController(Context context, ViewGroup indicationArea,
LockIcon lockIcon) {
- this(context, indicationArea, lockIcon,
+ this(context, indicationArea, lockIcon, new LockPatternUtils(context),
WakeLock.createPartial(context, "Doze:KeyguardIndication"));
registerCallbacks(KeyguardUpdateMonitor.getInstance(context));
@@ -122,7 +126,7 @@
*/
@VisibleForTesting
KeyguardIndicationController(Context context, ViewGroup indicationArea, LockIcon lockIcon,
- WakeLock wakeLock) {
+ LockPatternUtils lockPatternUtils, WakeLock wakeLock) {
mContext = context;
mIndicationArea = indicationArea;
mTextView = indicationArea.findViewById(R.id.keyguard_indication_text);
@@ -130,7 +134,9 @@
mTextView.getTextColors() : ColorStateList.valueOf(Color.WHITE);
mDisclosure = indicationArea.findViewById(R.id.keyguard_indication_enterprise_disclosure);
mLockIcon = lockIcon;
+ mLockIcon.setOnLongClickListener(this::handleTrustCircleClick);
mWakeLock = new SettableWakeLock(wakeLock, TAG);
+ mLockPatternUtils = lockPatternUtils;
Resources res = context.getResources();
mSlowThreshold = res.getInteger(R.integer.config_chargingSlowlyThreshold);
@@ -164,6 +170,15 @@
Dependency.get(StatusBarStateController.class).removeCallback(this);
}
+ private boolean handleTrustCircleClick(View view) {
+ mLockscreenGestureLogger.write(MetricsProto.MetricsEvent.ACTION_LS_LOCK,
+ 0 /* lengthDp - N/A */, 0 /* velocityDp - N/A */);
+ showTransientIndication(R.string.keyguard_indication_trust_disabled);
+ mLockPatternUtils.requireCredentialEntry(KeyguardUpdateMonitor.getCurrentUser());
+
+ return true;
+ }
+
/**
* Gets the {@link KeyguardUpdateMonitorCallback} instance associated with this
* {@link KeyguardIndicationController}.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java
index 49d421b..cd0a43e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardAffordanceHelper.java
@@ -56,7 +56,6 @@
private int mMinFlingVelocity;
private int mHintGrowAmount;
private KeyguardAffordanceView mLeftIcon;
- private KeyguardAffordanceView mCenterIcon;
private KeyguardAffordanceView mRightIcon;
private Animator mSwipeAnimator;
private FalsingManager mFalsingManager;
@@ -85,7 +84,6 @@
mCallback = callback;
initIcons();
updateIcon(mLeftIcon, 0.0f, mLeftIcon.getRestingAlpha(), false, false, true, false);
- updateIcon(mCenterIcon, 0.0f, mCenterIcon.getRestingAlpha(), false, false, true, false);
updateIcon(mRightIcon, 0.0f, mRightIcon.getRestingAlpha(), false, false, true, false);
initDimens();
}
@@ -108,7 +106,6 @@
private void initIcons() {
mLeftIcon = mCallback.getLeftIcon();
- mCenterIcon = mCallback.getCenterIcon();
mRightIcon = mCallback.getRightIcon();
updatePreviews();
}
@@ -398,8 +395,6 @@
}
updateIcon(otherView, 0.0f, fadeOutAlpha * otherView.getRestingAlpha(),
animateIcons, slowAnimation, isReset, forceNoCircleAnimation);
- updateIcon(mCenterIcon, 0.0f, fadeOutAlpha * mCenterIcon.getRestingAlpha(),
- animateIcons, slowAnimation, isReset, forceNoCircleAnimation);
mTranslation = translation;
}
@@ -417,7 +412,6 @@
KeyguardAffordanceView otherView = targetView == mRightIcon ? mLeftIcon : mRightIcon;
updateIconAlpha(targetView, alpha + fadeOutAlpha * targetView.getRestingAlpha(), false);
updateIconAlpha(otherView, fadeOutAlpha * otherView.getRestingAlpha(), false);
- updateIconAlpha(mCenterIcon, fadeOutAlpha * mCenterIcon.getRestingAlpha(), false);
}
private float getTranslationFromRadius(float circleSize) {
@@ -538,12 +532,10 @@
if (animate) {
fling(0, false, !left);
updateIcon(otherView, 0.0f, 0, true, false, true, false);
- updateIcon(mCenterIcon, 0.0f, 0, true, false, true, false);
} else {
mCallback.onAnimationToSideStarted(!left, mTranslation, 0);
mTranslation = left ? mCallback.getMaxTranslationDistance()
: mCallback.getMaxTranslationDistance();
- updateIcon(mCenterIcon, 0.0f, 0.0f, false, false, true, false);
updateIcon(otherView, 0.0f, 0.0f, false, false, true, false);
targetView.instantFinishAnimation();
mFlingEndListener.onAnimationEnd(null);
@@ -575,8 +567,6 @@
KeyguardAffordanceView getLeftIcon();
- KeyguardAffordanceView getCenterIcon();
-
KeyguardAffordanceView getRightIcon();
View getLeftPreview();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index a924680..cb64f10 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -40,7 +40,6 @@
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
-import android.hardware.biometrics.BiometricSourceType;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.IBinder;
@@ -64,7 +63,6 @@
import android.widget.TextView;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
@@ -77,7 +75,6 @@
import com.android.systemui.plugins.IntentButtonProvider;
import com.android.systemui.plugins.IntentButtonProvider.IntentButton;
import com.android.systemui.plugins.IntentButtonProvider.IntentButton.IconState;
-import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.KeyguardIndicationController;
import com.android.systemui.statusbar.policy.AccessibilityController;
@@ -94,7 +91,7 @@
*/
public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickListener,
UnlockMethodCache.OnUnlockMethodChangedListener,
- AccessibilityController.AccessibilityStateChangedCallback, View.OnLongClickListener {
+ AccessibilityController.AccessibilityStateChangedCallback {
final static String TAG = "StatusBar/KeyguardBottomAreaView";
@@ -122,8 +119,6 @@
private KeyguardAffordanceView mRightAffordanceView;
private KeyguardAffordanceView mLeftAffordanceView;
- private LockIcon mLockIcon;
- private ViewGroup mLockIconContainer;
private ViewGroup mIndicationArea;
private TextView mEnterpriseDisclosure;
private TextView mIndicationText;
@@ -169,7 +164,6 @@
private IntentButton mLeftButton = new DefaultLeftButton();
private Extension<IntentButton> mLeftExtension;
private String mLeftButtonStr;
- private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private boolean mDozing;
private int mIndicationBottomMargin;
private float mDarkAmount;
@@ -199,9 +193,7 @@
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(host, info);
String label = null;
- if (host == mLockIcon) {
- label = getResources().getString(R.string.unlock_label);
- } else if (host == mRightAffordanceView) {
+ if (host == mRightAffordanceView) {
label = getResources().getString(R.string.camera_label);
} else if (host == mLeftAffordanceView) {
if (mLeftIsVoiceAssist) {
@@ -216,11 +208,7 @@
@Override
public boolean performAccessibilityAction(View host, int action, Bundle args) {
if (action == ACTION_CLICK) {
- if (host == mLockIcon) {
- mStatusBar.animateCollapsePanels(
- CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */);
- return true;
- } else if (host == mRightAffordanceView) {
+ if (host == mRightAffordanceView) {
launchCamera(CAMERA_LAUNCH_SOURCE_AFFORDANCE);
return true;
} else if (host == mLeftAffordanceView) {
@@ -247,8 +235,6 @@
mOverlayContainer = findViewById(R.id.overlay_container);
mRightAffordanceView = findViewById(R.id.camera_button);
mLeftAffordanceView = findViewById(R.id.left_button);
- mLockIcon = findViewById(R.id.lock_icon);
- mLockIconContainer = findViewById(R.id.lock_icon_container);
mIndicationArea = findViewById(R.id.keyguard_indication_area);
mEnterpriseDisclosure = findViewById(
R.id.keyguard_indication_enterprise_disclosure);
@@ -260,14 +246,9 @@
updateCameraVisibility();
mUnlockMethodCache = UnlockMethodCache.getInstance(getContext());
mUnlockMethodCache.addListener(this);
- KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
- mLockIcon.setScreenOn(updateMonitor.isScreenOn());
- mLockIcon.update();
setClipChildren(false);
setClipToPadding(false);
inflateCameraPreview();
- mLockIcon.setOnClickListener(this);
- mLockIcon.setOnLongClickListener(this);
mRightAffordanceView.setOnClickListener(this);
mLeftAffordanceView.setOnClickListener(this);
initAccessibility();
@@ -275,7 +256,6 @@
mFlashlightController = Dependency.get(FlashlightController.class);
mAccessibilityController = Dependency.get(AccessibilityController.class);
mAssistManager = Dependency.get(AssistManager.class);
- mLockIcon.setAccessibilityController(mAccessibilityController);
mActivityIntentHelper = new ActivityIntentHelper(getContext());
updateLeftAffordance();
}
@@ -316,7 +296,6 @@
}
private void initAccessibility() {
- mLockIcon.setAccessibilityDelegate(mAccessibilityDelegate);
mLeftAffordanceView.setAccessibilityDelegate(mAccessibilityDelegate);
mRightAffordanceView.setAccessibilityDelegate(mAccessibilityDelegate);
}
@@ -348,13 +327,6 @@
mRightAffordanceView.setLayoutParams(lp);
updateRightAffordanceIcon();
- lp = mLockIcon.getLayoutParams();
- lp.width = getResources().getDimensionPixelSize(R.dimen.keyguard_lock_width);
- lp.height = getResources().getDimensionPixelSize(R.dimen.keyguard_lock_height);
- mLockIcon.setLayoutParams(lp);
- mLockIcon.setContentDescription(getContext().getText(R.string.accessibility_unlock_button));
- mLockIcon.update(true /* force */);
-
lp = mLeftAffordanceView.getLayoutParams();
lp.width = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_width);
lp.height = getResources().getDimensionPixelSize(R.dimen.keyguard_affordance_height);
@@ -437,7 +409,6 @@
mLeftAffordanceView.setClickable(touchExplorationEnabled);
mRightAffordanceView.setFocusable(accessibilityEnabled);
mLeftAffordanceView.setFocusable(accessibilityEnabled);
- mLockIcon.update();
}
@Override
@@ -446,30 +417,9 @@
launchCamera(CAMERA_LAUNCH_SOURCE_AFFORDANCE);
} else if (v == mLeftAffordanceView) {
launchLeftAffordance();
- } if (v == mLockIcon) {
- if (!mAccessibilityController.isAccessibilityEnabled()) {
- handleTrustCircleClick();
- } else {
- mStatusBar.animateCollapsePanels(
- CommandQueue.FLAG_EXCLUDE_NONE, true /* force */);
- }
}
}
- @Override
- public boolean onLongClick(View v) {
- handleTrustCircleClick();
- return true;
- }
-
- private void handleTrustCircleClick() {
- mLockscreenGestureLogger.write(MetricsEvent.ACTION_LS_LOCK, 0 /* lengthDp - N/A */,
- 0 /* velocityDp - N/A */);
- mIndicationController.showTransientIndication(
- R.string.keyguard_indication_trust_disabled);
- mLockPatternUtils.requireCredentialEntry(KeyguardUpdateMonitor.getCurrentUser());
- }
-
public void bindCameraPrewarmService() {
Intent intent = getCameraIntent();
ActivityInfo targetInfo = mActivityIntentHelper.getTargetActivityInfo(intent,
@@ -571,19 +521,9 @@
return;
}
mDarkAmount = darkAmount;
- mLockIcon.setDarkAmount(darkAmount);
dozeTimeTick();
}
- /**
- * When keyguard is in pulsing (AOD2) state.
- * @param pulsing {@code true} when pulsing.
- * @param animated if transition should be animated.
- */
- public void setPulsing(boolean pulsing, boolean animated) {
- mLockIcon.setPulsing(pulsing, animated);
- }
-
private static boolean isSuccessfulLaunch(int result) {
return result == ActivityManager.START_SUCCESS
|| result == ActivityManager.START_DELIVERED_TO_TOP
@@ -641,7 +581,6 @@
protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (changedView == this && visibility == VISIBLE) {
- mLockIcon.update();
updateCameraVisibility();
}
}
@@ -662,14 +601,6 @@
return mCameraPreview;
}
- public LockIcon getLockIcon() {
- return mLockIcon;
- }
-
- public ViewGroup getLockIconContainer() {
- return mLockIconContainer;
- }
-
public View getIndicationArea() {
return mIndicationArea;
}
@@ -681,7 +612,6 @@
@Override
public void onUnlockMethodStateChanged() {
- mLockIcon.update();
updateCameraVisibility();
}
@@ -764,32 +694,6 @@
}
@Override
- public void onScreenTurnedOn() {
- mLockIcon.setScreenOn(true);
- }
-
- @Override
- public void onScreenTurnedOff() {
- mLockIcon.setScreenOn(false);
- }
-
- @Override
- public void onKeyguardVisibilityChanged(boolean showing) {
- mLockIcon.update();
- }
-
- @Override
- public void onBiometricRunningStateChanged(boolean running,
- BiometricSourceType biometricSourceType) {
- mLockIcon.update();
- }
-
- @Override
- public void onStrongAuthStateChanged(int userId) {
- mLockIcon.update();
- }
-
- @Override
public void onUserUnlocked() {
inflateCameraPreview();
updateCameraVisibility();
@@ -836,7 +740,6 @@
updateCameraVisibility();
updateLeftAffordanceIcon();
- mLockIcon.setDozing(dozing);
if (dozing) {
mOverlayContainer.setVisibility(INVISIBLE);
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 1d2ca9f..b00d874 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java
@@ -167,6 +167,7 @@
DejankUtils.postAfterTraversal(mShowRunnable);
mCallback.onBouncerVisiblityChanged(true /* shown */);
+ mExpansionCallback.onStartingToShow();
}
public boolean isScrimmed() {
@@ -429,8 +430,6 @@
mStatusBarHeight = mRoot.getResources().getDimensionPixelOffset(
com.android.systemui.R.dimen.status_bar_height);
mRoot.setVisibility(View.INVISIBLE);
- mRoot.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight,
- oldBottom) -> mExpansionCallback.onLayout());
mRoot.setAccessibilityPaneTitle(mKeyguardView.getAccessibilityTitleForCurrentMode());
final WindowInsets rootInsets = mRoot.getRootWindowInsets();
@@ -510,7 +509,7 @@
public interface BouncerExpansionCallback {
void onFullyShown();
void onStartingToHide();
+ void onStartingToShow();
void onFullyHidden();
- void onLayout();
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index d59f248..0171d7f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -99,11 +99,6 @@
*/
private float mDarkAmount;
- /**
- * If keyguard will require a password or just fade away.
- */
- private boolean mCurrentlySecure;
-
private float mEmptyDragAmount;
/**
@@ -122,7 +117,7 @@
public void setup(int minTopMargin, int maxShadeBottom, int notificationStackHeight,
float panelExpansion, int parentHeight, int keyguardStatusHeight, int clockPreferredY,
- float dark, boolean secure, float emptyDragAmount) {
+ float dark, float emptyDragAmount) {
mMinTopMargin = minTopMargin + mContainerTopPadding;
mMaxShadeBottom = maxShadeBottom;
mNotificationStackHeight = notificationStackHeight;
@@ -131,7 +126,6 @@
mKeyguardStatusHeight = keyguardStatusHeight;
mClockPreferredY = clockPreferredY;
mDarkAmount = dark;
- mCurrentlySecure = secure;
mEmptyDragAmount = emptyDragAmount;
}
@@ -204,13 +198,8 @@
* @return Alpha from 0 to 1.
*/
private float getClockAlpha(int y) {
- float alphaKeyguard;
- if (mCurrentlySecure) {
- alphaKeyguard = 1;
- } else {
- alphaKeyguard = Math.max(0, y / Math.max(1f, getExpandedClockPosition()));
- alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
- }
+ float alphaKeyguard = Math.max(0, y / Math.max(1f, getExpandedClockPosition()));
+ alphaKeyguard = Interpolators.ACCELERATE.getInterpolation(alphaKeyguard);
return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
index 3cc4a7b..971e5b31 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockIcon.java
@@ -16,29 +16,40 @@
package com.android.systemui.statusbar.phone;
+import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
+
import android.content.Context;
+import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Color;
-import android.graphics.PorterDuff;
import android.graphics.drawable.Animatable2;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
+import android.hardware.biometrics.BiometricSourceType;
import android.util.AttributeSet;
-import android.view.ContextThemeWrapper;
+import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import com.android.internal.graphics.ColorUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
+import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.R;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.policy.AccessibilityController;
+import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.UserInfoController.OnUserInfoChangedListener;
+import javax.inject.Inject;
+import javax.inject.Named;
+
/**
* Manages the different states and animations of the unlock icon.
*/
-public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChangedListener {
+public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChangedListener,
+ StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener,
+ UnlockMethodCache.OnUnlockMethodChangedListener {
private static final int FP_DRAW_OFF_TIMEOUT = 800;
@@ -46,13 +57,16 @@
private static final int STATE_LOCK_OPEN = 1;
private static final int STATE_SCANNING_FACE = 2;
private static final int STATE_BIOMETRICS_ERROR = 3;
+ private final ConfigurationController mConfigurationController;
+ private final StatusBarStateController mStatusBarStateController;
+ private final UnlockMethodCache mUnlockMethodCache;
+ private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
+ private final AccessibilityController mAccessibilityController;
private int mLastState = 0;
private boolean mTransientBiometricsError;
private boolean mScreenOn;
private boolean mLastScreenOn;
- private final UnlockMethodCache mUnlockMethodCache;
- private AccessibilityController mAccessibilityController;
private boolean mIsFaceUnlockState;
private int mDensity;
private boolean mPulsing;
@@ -61,18 +75,82 @@
private boolean mLastDozing;
private boolean mLastPulsing;
private boolean mLastBouncerVisible;
+ private int mIconColor;
private final Runnable mDrawOffTimeout = () -> update(true /* forceUpdate */);
- private float mDarkAmount;
+ private float mDozeAmount;
- public LockIcon(Context context, AttributeSet attrs) {
+ private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
+ new KeyguardUpdateMonitorCallback() {
+ @Override
+ public void onScreenTurnedOn() {
+ mScreenOn = true;
+ update();
+ }
+
+ @Override
+ public void onScreenTurnedOff() {
+ mScreenOn = false;
+ update();
+ }
+
+ @Override
+ public void onKeyguardVisibilityChanged(boolean showing) {
+ update();
+ }
+
+ @Override
+ public void onBiometricRunningStateChanged(boolean running,
+ BiometricSourceType biometricSourceType) {
+ update();
+ }
+
+ @Override
+ public void onStrongAuthStateChanged(int userId) {
+ update();
+ }
+ };
+
+ @Inject
+ public LockIcon(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
+ StatusBarStateController statusBarStateController,
+ ConfigurationController configurationController,
+ AccessibilityController accessibilityController) {
super(context, attrs);
- TypedArray typedArray = context.getTheme().obtainStyledAttributes(
- attrs, new int[]{ R.attr.backgroundProtectedStyle }, 0, 0);
- mContext = new ContextThemeWrapper(context,
- typedArray.getResourceId(0, R.style.BackgroundProtectedStyle));
- typedArray.recycle();
+ mContext = context;
mUnlockMethodCache = UnlockMethodCache.getInstance(context);
+ mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
+ mAccessibilityController = accessibilityController;
+ mConfigurationController = configurationController;
+ mStatusBarStateController = statusBarStateController;
+ onThemeChanged();
+ }
+
+ @Override
+ protected void onAttachedToWindow() {
+ super.onAttachedToWindow();
+ mStatusBarStateController.addCallback(this);
+ mConfigurationController.addCallback(this);
+ mKeyguardUpdateMonitor.registerCallback(mUpdateMonitorCallback);
+ mUnlockMethodCache.addListener(this);
+ }
+
+ @Override
+ protected void onDetachedFromWindow() {
+ super.onDetachedFromWindow();
+ mStatusBarStateController.removeCallback(this);
+ mConfigurationController.removeCallback(this);
+ mKeyguardUpdateMonitor.removeCallback(mUpdateMonitorCallback);
+ mUnlockMethodCache.removeListener(this);
+ }
+
+ @Override
+ public void onThemeChanged() {
+ TypedArray typedArray = mContext.getTheme().obtainStyledAttributes(
+ null, new int[]{ R.attr.wallpaperTextColor }, 0, 0);
+ mIconColor = typedArray.getColor(0, Color.WHITE);
+ typedArray.recycle();
+ updateDarkTint();
}
@Override
@@ -88,11 +166,6 @@
update();
}
- public void setScreenOn(boolean screenOn) {
- mScreenOn = screenOn;
- update();
- }
-
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
@@ -164,7 +237,7 @@
mLastBouncerVisible = mBouncerVisible;
}
- setVisibility(mDozing && !mPulsing ? GONE : VISIBLE);
+ setVisibility(mDozing && !mPulsing ? INVISIBLE : VISIBLE);
updateClickability();
}
@@ -185,9 +258,8 @@
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
- KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
- boolean fingerprintRunning = updateMonitor.isFingerprintDetectionRunning();
- boolean unlockingAllowed = updateMonitor.isUnlockingWithBiometricAllowed();
+ boolean fingerprintRunning = mKeyguardUpdateMonitor.isFingerprintDetectionRunning();
+ boolean unlockingAllowed = mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed();
if (fingerprintRunning && unlockingAllowed) {
AccessibilityNodeInfo.AccessibilityAction unlock
= new AccessibilityNodeInfo.AccessibilityAction(
@@ -204,10 +276,6 @@
}
}
- public void setAccessibilityController(AccessibilityController accessibilityController) {
- mAccessibilityController = accessibilityController;
- }
-
private Drawable getIconForState(int state) {
int iconRes;
switch (state) {
@@ -273,17 +341,17 @@
}
}
- public void setDarkAmount(float darkAmount) {
- mDarkAmount = darkAmount;
+ @Override
+ public void onDozeAmountChanged(float linear, float eased) {
+ mDozeAmount = eased;
updateDarkTint();
}
/**
* When keyguard is in pulsing (AOD2) state.
* @param pulsing {@code true} when pulsing.
- * @param animated if transition should be animated.
*/
- public void setPulsing(boolean pulsing, boolean animated) {
+ public void setPulsing(boolean pulsing) {
mPulsing = pulsing;
update();
}
@@ -291,15 +359,15 @@
/**
* Sets the dozing state of the keyguard.
*/
- public void setDozing(boolean dozing) {
+ @Override
+ public void onDozingChanged(boolean dozing) {
mDozing = dozing;
update();
}
private void updateDarkTint() {
- Drawable drawable = getDrawable().mutate();
- int color = ColorUtils.blendARGB(Color.TRANSPARENT, Color.WHITE, mDarkAmount);
- drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
+ int color = ColorUtils.blendARGB(mIconColor, Color.WHITE, mDozeAmount);
+ setImageTintList(ColorStateList.valueOf(color));
}
/**
@@ -312,4 +380,27 @@
mBouncerVisible = bouncerVisible;
update();
}
+
+ @Override
+ public void onDensityOrFontScaleChanged() {
+ ViewGroup.LayoutParams lp = getLayoutParams();
+ if (lp == null) {
+ return;
+ }
+ lp.width = getResources().getDimensionPixelSize(R.dimen.keyguard_lock_width);
+ lp.height = getResources().getDimensionPixelSize(R.dimen.keyguard_lock_height);
+ setLayoutParams(lp);
+ update(true /* force */);
+ }
+
+ @Override
+ public void onLocaleListChanged() {
+ setContentDescription(getContext().getText(R.string.accessibility_unlock_button));
+ update(true /* force */);
+ }
+
+ @Override
+ public void onUnlockMethodStateChanged() {
+ update();
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index ab13149..57b2ee9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -204,7 +204,6 @@
private ValueAnimator mQsExpansionAnimator;
private FlingAnimationUtils mFlingAnimationUtils;
private int mStatusBarMinHeight;
- private boolean mUnlockIconActive;
private int mNotificationsHeaderCollideDistance;
private int mUnlockMoveDistance;
private float mEmptyDragAmount;
@@ -330,7 +329,6 @@
private final ShadeController mShadeController =
Dependency.get(ShadeController.class);
private int mDisplayId;
- private KeyguardBouncer mBouncer;
/**
* Cache the resource id of the theme to avoid unnecessary work in onThemeChanged.
@@ -640,7 +638,6 @@
mKeyguardStatusView.getHeight(),
clockPreferredY,
mInterpolatedDarkAmount,
- mStatusBar.isKeyguardCurrentlySecure(),
mEmptyDragAmount);
mClockPositionAlgorithm.run(mClockPositionResult);
PropertyAnimator.setProperty(mKeyguardStatusView, AnimatableProperty.X,
@@ -736,7 +733,6 @@
public void resetViews(boolean animate) {
mIsLaunchTransitionFinished = false;
mBlockTouches = false;
- mUnlockIconActive = false;
if (!mLaunchingAffordance) {
mAffordanceHelper.reset(false);
mLastCameraLaunchSource = KeyguardBottomAreaView.CAMERA_LAUNCH_SOURCE_AFFORDANCE;
@@ -1518,6 +1514,10 @@
mStatusBar.executeRunnableDismissingKeyguard(null, null /* cancelAction */,
false /* dismissShade */, true /* afterKeyguardGone */, false /* deferred */);
}
+ if (mExpansionListener != null) {
+ mExpansionListener.onQsExpansionChanged(mQsMaxExpansionHeight != 0
+ ? mQsExpansionHeight / mQsMaxExpansionHeight : 0);
+ }
if (DEBUG) {
invalidate();
}
@@ -1837,6 +1837,9 @@
!mHeadsUpManager.hasPinnedHeadsUp()) {
alpha = getFadeoutAlpha();
}
+ if (mBarState == StatusBarState.KEYGUARD && !mHintAnimationRunning) {
+ alpha *= mClockPositionResult.clockAlpha;
+ }
mNotificationStackScroller.setAlpha(alpha);
}
@@ -2292,11 +2295,6 @@
}
@Override
- public KeyguardAffordanceView getCenterIcon() {
- return mKeyguardBottomArea.getLockIcon();
- }
-
- @Override
public KeyguardAffordanceView getRightIcon() {
return getLayoutDirection() == LAYOUT_DIRECTION_RTL
? mKeyguardBottomArea.getLeftView()
@@ -2723,7 +2721,6 @@
private void setLaunchingAffordance(boolean launchingAffordance) {
getLeftIcon().setLaunchingAffordance(launchingAffordance);
getRightIcon().setLaunchingAffordance(launchingAffordance);
- getCenterIcon().setLaunchingAffordance(launchingAffordance);
}
/**
@@ -2872,7 +2869,6 @@
}
mNotificationStackScroller.setPulsing(pulsing, animatePulse);
mKeyguardStatusView.setPulsing(pulsing);
- mKeyguardBottomArea.setPulsing(pulsing, animatePulse);
}
public void setAmbientIndicationBottomPadding(int ambientIndicationBottomPadding) {
@@ -2910,10 +2906,6 @@
mKeyguardBottomArea.setUserSetupComplete(userSetupComplete);
}
- public LockIcon getLockIcon() {
- return mKeyguardBottomArea.getLockIcon();
- }
-
public void applyExpandAnimationParams(ExpandAnimationParameters params) {
mExpandOffset = params != null ? params.getTopChange() : 0;
updateQsExpansion();
@@ -2957,7 +2949,6 @@
public void onBouncerPreHideAnimation() {
setKeyguardStatusViewVisibility(mBarState, true /* keyguardFadingAway */,
false /* goingToFullShade */);
- updateLockIcon();
}
/**
@@ -3056,71 +3047,29 @@
mKeyguardBottomArea.showTransientIndication(id);
}
- /**
- * Sets the reference to the {@link KeyguardBouncer}.
- */
- public void setBouncer(KeyguardBouncer bouncer) {
- mBouncer = bouncer;
- updateLockIcon();
- }
-
- public void updateLockIcon() {
- if (mBouncer == null) {
- return;
- }
-
- ViewGroup bouncerContainer = mBouncer.getLockIconContainer();
- ViewGroup bottomContainer = mKeyguardBottomArea.getLockIconContainer();
- LockIcon lockIcon = mKeyguardBottomArea.getLockIcon();
-
- if (mBouncer.isAnimatingAway()) {
- if (!lockIcon.isAnimatingAlpha() && lockIcon.getAlpha() != 0) {
- lockIcon.setImageAlpha(0, true /* animate */);
- }
- // Let's not re-apply the translation if the bouncer is animating, its
- // animation also includes translation and transition would be jarring.
- return;
- }
-
- // Lock icon needs to be re-parented in case of a scrimmed bouncer,
- // otherwise it would be under the scrim.
- if (mBouncer.isScrimmed() && bouncerContainer != null
- && lockIcon.getParent() != bouncerContainer) {
- ((ViewGroup) lockIcon.getParent()).removeView(lockIcon);
- bouncerContainer.addView(lockIcon);
- } else if (!mBouncer.isScrimmed() && bottomContainer != null
- && lockIcon.getParent() != bottomContainer) {
- ((ViewGroup) lockIcon.getParent()).removeView(lockIcon);
- bottomContainer.addView(lockIcon);
- }
-
- float translation = 0;
- if (bouncerContainer != null && bottomContainer != null && !mBouncer.isScrimmed()) {
- float bottomAreaContainerY = getCommonTop(bottomContainer);
- float bouncerLockY = getCommonTop(bouncerContainer);
- if (bouncerLockY < bottomAreaContainerY) {
- translation = bouncerLockY - bottomAreaContainerY;
- }
- }
- lockIcon.setTranslationY(translation);
-
- if (lockIcon.getAlpha() != 1) {
- lockIcon.setImageAlpha(1, false /* animate */);
- }
- }
-
- private static float getCommonTop(View view) {
- float y = view.getTop();
- ViewGroup parent = (ViewGroup) view.getParent();
- while (!(parent instanceof StatusBarWindowView) && parent != null) {
- y += parent.getY();
- parent = (ViewGroup) parent.getParent();
- }
- return y;
- }
-
@Override
public void onDynamicPrivacyChanged() {
mAnimateNextPositionUpdate = true;
}
+
+ /**
+ * Panel and QS expansion callbacks.
+ */
+ public interface PanelExpansionListener {
+ /**
+ * Invoked whenever the notification panel expansion changes, at every animation frame.
+ * This is the main expansion that happens when the user is swiping up to dismiss the
+ * lock screen.
+ *
+ * @param expansion 0 when collapsed, 1 when expanded.
+ * @param tracking {@code true} when the user is actively dragging the panel.
+ */
+ void onPanelExpansionChanged(float expansion, boolean tracking);
+
+ /**
+ * Invoked whenever the QS expansion changes, at every animation frame.
+ * @param expansion 0 when collapsed, 1 when expanded.
+ */
+ void onQsExpansionChanged(float expansion);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 99345d2..24389f2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -49,11 +49,11 @@
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.VibratorHelper;
+import com.android.systemui.statusbar.phone.NotificationPanelView.PanelExpansionListener;
import com.android.systemui.statusbar.policy.KeyguardMonitor;
import java.io.FileDescriptor;
import java.io.PrintWriter;
-import java.util.function.BiConsumer;
public abstract class PanelView extends FrameLayout {
public static final boolean DEBUG = PanelBar.DEBUG;
@@ -68,7 +68,7 @@
private boolean mVibrateOnOpening;
protected boolean mLaunchingNotification;
private int mFixedDuration = NO_FIXED_DURATION;
- private BiConsumer<Float, Boolean> mExpansionListener;
+ protected PanelExpansionListener mExpansionListener;
private final void logf(String fmt, Object... args) {
Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
@@ -1115,7 +1115,6 @@
View[] viewsToAnimate = {
mKeyguardBottomArea.getIndicationArea(),
- mKeyguardBottomArea.getLockIcon(),
mStatusBar.getAmbientIndicationContainer()};
for (View v : viewsToAnimate) {
if (v == null) {
@@ -1163,28 +1162,25 @@
private ValueAnimator createHeightAnimator(float targetHeight) {
ValueAnimator animator = ValueAnimator.ofFloat(mExpandedHeight, targetHeight);
- animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
- setExpandedHeightInternal((Float) animation.getAnimatedValue());
- }
- });
+ animator.addUpdateListener(
+ animation -> setExpandedHeightInternal((float) animation.getAnimatedValue()));
return animator;
}
protected void notifyBarPanelExpansionChanged() {
+ float fraction = mInstantExpanding ? 1 : mExpandedFraction;
if (mBar != null) {
- mBar.panelExpansionChanged(mExpandedFraction, mExpandedFraction > 0f
+ mBar.panelExpansionChanged(fraction, fraction > 0f
|| mPeekAnimator != null || mInstantExpanding
|| isPanelVisibleBecauseOfHeadsUp() || mTracking || mHeightAnimator != null);
}
if (mExpansionListener != null) {
- mExpansionListener.accept(mExpandedFraction, mTracking);
+ mExpansionListener.onPanelExpansionChanged(fraction, mTracking);
}
}
- public void setExpansionListener(BiConsumer<Float, Boolean> consumer) {
- mExpansionListener = consumer;
+ public void setExpansionListener(PanelExpansionListener panelExpansionListener) {
+ mExpansionListener = panelExpansionListener;
}
protected abstract boolean isPanelVisibleBecauseOfHeadsUp();
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 9fccf91..2c9a4c5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -879,7 +879,7 @@
mKeyguardIndicationController =
SystemUIFactory.getInstance().createKeyguardIndicationController(mContext,
mStatusBarWindow.findViewById(R.id.keyguard_indication_area),
- mNotificationPanel.getLockIcon());
+ mStatusBarWindow.findViewById(R.id.lock_icon));
mNotificationPanel.setKeyguardIndicationController(mKeyguardIndicationController);
mAmbientIndicationContainer = mStatusBarWindow.findViewById(
@@ -1171,7 +1171,7 @@
mKeyguardIndicationController =
SystemUIFactory.getInstance().createKeyguardIndicationController(mContext,
mStatusBarWindow.findViewById(R.id.keyguard_indication_area),
- mNotificationPanel.getLockIcon());
+ mStatusBarWindow.findViewById(R.id.lock_icon));
mNotificationPanel.setKeyguardIndicationController(mKeyguardIndicationController);
mKeyguardIndicationController
.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
@@ -1222,7 +1222,8 @@
mScrimController, this, UnlockMethodCache.getInstance(mContext),
new Handler(), mKeyguardUpdateMonitor, Dependency.get(TunerService.class));
mStatusBarKeyguardViewManager = keyguardViewMediator.registerStatusBar(this,
- getBouncerContainer(), mNotificationPanel, mBiometricUnlockController);
+ getBouncerContainer(), mNotificationPanel, mBiometricUnlockController,
+ mStatusBarWindow.findViewById(R.id.lock_icon_container));
mKeyguardIndicationController
.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mBiometricUnlockController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
@@ -1231,7 +1232,6 @@
mKeyguardViewMediatorCallback = keyguardViewMediator.getViewMediatorCallback();
mLightBarController.setBiometricUnlockController(mBiometricUnlockController);
mMediaManager.setBiometricUnlockController(mBiometricUnlockController);
- mNotificationPanel.setBouncer(mStatusBarKeyguardViewManager.getBouncer());
Dependency.get(KeyguardDismissUtil.class).setDismissHandler(this::executeWhenUnlocked);
Trace.endSection();
}
@@ -3947,6 +3947,7 @@
mKeyguardViewMediator.setPulsing(pulsing);
mNotificationPanel.setPulsing(pulsing);
mVisualStabilityManager.setPulsing(pulsing);
+ mStatusBarWindow.setPulsing(pulsing);
mIgnoreTouchWhilePulsing = false;
if (mKeyguardUpdateMonitor != null && passiveAuthInterrupt) {
mKeyguardUpdateMonitor.onAuthInterruptDetected(pulsing /* active */);
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 e3cc3d4..09fa9ca 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -25,6 +25,8 @@
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.os.SystemClock;
+import android.transition.Fade;
+import android.transition.TransitionManager;
import android.util.StatsLog;
import android.view.KeyEvent;
import android.view.View;
@@ -32,14 +34,16 @@
import android.view.ViewRootImpl;
import android.view.WindowManagerGlobal;
-import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.LatencyTracker;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.keyguard.ViewMediatorCallback;
+import com.android.settingslib.animation.AppearAnimationUtils;
+import com.android.settingslib.animation.DisappearAnimationUtils;
import com.android.systemui.DejankUtils;
import com.android.systemui.Dependency;
+import com.android.systemui.Interpolators;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.dock.DockManager;
@@ -49,6 +53,7 @@
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.RemoteInputController;
+import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -65,7 +70,8 @@
* {@link com.android.keyguard.KeyguardViewBase}.
*/
public class StatusBarKeyguardViewManager implements RemoteInputController.Callback,
- StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener {
+ StatusBarStateController.StateListener, ConfigurationController.ConfigurationListener,
+ NotificationPanelView.PanelExpansionListener {
// When hiding the Keyguard with timing supplied from WindowManager, better be early than late.
private static final long HIDE_TIMING_CORRECTION_MS = - 16 * 3;
@@ -90,7 +96,7 @@
public void onFullyShown() {
updateStates();
mStatusBar.wakeUpIfDozing(SystemClock.uptimeMillis(), mContainer, "BOUNCER_VISIBLE");
- mNotificationPanelView.updateLockIcon();
+ updateLockIcon();
}
@Override
@@ -99,14 +105,14 @@
}
@Override
- public void onFullyHidden() {
- updateStates();
- mNotificationPanelView.updateLockIcon();
+ public void onStartingToShow() {
+ updateLockIcon();
}
@Override
- public void onLayout() {
- mNotificationPanelView.updateLockIcon();
+ public void onFullyHidden() {
+ updateStates();
+ updateLockIcon();
}
};
private final DockManager.DockEventListener mDockEventListener =
@@ -129,6 +135,7 @@
private BiometricUnlockController mBiometricUnlockController;
private ViewGroup mContainer;
+ private ViewGroup mLockIconContainer;
protected KeyguardBouncer mBouncer;
protected boolean mShowing;
@@ -151,6 +158,7 @@
private boolean mLastPulsing;
private int mLastBiometricMode;
private boolean mGoingToSleepVisibleNotOccluded;
+ private int mLastLockVisibility = -1;
private OnDismissAction mAfterKeyguardGoneAction;
private final ArrayList<Runnable> mAfterKeyguardGoneRunnables = new ArrayList<>();
@@ -161,6 +169,8 @@
(KeyguardMonitorImpl) Dependency.get(KeyguardMonitor.class);
private final NotificationMediaManager mMediaManager =
Dependency.get(NotificationMediaManager.class);
+ private final StatusBarStateController mStatusBarStateController =
+ Dependency.get(StatusBarStateController.class);
private final DockManager mDockManager;
private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
@@ -184,7 +194,7 @@
mStatusBarWindowController = Dependency.get(StatusBarWindowController.class);
mGesturalNav = QuickStepContract.isGesturalMode(context);
KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateMonitorCallback);
- Dependency.get(StatusBarStateController.class).addCallback(this);
+ mStatusBarStateController.addCallback(this);
Dependency.get(ConfigurationController.class).addCallback(this);
mDockManager = SysUiServiceProvider.getComponent(context, DockManager.class);
if (mDockManager != null) {
@@ -197,19 +207,21 @@
ViewGroup container,
NotificationPanelView notificationPanelView,
BiometricUnlockController biometricUnlockController,
- DismissCallbackRegistry dismissCallbackRegistry) {
+ DismissCallbackRegistry dismissCallbackRegistry,
+ ViewGroup lockIconContainer) {
mStatusBar = statusBar;
mContainer = container;
+ mLockIconContainer = lockIconContainer;
mBiometricUnlockController = biometricUnlockController;
mBouncer = SystemUIFactory.getInstance().createKeyguardBouncer(mContext,
mViewMediatorCallback, mLockPatternUtils, container, dismissCallbackRegistry,
mExpansionCallback);
mNotificationPanelView = notificationPanelView;
- notificationPanelView.setExpansionListener(this::onPanelExpansionChanged);
+ notificationPanelView.setExpansionListener(this);
}
- @VisibleForTesting
- void onPanelExpansionChanged(float expansion, boolean tracking) {
+ @Override
+ public void onPanelExpansionChanged(float expansion, boolean tracking) {
// We don't want to translate the bounce when:
// • Keyguard is occluded, because we're in a FLAG_SHOW_WHEN_LOCKED activity and need to
// conserve the original animation.
@@ -230,7 +242,32 @@
mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */);
}
}
- mNotificationPanelView.updateLockIcon();
+ }
+
+ @Override
+ public void onQsExpansionChanged(float expansion) {
+ updateLockIcon();
+ }
+
+ private void updateLockIcon() {
+ boolean keyguardWithoutQs = mStatusBarStateController.getState() == StatusBarState.KEYGUARD
+ && !mNotificationPanelView.isQsExpanded();
+ int lockVisibility = (mBouncer.isShowing() || keyguardWithoutQs)
+ && !mBouncer.isAnimatingAway() ? View.VISIBLE : View.INVISIBLE;
+
+ if (mLastLockVisibility != lockVisibility) {
+ mLastLockVisibility = lockVisibility;
+
+ Fade transition = new Fade();
+ boolean appearing = lockVisibility == View.VISIBLE;
+ transition.setDuration(appearing ? AppearAnimationUtils.DEFAULT_APPEAR_DURATION
+ : DisappearAnimationUtils.DEFAULT_APPEAR_DURATION / 2);
+ transition.setInterpolator(appearing ? Interpolators.ALPHA_IN
+ : Interpolators.ALPHA_OUT);
+ TransitionManager.beginDelayedTransition((ViewGroup) mLockIconContainer.getParent(),
+ transition);
+ mLockIconContainer.setVisibility(lockVisibility);
+ }
}
/**
@@ -463,6 +500,7 @@
finishRunnable.run();
}
mNotificationPanelView.blockExpansionForCurrentTouch();
+ updateLockIcon();
}
/**
@@ -849,7 +887,7 @@
@Override
public void onStateChanged(int newState) {
- // Nothing
+ updateLockIcon();
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
index 9609057..28db28c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java
@@ -87,6 +87,7 @@
private NotificationStackScrollLayout mStackScrollLayout;
private NotificationPanelView mNotificationPanel;
private View mBrightnessMirror;
+ private LockIcon mLockIcon;
private PhoneStatusBarView mStatusBarView;
private int mRightInset = 0;
@@ -241,10 +242,10 @@
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- mStackScrollLayout = (NotificationStackScrollLayout) findViewById(
- R.id.notification_stack_scroller);
- mNotificationPanel = (NotificationPanelView) findViewById(R.id.notification_panel);
+ mStackScrollLayout = findViewById(R.id.notification_stack_scroller);
+ mNotificationPanel = findViewById(R.id.notification_panel);
mBrightnessMirror = findViewById(R.id.brightness_mirror);
+ mLockIcon = findViewById(R.id.lock_icon);
}
@Override
@@ -255,6 +256,13 @@
}
}
+ /**
+ * Propagate {@link StatusBar} pulsing state.
+ */
+ public void setPulsing(boolean pulsing) {
+ mLockIcon.setPulsing(pulsing);
+ }
+
public void setStatusBarView(PhoneStatusBarView statusBarView) {
mStatusBarView = statusBarView;
}
diff --git a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
index 376c328..1e486c0 100644
--- a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
+++ b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java
@@ -24,12 +24,14 @@
import android.view.View;
import com.android.keyguard.KeyguardClockSwitch;
+import com.android.keyguard.KeyguardMessageArea;
import com.android.keyguard.KeyguardSliceView;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.qs.QSCarrierGroup;
import com.android.systemui.qs.QSFooterImpl;
import com.android.systemui.qs.QuickStatusBarHeader;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
+import com.android.systemui.statusbar.phone.LockIcon;
import com.android.systemui.statusbar.phone.NotificationPanelView;
import java.lang.reflect.InvocationTargetException;
@@ -142,6 +144,16 @@
* Creates the KeyguardSliceView.
*/
KeyguardSliceView createKeyguardSliceView();
+
+ /**
+ * Creates the KeyguardMessageArea.
+ */
+ KeyguardMessageArea createKeyguardMessageArea();
+
+ /**
+ * Creates the keyguard LockIcon.
+ */
+ LockIcon createLockIcon();
}
/**