Polish around locked user communication.
Based on user feedback, using a notification to communicate that a
user was locked was confusing. Instead, this CL moves to showing a
message in the keyguard indicator slot at the bottom of the screen,
which is where we communicate other information such as charging
status.
Since a locked user is a very limiting experience, this new message
takes precedence over any other indicator message.
Bug: 28942360
Change-Id: I708d2b4b41079d09d46c17365c750488204e3090
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 473796a..dcec07d 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -1756,6 +1756,10 @@
<string name="lockscreen_pattern_wrong">Try again</string>
<!-- On the unlock password screen, shown when the user enters the wrong lock password and must try again. -->
<string name="lockscreen_password_wrong">Try again</string>
+
+ <!-- On the keyguard screen, this string explains that some features or data may not be available until the device is unlocked. [CHAR LIMIT=48] -->
+ <string name="lockscreen_storage_locked">Unlock for all features and data</string>
+
<!-- Shown when face unlock failed multiple times so we're just using the backup -->
<string name="faceunlock_multiple_failures">Maximum Face Unlock attempts exceeded</string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 516aa18..2a40c08 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2646,6 +2646,8 @@
<!-- Colon separated list of package names that should be granted DND access -->
<java-symbol type="string" name="config_defaultDndAccessPackages" />
+ <java-symbol type="string" name="lockscreen_storage_locked" />
+
<!-- Used for MimeIconUtils. -->
<java-symbol type="drawable" name="ic_doc_apk" />
<java-symbol type="drawable" name="ic_doc_audio" />
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
index bd485dd..6d73ccb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar;
+import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -30,6 +31,7 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
+import android.os.UserManager;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.util.Log;
@@ -57,6 +59,7 @@
private final Context mContext;
private final KeyguardIndicationTextView mTextView;
+ private final UserManager mUserManager;
private final IBatteryStats mBatteryInfo;
private final int mSlowThreshold;
@@ -85,9 +88,10 @@
mSlowThreshold = res.getInteger(R.integer.config_chargingSlowlyThreshold);
mFastThreshold = res.getInteger(R.integer.config_chargingFastThreshold);
-
+ mUserManager = context.getSystemService(UserManager.class);
mBatteryInfo = IBatteryStats.Stub.asInterface(
ServiceManager.getService(BatteryStats.SERVICE_NAME));
+
KeyguardUpdateMonitor.getInstance(context).registerCallback(mUpdateMonitor);
context.registerReceiverAsUser(mReceiver, UserHandle.SYSTEM,
new IntentFilter(Intent.ACTION_TIME_TICK), null, null);
@@ -155,30 +159,29 @@
private void updateIndication() {
if (mVisible) {
- mTextView.switchIndication(computeIndication());
- mTextView.setTextColor(computeColor());
- }
- }
+ // Walk down a precedence-ordered list of what should indication
+ // should be shown based on user or device state
+ if (!mUserManager.isUserUnlocked(ActivityManager.getCurrentUser())) {
+ mTextView.switchIndication(com.android.internal.R.string.lockscreen_storage_locked);
+ mTextView.setTextColor(Color.WHITE);
- private int computeColor() {
- if (!TextUtils.isEmpty(mTransientIndication)) {
- return mTransientTextColor;
- }
- return Color.WHITE;
- }
+ } else if (!TextUtils.isEmpty(mTransientIndication)) {
+ mTextView.switchIndication(mTransientIndication);
+ mTextView.setTextColor(mTransientTextColor);
- private String computeIndication() {
- if (!TextUtils.isEmpty(mTransientIndication)) {
- return mTransientIndication;
- }
- if (mPowerPluggedIn) {
- String indication = computePowerIndication();
- if (DEBUG_CHARGING_SPEED) {
- indication += ", " + (mChargingWattage / 1000) + " mW";
+ } else if (mPowerPluggedIn) {
+ String indication = computePowerIndication();
+ if (DEBUG_CHARGING_SPEED) {
+ indication += ", " + (mChargingWattage / 1000) + " mW";
+ }
+ mTextView.switchIndication(indication);
+ mTextView.setTextColor(Color.WHITE);
+
+ } else {
+ mTextView.switchIndication(mRestingIndication);
+ mTextView.setTextColor(Color.WHITE);
}
- return indication;
}
- return mRestingIndication;
}
private String computePowerIndication() {
diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java
index 33c2ea2..2de09a3 100644
--- a/services/core/java/com/android/server/LockSettingsService.java
+++ b/services/core/java/com/android/server/LockSettingsService.java
@@ -304,7 +304,9 @@
final boolean isSecure = mStorage.hasPassword(user.id) || mStorage.hasPattern(user.id);
if (isSecure && !mUserManager.isUserUnlockingOrUnlocked(userHandle)) {
if (!user.isManagedProfile()) {
- showEncryptionNotification(userHandle);
+ // When the user is locked, we communicate it loud-and-clear
+ // on the lockscreen; we only show a notification below for
+ // locked managed profiles.
} else {
UserInfo parent = mUserManager.getProfileParent(user.id);
if (parent != null &&
@@ -340,21 +342,6 @@
showEncryptionNotification(user, title, message, detail, intent);
}
- private void showEncryptionNotification(UserHandle user) {
- Resources r = mContext.getResources();
- CharSequence title = r.getText(
- com.android.internal.R.string.user_encrypted_title);
- CharSequence message = r.getText(
- com.android.internal.R.string.user_encrypted_message);
- CharSequence detail = r.getText(
- com.android.internal.R.string.user_encrypted_detail);
-
- PendingIntent intent = PendingIntent.getActivity(mContext, 0, ACTION_NULL,
- PendingIntent.FLAG_UPDATE_CURRENT);
-
- showEncryptionNotification(user, title, message, detail, intent);
- }
-
private void showEncryptionNotification(UserHandle user, CharSequence title, CharSequence message,
CharSequence detail, PendingIntent intent) {
if (DEBUG) Slog.v(TAG, "showing encryption notification, user: " + user.getIdentifier());