From 8f4c2426f69fbb54b76f11bc8f3bb763c4de374a Mon Sep 17 00:00:00 2001 From: Zachary Iqbal Date: Thu, 20 Apr 2017 17:56:42 -0700 Subject: [PATCH] Added indication text stubs for changes to trust. Notes: - Subclasses of KeyguardIndicationController can now provide indication text to be displayed when trust has been granted. Test: runtest sysui Bug: 37487319 Change-Id: I030954d51a5c3000c45e465fcd261e4887520aa6 --- packages/SystemUI/res/values/strings.xml | 3 ++ .../KeyguardIndicationController.java | 30 ++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 9097c5375e13d..8e9847575485a 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1192,6 +1192,9 @@ %3$s, which can monitor your personal network activity. + + Unlocked for %1$s + Device will stay locked until you manually unlock diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 092408961eab8..de2bdde080370 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -89,7 +89,7 @@ public class KeyguardIndicationController { private int mChargingWattage; private String mMessageToShowOnScreenOn; - private KeyguardUpdateMonitorCallback mUpdateMonitor; + private KeyguardUpdateMonitorCallback mUpdateMonitorCallback; private final DevicePolicyManager mDevicePolicyManager; private boolean mDozing; @@ -153,10 +153,10 @@ public class KeyguardIndicationController { * same instance. */ protected KeyguardUpdateMonitorCallback getKeyguardCallback() { - if (mUpdateMonitor == null) { - mUpdateMonitor = new BaseKeyguardCallback(); + if (mUpdateMonitorCallback == null) { + mUpdateMonitorCallback = new BaseKeyguardCallback(); } - return mUpdateMonitor; + return mUpdateMonitorCallback; } private void updateDisclosure() { @@ -202,6 +202,15 @@ public class KeyguardIndicationController { public void setUserInfoController(UserInfoController userInfoController) { } + /** + * Returns the indication text indicating that trust has been granted. + * + * @return {@code null} or an empty string if a trust indication text should not be shown. + */ + protected String getTrustIndication() { + return null; + } + /** * Hides transient indication in {@param delayMs}. */ @@ -250,7 +259,7 @@ public class KeyguardIndicationController { } } - private void updateIndication() { + protected final void updateIndication() { if (TextUtils.isEmpty(mTransientIndication)) { mWakeLock.setAcquired(false); } @@ -270,14 +279,19 @@ public class KeyguardIndicationController { return; } - if (!mUserManager.isUserUnlocked(ActivityManager.getCurrentUser())) { + KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext); + int userId = ActivityManager.getCurrentUser(); + String trustIndication = getTrustIndication(); + if (!mUserManager.isUserUnlocked(userId)) { mTextView.switchIndication(com.android.internal.R.string.lockscreen_storage_locked); mTextView.setTextColor(Color.WHITE); - } else if (!TextUtils.isEmpty(mTransientIndication)) { mTextView.switchIndication(mTransientIndication); mTextView.setTextColor(mTransientTextColor); - + } else if (!TextUtils.isEmpty(trustIndication) + && updateMonitor.getUserHasTrust(userId)) { + mTextView.switchIndication(trustIndication); + mTextView.setTextColor(Color.WHITE); } else if (mPowerPluggedIn) { String indication = computePowerIndication(); if (DEBUG_CHARGING_SPEED) {