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

Commit dc05aa04 authored by Zachary Iqbal's avatar Zachary Iqbal
Browse files

Added indication text stubs for changes to trust being managed.

Notes:
- Subclasses of KeyguardIndicationController can now provide indication text
to be displayed when a trust agent is managed.

Test: runtest sysui
Bug: 38397982
Change-Id: I1b7ee3041aceae94d12da25608f8e7b2e9ebbbe2
parent a4b4ebfb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1195,6 +1195,9 @@
    <!-- 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 a trust agent is active and available. [CHAR LIMIT=40] -->
    <string name="keyguard_indication_trust_managed"><xliff:g id="trust_agent" example="Smart Lock">%1$s</xliff:g> is running</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>

+19 −6
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.systemui.statusbar;

import android.app.ActivityManager;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -207,7 +206,16 @@ public class KeyguardIndicationController {
     *
     * @return {@code null} or an empty string if a trust indication text should not be shown.
     */
    protected String getTrustIndication() {
    protected String getTrustGrantedIndication() {
        return null;
    }

    /**
     * Returns the indication text indicating that trust is currently being managed.
     *
     * @return {@code null} or an empty string if a trust managed text should not be shown.
     */
    protected String getTrustManagedIndication() {
        return null;
    }

@@ -281,16 +289,17 @@ public class KeyguardIndicationController {

            KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
            int userId = KeyguardUpdateMonitor.getCurrentUser();
            String trustIndication = getTrustIndication();
            String trustGrantedIndication = getTrustGrantedIndication();
            String trustManagedIndication = getTrustManagedIndication();
            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)
            } else if (!TextUtils.isEmpty(trustGrantedIndication)
                    && updateMonitor.getUserHasTrust(userId)) {
                mTextView.switchIndication(trustIndication);
                mTextView.switchIndication(trustGrantedIndication);
                mTextView.setTextColor(Color.WHITE);
            } else if (mPowerPluggedIn) {
                String indication = computePowerIndication();
@@ -299,7 +308,11 @@ public class KeyguardIndicationController {
                }
                mTextView.switchIndication(indication);
                mTextView.setTextColor(Color.WHITE);

            } else if (!TextUtils.isEmpty(trustManagedIndication)
                    && updateMonitor.getUserTrustIsManaged(userId)
                    && !updateMonitor.getUserHasTrust(userId)) {
                mTextView.switchIndication(trustManagedIndication);
                mTextView.setTextColor(Color.WHITE);
            } else {
                mTextView.switchIndication(mRestingIndication);
                mTextView.setTextColor(Color.WHITE);