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

Commit f54f571a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Remove more dead code from KeyguardUpdateMonitor" into tm-qpr-dev am:...

Merge "Remove more dead code from KeyguardUpdateMonitor" into tm-qpr-dev am: 0ad62793 am: 66b4816d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19280968



Change-Id: If5b0ebbebddd029af1d4f281e92f9ee86d273dd9
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b54822fd 66b4816d
Loading
Loading
Loading
Loading
+0 −55
Original line number Original line Diff line number Diff line
@@ -41,7 +41,6 @@ import android.app.ActivityManager;
import android.app.ActivityTaskManager;
import android.app.ActivityTaskManager;
import android.app.ActivityTaskManager.RootTaskInfo;
import android.app.ActivityTaskManager.RootTaskInfo;
import android.app.AlarmManager;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.UserSwitchObserver;
import android.app.UserSwitchObserver;
import android.app.admin.DevicePolicyManager;
import android.app.admin.DevicePolicyManager;
import android.app.trust.TrustManager;
import android.app.trust.TrustManager;
@@ -149,11 +148,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    private static final boolean DEBUG_SPEW = false;
    private static final boolean DEBUG_SPEW = false;
    private static final int BIOMETRIC_LOCKOUT_RESET_DELAY_MS = 600;
    private static final int BIOMETRIC_LOCKOUT_RESET_DELAY_MS = 600;


    private static final String ACTION_FACE_UNLOCK_STARTED
            = "com.android.facelock.FACE_UNLOCK_STARTED";
    private static final String ACTION_FACE_UNLOCK_STOPPED
            = "com.android.facelock.FACE_UNLOCK_STOPPED";

    // Callback messages
    // Callback messages
    private static final int MSG_TIME_UPDATE = 301;
    private static final int MSG_TIME_UPDATE = 301;
    private static final int MSG_BATTERY_UPDATE = 302;
    private static final int MSG_BATTERY_UPDATE = 302;
@@ -169,7 +163,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    private static final int MSG_FINISHED_GOING_TO_SLEEP = 320;
    private static final int MSG_FINISHED_GOING_TO_SLEEP = 320;
    private static final int MSG_STARTED_GOING_TO_SLEEP = 321;
    private static final int MSG_STARTED_GOING_TO_SLEEP = 321;
    private static final int MSG_KEYGUARD_BOUNCER_CHANGED = 322;
    private static final int MSG_KEYGUARD_BOUNCER_CHANGED = 322;
    private static final int MSG_FACE_UNLOCK_STATE_CHANGED = 327;
    private static final int MSG_SIM_SUBSCRIPTION_INFO_CHANGED = 328;
    private static final int MSG_SIM_SUBSCRIPTION_INFO_CHANGED = 328;
    private static final int MSG_AIRPLANE_MODE_CHANGED = 329;
    private static final int MSG_AIRPLANE_MODE_CHANGED = 329;
    private static final int MSG_SERVICE_STATE_CHANGE = 330;
    private static final int MSG_SERVICE_STATE_CHANGE = 330;
@@ -388,7 +381,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    private SparseBooleanArray mUserHasTrust = new SparseBooleanArray();
    private SparseBooleanArray mUserHasTrust = new SparseBooleanArray();
    private SparseBooleanArray mUserTrustIsManaged = new SparseBooleanArray();
    private SparseBooleanArray mUserTrustIsManaged = new SparseBooleanArray();
    private SparseBooleanArray mUserTrustIsUsuallyManaged = new SparseBooleanArray();
    private SparseBooleanArray mUserTrustIsUsuallyManaged = new SparseBooleanArray();
    private SparseBooleanArray mUserFaceUnlockRunning = new SparseBooleanArray();
    private Map<Integer, Intent> mSecondaryLockscreenRequirement = new HashMap<Integer, Intent>();
    private Map<Integer, Intent> mSecondaryLockscreenRequirement = new HashMap<Integer, Intent>();


    @VisibleForTesting
    @VisibleForTesting
@@ -1115,21 +1107,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        }
        }
    }
    }


    private void handleFaceUnlockStateChanged(boolean running, int userId) {
        Assert.isMainThread();
        mUserFaceUnlockRunning.put(userId, running);
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
                cb.onFaceUnlockStateChanged(running, userId);
            }
        }
    }

    public boolean isFaceUnlockRunning(int userId) {
        return mUserFaceUnlockRunning.get(userId);
    }

    public boolean isFingerprintDetectionRunning() {
    public boolean isFingerprintDetectionRunning() {
        return mFingerprintRunningState == BIOMETRIC_STATE_RUNNING;
        return mFingerprintRunningState == BIOMETRIC_STATE_RUNNING;
    }
    }
