Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f4c2426 authored by Zachary Iqbal's avatar Zachary Iqbal
Browse files

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
parent 329b258c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1192,6 +1192,9 @@
        <xliff:g id="application_personal">%3$s</xliff:g>, which can monitor your personal network
        activity.</string>

    <!-- Indication on the keyguard that appears when a trust agents unlocks the device. [CHAR LIMIT=40] -->
    <string name="keyguard_indication_trust_granted">Unlocked for <xliff:g id="user_name" example="John Doe">%1$s</xliff:g></string>

    <!-- Indication on the keyguard that appears when the user disables trust agents until the next time they unlock manually. [CHAR LIMIT=NONE] -->
    <string name="keyguard_indication_trust_disabled">Device will stay locked until you manually unlock</string>

+22 −8
Original line number Diff line number Diff line
@@ -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) {