diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 473796a6b6505..dcec07d091b19 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -1756,6 +1756,10 @@ Try again Try again + + + Unlock for all features and data + Maximum Face Unlock attempts exceeded diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 516aa18f86518..2a40c0836ae55 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2646,6 +2646,8 @@ + + diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index bd485dd40e0b9..6d73ccb21823c 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.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() { diff --git a/services/core/java/com/android/server/LockSettingsService.java b/services/core/java/com/android/server/LockSettingsService.java index 33c2ea28d7d16..2de09a39f6ab1 100644 --- a/services/core/java/com/android/server/LockSettingsService.java +++ b/services/core/java/com/android/server/LockSettingsService.java @@ -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());