Reload state when user unlocks
Test: Unlock freshly booted non-FBE device, make sure the transition is fast as well as the icons have the correct state Change-Id: I6427427d16edeceb0f410be0b88de601a3dffdb4 Fixes: 31203310
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.keyguard;
|
package com.android.keyguard;
|
||||||
|
|
||||||
|
import static android.content.Intent.ACTION_USER_UNLOCKED;
|
||||||
import static android.os.BatteryManager.BATTERY_HEALTH_UNKNOWN;
|
import static android.os.BatteryManager.BATTERY_HEALTH_UNKNOWN;
|
||||||
import static android.os.BatteryManager.BATTERY_STATUS_FULL;
|
import static android.os.BatteryManager.BATTERY_STATUS_FULL;
|
||||||
import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
|
import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
|
||||||
@@ -136,6 +137,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
private static final int MSG_SCREEN_TURNED_ON = 331;
|
private static final int MSG_SCREEN_TURNED_ON = 331;
|
||||||
private static final int MSG_SCREEN_TURNED_OFF = 332;
|
private static final int MSG_SCREEN_TURNED_OFF = 332;
|
||||||
private static final int MSG_DREAMING_STATE_CHANGED = 333;
|
private static final int MSG_DREAMING_STATE_CHANGED = 333;
|
||||||
|
private static final int MSG_USER_UNLOCKED = 334;
|
||||||
|
|
||||||
/** Fingerprint state: Not listening to fingerprint. */
|
/** Fingerprint state: Not listening to fingerprint. */
|
||||||
private static final int FINGERPRINT_STATE_STOPPED = 0;
|
private static final int FINGERPRINT_STATE_STOPPED = 0;
|
||||||
@@ -291,6 +293,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
case MSG_DREAMING_STATE_CHANGED:
|
case MSG_DREAMING_STATE_CHANGED:
|
||||||
handleDreamingStateChanged(msg.arg1);
|
handleDreamingStateChanged(msg.arg1);
|
||||||
break;
|
break;
|
||||||
|
case MSG_USER_UNLOCKED:
|
||||||
|
handleUserUnlocked();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -723,6 +728,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
} else if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED
|
} else if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED
|
||||||
.equals(action)) {
|
.equals(action)) {
|
||||||
mHandler.sendEmptyMessage(MSG_DPM_STATE_CHANGED);
|
mHandler.sendEmptyMessage(MSG_DPM_STATE_CHANGED);
|
||||||
|
} else if (ACTION_USER_UNLOCKED.equals(action)) {
|
||||||
|
mHandler.sendEmptyMessage(MSG_USER_UNLOCKED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1025,6 +1032,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleUserUnlocked() {
|
||||||
|
mNeedsSlowUnlockTransition = resolveNeedsSlowUnlockTransition();
|
||||||
|
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||||
|
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||||
|
if (cb != null) {
|
||||||
|
cb.onUserUnlocked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private KeyguardUpdateMonitor(Context context) {
|
private KeyguardUpdateMonitor(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSubscriptionManager = SubscriptionManager.from(context);
|
mSubscriptionManager = SubscriptionManager.from(context);
|
||||||
@@ -1065,6 +1082,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
allUserFilter.addAction(ACTION_FACE_UNLOCK_STARTED);
|
allUserFilter.addAction(ACTION_FACE_UNLOCK_STARTED);
|
||||||
allUserFilter.addAction(ACTION_FACE_UNLOCK_STOPPED);
|
allUserFilter.addAction(ACTION_FACE_UNLOCK_STOPPED);
|
||||||
allUserFilter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
|
allUserFilter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
|
||||||
|
allUserFilter.addAction(ACTION_USER_UNLOCKED);
|
||||||
context.registerReceiverAsUser(mBroadcastAllReceiver, UserHandle.ALL, allUserFilter,
|
context.registerReceiverAsUser(mBroadcastAllReceiver, UserHandle.ALL, allUserFilter,
|
||||||
null, null);
|
null, null);
|
||||||
|
|
||||||
|
|||||||
@@ -127,6 +127,11 @@ public class KeyguardUpdateMonitorCallback {
|
|||||||
*/
|
*/
|
||||||
public void onUserInfoChanged(int userId) { }
|
public void onUserInfoChanged(int userId) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a user got unlocked.
|
||||||
|
*/
|
||||||
|
public void onUserUnlocked() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when boot completed.
|
* Called when boot completed.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -95,8 +95,6 @@ public class KeyguardIndicationController {
|
|||||||
KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateMonitor);
|
KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateMonitor);
|
||||||
context.registerReceiverAsUser(mTickReceiver, UserHandle.SYSTEM,
|
context.registerReceiverAsUser(mTickReceiver, UserHandle.SYSTEM,
|
||||||
new IntentFilter(Intent.ACTION_TIME_TICK), null, null);
|
new IntentFilter(Intent.ACTION_TIME_TICK), null, null);
|
||||||
context.registerReceiverAsUser(mUnlockReceiver, UserHandle.ALL,
|
|
||||||
new IntentFilter(Intent.ACTION_USER_UNLOCKED), null, null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible) {
|
||||||
@@ -322,6 +320,13 @@ public class KeyguardIndicationController {
|
|||||||
super.onFingerprintAuthFailed();
|
super.onFingerprintAuthFailed();
|
||||||
mLastSuccessiveErrorMessage = -1;
|
mLastSuccessiveErrorMessage = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserUnlocked() {
|
||||||
|
if (mVisible) {
|
||||||
|
updateIndication();
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
BroadcastReceiver mTickReceiver = new BroadcastReceiver() {
|
BroadcastReceiver mTickReceiver = new BroadcastReceiver() {
|
||||||
@@ -333,14 +338,6 @@ public class KeyguardIndicationController {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
BroadcastReceiver mUnlockReceiver = new BroadcastReceiver() {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (mVisible) {
|
|
||||||
updateIndication();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private final Handler mHandler = new Handler() {
|
private final Handler mHandler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
private KeyguardIndicationController mIndicationController;
|
private KeyguardIndicationController mIndicationController;
|
||||||
private AccessibilityController mAccessibilityController;
|
private AccessibilityController mAccessibilityController;
|
||||||
private PhoneStatusBar mPhoneStatusBar;
|
private PhoneStatusBar mPhoneStatusBar;
|
||||||
|
private KeyguardAffordanceHelper mAffordanceHelper;
|
||||||
|
|
||||||
private boolean mUserSetupComplete;
|
private boolean mUserSetupComplete;
|
||||||
private boolean mPrewarmBound;
|
private boolean mPrewarmBound;
|
||||||
@@ -271,6 +272,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
updateCameraVisibility(); // in case onFinishInflate() was called too early
|
updateCameraVisibility(); // in case onFinishInflate() was called too early
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAffordanceHelper(KeyguardAffordanceHelper affordanceHelper) {
|
||||||
|
mAffordanceHelper = affordanceHelper;
|
||||||
|
}
|
||||||
|
|
||||||
public void setUserSetupComplete(boolean userSetupComplete) {
|
public void setUserSetupComplete(boolean userSetupComplete) {
|
||||||
mUserSetupComplete = userSetupComplete;
|
mUserSetupComplete = userSetupComplete;
|
||||||
updateCameraVisibility();
|
updateCameraVisibility();
|
||||||
@@ -601,6 +606,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
mPreviewContainer.addView(mCameraPreview);
|
mPreviewContainer.addView(mCameraPreview);
|
||||||
mCameraPreview.setVisibility(visibleBefore ? View.VISIBLE : View.INVISIBLE);
|
mCameraPreview.setVisibility(visibleBefore ? View.VISIBLE : View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
if (mAffordanceHelper != null) {
|
||||||
|
mAffordanceHelper.updatePreviews();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLeftPreview() {
|
private void updateLeftPreview() {
|
||||||
@@ -618,6 +626,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
mPreviewContainer.addView(mLeftPreview);
|
mPreviewContainer.addView(mLeftPreview);
|
||||||
mLeftPreview.setVisibility(View.INVISIBLE);
|
mLeftPreview.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
if (mAffordanceHelper != null) {
|
||||||
|
mAffordanceHelper.updatePreviews();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startFinishDozeAnimation() {
|
public void startFinishDozeAnimation() {
|
||||||
@@ -702,6 +713,13 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
public void onStrongAuthStateChanged(int userId) {
|
public void onStrongAuthStateChanged(int userId) {
|
||||||
mLockIcon.update();
|
mLockIcon.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserUnlocked() {
|
||||||
|
inflateCameraPreview();
|
||||||
|
updateCameraVisibility();
|
||||||
|
updateLeftAffordance();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public void setKeyguardIndicationController(
|
public void setKeyguardIndicationController(
|
||||||
|
|||||||
@@ -233,6 +233,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
mKeyguardBottomArea = (KeyguardBottomAreaView) findViewById(R.id.keyguard_bottom_area);
|
mKeyguardBottomArea = (KeyguardBottomAreaView) findViewById(R.id.keyguard_bottom_area);
|
||||||
mQsNavbarScrim = findViewById(R.id.qs_navbar_scrim);
|
mQsNavbarScrim = findViewById(R.id.qs_navbar_scrim);
|
||||||
mAfforanceHelper = new KeyguardAffordanceHelper(this, getContext());
|
mAfforanceHelper = new KeyguardAffordanceHelper(this, getContext());
|
||||||
|
mKeyguardBottomArea.setAffordanceHelper(mAfforanceHelper);
|
||||||
mLastOrientation = getResources().getConfiguration().orientation;
|
mLastOrientation = getResources().getConfiguration().orientation;
|
||||||
|
|
||||||
mQsAutoReinflateContainer =
|
mQsAutoReinflateContainer =
|
||||||
@@ -1016,7 +1017,6 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
mKeyguardStatusBar.setVisibility(keyguardShowing ? View.VISIBLE : View.INVISIBLE);
|
mKeyguardStatusBar.setVisibility(keyguardShowing ? View.VISIBLE : View.INVISIBLE);
|
||||||
if (keyguardShowing && oldState != mStatusBarState) {
|
if (keyguardShowing && oldState != mStatusBarState) {
|
||||||
mKeyguardBottomArea.onKeyguardShowingChanged();
|
mKeyguardBottomArea.onKeyguardShowingChanged();
|
||||||
mAfforanceHelper.updatePreviews();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keyguardShowing) {
|
if (keyguardShowing) {
|
||||||
|
|||||||
Reference in New Issue
Block a user