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
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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.Message;
|
||||
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 @@ public class KeyguardIndicationController {
|
||||
|
||||
private final Context mContext;
|
||||
private final KeyguardIndicationTextView mTextView;
|
||||
private final UserManager mUserManager;
|
||||
private final IBatteryStats mBatteryInfo;
|
||||
|
||||
private final int mSlowThreshold;
|
||||
@@ -85,9 +88,10 @@ public class KeyguardIndicationController {
|
||||
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 @@ public class KeyguardIndicationController {
|
||||
|
||||
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() {
|
||||
|
||||
@@ -304,7 +304,9 @@ public class LockSettingsService extends ILockSettings.Stub {
|
||||
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 @@ public class LockSettingsService extends ILockSettings.Stub {
|
||||
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());
|
||||
|
||||
Reference in New Issue
Block a user