@@ -1353,16 +1330,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        }
        }
    }
    }


    static class DisplayClientState {
        public int clientGeneration;
        public boolean clearing;
        public PendingIntent intent;
        public int playbackState;
        public long playbackEventTime;
    }

    private DisplayClientState mDisplayClientState = new DisplayClientState();

    @VisibleForTesting
    @VisibleForTesting
    protected final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
    protected final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {


@@ -1436,16 +1403,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            final String action = intent.getAction();
            final String action = intent.getAction();
            if (AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED.equals(action)) {
            if (AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED.equals(action)) {
                mHandler.sendEmptyMessage(MSG_TIME_UPDATE);
                mHandler.sendEmptyMessage(MSG_TIME_UPDATE);
            } else if (ACTION_FACE_UNLOCK_STARTED.equals(action)) {
                Trace.beginSection(
                        "KeyguardUpdateMonitor.mBroadcastAllReceiver#onReceive "
                                + "ACTION_FACE_UNLOCK_STARTED");
                mHandler.sendMessage(mHandler.obtainMessage(MSG_FACE_UNLOCK_STATE_CHANGED, 1,
                        getSendingUserId()));
                Trace.endSection();
            } else if (ACTION_FACE_UNLOCK_STOPPED.equals(action)) {
                mHandler.sendMessage(mHandler.obtainMessage(MSG_FACE_UNLOCK_STATE_CHANGED, 0,
                        getSendingUserId()));
            } else if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED
            } else if (DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED
                    .equals(action)) {
                    .equals(action)) {
                mHandler.sendMessage(mHandler.obtainMessage(MSG_DPM_STATE_CHANGED,
                mHandler.sendMessage(mHandler.obtainMessage(MSG_DPM_STATE_CHANGED,
@@ -1922,12 +1879,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                        handleStartedWakingUp();
                        handleStartedWakingUp();
                        Trace.endSection();
                        Trace.endSection();
                        break;
                        break;
                    case MSG_FACE_UNLOCK_STATE_CHANGED:
                        Trace.beginSection(
                                "KeyguardUpdateMonitor#handler MSG_FACE_UNLOCK_STATE_CHANGED");
                        handleFaceUnlockStateChanged(msg.arg1 != 0, msg.arg2);
                        Trace.endSection();
                        break;
                    case MSG_SIM_SUBSCRIPTION_INFO_CHANGED:
                    case MSG_SIM_SUBSCRIPTION_INFO_CHANGED:
                        handleSimSubscriptionInfoChanged();
                        handleSimSubscriptionInfoChanged();
                        break;
                        break;
@@ -2019,8 +1970,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab


        final IntentFilter allUserFilter = new IntentFilter();
        final IntentFilter allUserFilter = new IntentFilter();
        allUserFilter.addAction(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED);
        allUserFilter.addAction(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED);
        allUserFilter.addAction(ACTION_FACE_UNLOCK_STARTED);
        allUserFilter.addAction(ACTION_FACE_UNLOCK_STOPPED);
        allUserFilter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
        allUserFilter.addAction(DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED);
        allUserFilter.addAction(ACTION_USER_UNLOCKED);
        allUserFilter.addAction(ACTION_USER_UNLOCKED);
        allUserFilter.addAction(ACTION_USER_STOPPED);
        allUserFilter.addAction(ACTION_USER_STOPPED);
@@ -3507,10 +3456,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
                || state == TelephonyManager.SIM_STATE_PERM_DISABLED);
                || state == TelephonyManager.SIM_STATE_PERM_DISABLED);
    }
    }


    public DisplayClientState getCachedDisplayClientState() {
        return mDisplayClientState;
    }

    // TODO: use these callbacks elsewhere in place of the existing notifyScreen*()
    // TODO: use these callbacks elsewhere in place of the existing notifyScreen*()
    // (KeyguardViewMediator, KeyguardHostView)
    // (KeyguardViewMediator, KeyguardHostView)
    public void dispatchStartedWakingUp() {
    public void dispatchStartedWakingUp() {
+0 −5
Original line number Original line Diff line number Diff line
@@ -242,11 +242,6 @@ public class KeyguardUpdateMonitorCallback {
    public void onBiometricError(int msgId, String errString,
    public void onBiometricError(int msgId, String errString,
            BiometricSourceType biometricSourceType) { }
            BiometricSourceType biometricSourceType) { }


    /**
     * Called when the state of face unlock changed.
     */
    public void onFaceUnlockStateChanged(boolean running, int userId) { }

    /**
    /**
     * Called when biometric running state changed.
     * Called when biometric running state changed.
     */
     */
+0 −5
Original line number Original line Diff line number Diff line
@@ -423,11 +423,6 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
            Trace.endSection();
            Trace.endSection();
        }
        }


        @Override
        public void onFaceUnlockStateChanged(boolean running, int userId) {
            update(false /* updateAlways */);
        }

        @Override
        @Override
        public void onStrongAuthStateChanged(int userId) {
        public void onStrongAuthStateChanged(int userId) {
            update(false /* updateAlways */);
            update(false /* updateAlways */);
+1 −2
Original line number Original line Diff line number Diff line
@@ -1109,8 +1109,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {


        // THEN face unlock is not running b/c status bar state changes don't cause biometric
        // THEN face unlock is not running b/c status bar state changes don't cause biometric
        // listening state to update
        // listening state to update
        assertThat(mKeyguardUpdateMonitor.isFaceUnlockRunning(
        assertThat(mKeyguardUpdateMonitor.isFaceDetectionRunning()).isEqualTo(false);
                KeyguardUpdateMonitor.getCurrentUser())).isEqualTo(false);


        // WHEN biometric listening state is updated
        // WHEN biometric listening state is updated
        mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
        mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);