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

Commit ef94dfc2 authored by Joshua McCloskey's avatar Joshua McCloskey Committed by Joshua Mccloskey
Browse files

Turn on device when finger down

Test: Manual
Fixes: 243071418
Change-Id: I486d54e30a98b9e89d26744ddf45ebe9453b8743
Merged-In: I486d54e30a98b9e89d26744ddf45ebe9453b8743
parent 1eaf0fad
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@
    <bool name="kg_enable_camera_default_widget">true</bool>
    <bool name="kg_enable_camera_default_widget">true</bool>
    <bool name="kg_center_small_widgets_vertically">false</bool>
    <bool name="kg_center_small_widgets_vertically">false</bool>
    <bool name="kg_top_align_page_shrink_on_bouncer_visible">true</bool>
    <bool name="kg_top_align_page_shrink_on_bouncer_visible">true</bool>
    <bool name="kg_wake_on_acquire_start">false</bool>
    <bool name="action_bar_embed_tabs">true</bool>
    <bool name="action_bar_embed_tabs">true</bool>
    <bool name="split_action_bar_is_narrow">true</bool>
    <bool name="split_action_bar_is_narrow">true</bool>
    <bool name="preferences_prefer_dual_pane">false</bool>
    <bool name="preferences_prefer_dual_pane">false</bool>
+1 −0
Original line number Original line Diff line number Diff line
@@ -2831,6 +2831,7 @@
  <java-symbol type="dimen" name="fast_scroller_minimum_touch_target" />
  <java-symbol type="dimen" name="fast_scroller_minimum_touch_target" />
  <java-symbol type="array" name="config_cdma_international_roaming_indicators" />
  <java-symbol type="array" name="config_cdma_international_roaming_indicators" />
  <java-symbol type="string" name="kg_text_message_separator" />
  <java-symbol type="string" name="kg_text_message_separator" />
  <java-symbol type="bool" name="kg_wake_on_acquire_start" />


  <java-symbol type="bool" name="config_use_sim_language_file" />
  <java-symbol type="bool" name="config_use_sim_language_file" />
  <java-symbol type="bool" name="config_LTE_eri_for_network_name" />
  <java-symbol type="bool" name="config_LTE_eri_for_network_name" />
+16 −1
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ import static android.hardware.biometrics.BiometricConstants.BIOMETRIC_LOCKOUT_N
import static android.hardware.biometrics.BiometricConstants.BIOMETRIC_LOCKOUT_PERMANENT;
import static android.hardware.biometrics.BiometricConstants.BIOMETRIC_LOCKOUT_PERMANENT;
import static android.hardware.biometrics.BiometricConstants.BIOMETRIC_LOCKOUT_TIMED;
import static android.hardware.biometrics.BiometricConstants.BIOMETRIC_LOCKOUT_TIMED;
import static android.hardware.biometrics.BiometricConstants.LockoutMode;
import static android.hardware.biometrics.BiometricConstants.LockoutMode;
import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_START;
import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;
import static android.os.BatteryManager.BATTERY_STATUS_UNKNOWN;


import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_BOOT;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_BOOT;
@@ -104,8 +105,10 @@ import android.os.Handler;
import android.os.IRemoteCallback;
import android.os.IRemoteCallback;
import android.os.Looper;
import android.os.Looper;
import android.os.Message;
import android.os.Message;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.Trace;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManager;
@@ -356,6 +359,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    private final Executor mBackgroundExecutor;
    private final Executor mBackgroundExecutor;
    private SensorPrivacyManager mSensorPrivacyManager;
    private SensorPrivacyManager mSensorPrivacyManager;
    private final ActiveUnlockConfig mActiveUnlockConfig;
    private final ActiveUnlockConfig mActiveUnlockConfig;
    private final PowerManager mPowerManager;
    private final boolean mWakeOnFingerprintAcquiredStart;


    /**
    /**
     * Short delay before restarting fingerprint authentication after a successful try. This should
     * Short delay before restarting fingerprint authentication after a successful try. This should
@@ -805,6 +810,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
    private void handleFingerprintAcquired(
    private void handleFingerprintAcquired(
            @BiometricFingerprintConstants.FingerprintAcquired int acquireInfo) {
            @BiometricFingerprintConstants.FingerprintAcquired int acquireInfo) {
        Assert.isMainThread();
        Assert.isMainThread();
        if (mWakeOnFingerprintAcquiredStart && acquireInfo == FINGERPRINT_ACQUIRED_START) {
            mPowerManager.wakeUp(
                    SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
                    "com.android.systemui.keyguard:FINGERPRINT_ACQUIRED_START");
        }
        for (int i = 0; i < mCallbacks.size(); i++) {
        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
            if (cb != null) {
@@ -1895,7 +1905,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
            KeyguardUpdateMonitorLogger logger,
            KeyguardUpdateMonitorLogger logger,
            UiEventLogger uiEventLogger,
            UiEventLogger uiEventLogger,
            // This has to be a provider because SessionTracker depends on KeyguardUpdateMonitor :(
            // This has to be a provider because SessionTracker depends on KeyguardUpdateMonitor :(
            Provider<SessionTracker> sessionTrackerProvider) {
            Provider<SessionTracker> sessionTrackerProvider,
            PowerManager powerManager) {
        mContext = context;
        mContext = context;
        mSubscriptionManager = SubscriptionManager.from(context);
        mSubscriptionManager = SubscriptionManager.from(context);
        mTelephonyListenerManager = telephonyListenerManager;
        mTelephonyListenerManager = telephonyListenerManager;
@@ -1916,7 +1927,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        mLogger = logger;
        mLogger = logger;
        mUiEventLogger = uiEventLogger;
        mUiEventLogger = uiEventLogger;
        mSessionTrackerProvider = sessionTrackerProvider;
        mSessionTrackerProvider = sessionTrackerProvider;
        mPowerManager = powerManager;
        mActiveUnlockConfig.setKeyguardUpdateMonitor(this);
        mActiveUnlockConfig.setKeyguardUpdateMonitor(this);
        mWakeOnFingerprintAcquiredStart = context.getResources()
                        .getBoolean(com.android.internal.R.bool.kg_wake_on_acquire_start);


        mHandler = new Handler(mainLooper) {
        mHandler = new Handler(mainLooper) {
            @Override
            @Override
@@ -3705,6 +3719,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        pw.println("  getUserHasTrust()=" + getUserHasTrust(getCurrentUser()));
        pw.println("  getUserHasTrust()=" + getUserHasTrust(getCurrentUser()));
        pw.println("  getUserUnlockedWithBiometric()="
        pw.println("  getUserUnlockedWithBiometric()="
                + getUserUnlockedWithBiometric(getCurrentUser()));
                + getUserUnlockedWithBiometric(getCurrentUser()));
        pw.println("  mWakeOnFingerprintAcquiredStart=" + mWakeOnFingerprintAcquiredStart);
        pw.println("  SIM States:");
        pw.println("  SIM States:");
        for (SimData data : mSimDatas.values()) {
        for (SimData data : mSimDatas.values()) {
            pw.println("    " + data.toString());
            pw.println("    " + data.toString());
+34 −1
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.keyguard;
package com.android.keyguard;


import static android.app.StatusBarManager.SESSION_KEYGUARD;
import static android.app.StatusBarManager.SESSION_KEYGUARD;
import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_START;
import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ERROR_LOCKOUT;
import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ERROR_LOCKOUT;
import static android.telephony.SubscriptionManager.DATA_ROAMING_DISABLE;
import static android.telephony.SubscriptionManager.DATA_ROAMING_DISABLE;
import static android.telephony.SubscriptionManager.NAME_SOURCE_CARRIER_ID;
import static android.telephony.SubscriptionManager.NAME_SOURCE_CARRIER_ID;
@@ -30,6 +31,7 @@ import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.atLeastOnce;
@@ -72,6 +74,7 @@ import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.CancellationSignal;
import android.os.Handler;
import android.os.Handler;
import android.os.IRemoteCallback;
import android.os.IRemoteCallback;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManager;
@@ -197,6 +200,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
    private SessionTracker mSessionTracker;
    private SessionTracker mSessionTracker;
    @Mock
    @Mock
    private UiEventLogger mUiEventLogger;
    private UiEventLogger mUiEventLogger;
    @Mock
    private PowerManager mPowerManager;


    private final int mCurrentUserId = 100;
    private final int mCurrentUserId = 100;
    private final UserInfo mCurrentUserInfo = new UserInfo(mCurrentUserId, "Test user", 0);
    private final UserInfo mCurrentUserInfo = new UserInfo(mCurrentUserId, "Test user", 0);
@@ -1559,6 +1564,28 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(anyBoolean())).isEqualTo(true);
        assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(anyBoolean())).isEqualTo(true);
    }
    }


    @Test
    public void testFingerAcquired_wakesUpPowerManager() {
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.bool.kg_wake_on_acquire_start, true);
        mSpiedContext = spy(mContext);
        mKeyguardUpdateMonitor = new TestableKeyguardUpdateMonitor(mSpiedContext);
        fingerprintAcquireStart();

        verify(mPowerManager).wakeUp(anyLong(), anyInt(), anyString());
    }

    @Test
    public void testFingerAcquired_doesNotWakeUpPowerManager() {
        mContext.getOrCreateTestableResources().addOverride(
                com.android.internal.R.bool.kg_wake_on_acquire_start, false);
        mSpiedContext = spy(mContext);
        mKeyguardUpdateMonitor = new TestableKeyguardUpdateMonitor(mSpiedContext);
        fingerprintAcquireStart();

        verify(mPowerManager, never()).wakeUp(anyLong(), anyInt(), anyString());
    }

    private void faceAuthEnabled() {
    private void faceAuthEnabled() {
        // this ensures KeyguardUpdateMonitor updates the cached mIsFaceEnrolled flag using the
        // this ensures KeyguardUpdateMonitor updates the cached mIsFaceEnrolled flag using the
        // face manager mock wire-up in setup()
        // face manager mock wire-up in setup()
@@ -1607,6 +1634,11 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
                .onAuthenticationError(FINGERPRINT_ERROR_LOCKOUT, "Fingerprint locked out");
                .onAuthenticationError(FINGERPRINT_ERROR_LOCKOUT, "Fingerprint locked out");
    }
    }


    private void fingerprintAcquireStart() {
        mKeyguardUpdateMonitor.mFingerprintAuthenticationCallback
                .onAuthenticationAcquired(FINGERPRINT_ACQUIRED_START);
    }

    private void triggerSuccessfulFaceAuth() {
    private void triggerSuccessfulFaceAuth() {
        mKeyguardUpdateMonitor.requestFaceAuth(true, FaceAuthApiRequestReason.UDFPS_POINTER_DOWN);
        mKeyguardUpdateMonitor.requestFaceAuth(true, FaceAuthApiRequestReason.UDFPS_POINTER_DOWN);
        verify(mFaceManager).authenticate(any(),
        verify(mFaceManager).authenticate(any(),
@@ -1728,7 +1760,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
                    mStatusBarStateController, mLockPatternUtils,
                    mStatusBarStateController, mLockPatternUtils,
                    mAuthController, mTelephonyListenerManager,
                    mAuthController, mTelephonyListenerManager,
                    mInteractionJankMonitor, mLatencyTracker, mActiveUnlockConfig,
                    mInteractionJankMonitor, mLatencyTracker, mActiveUnlockConfig,
                    mKeyguardUpdateMonitorLogger, mUiEventLogger, () -> mSessionTracker);
                    mKeyguardUpdateMonitorLogger, mUiEventLogger, () -> mSessionTracker,
                    mPowerManager);
            setStrongAuthTracker(KeyguardUpdateMonitorTest.this.mStrongAuthTracker);
            setStrongAuthTracker(KeyguardUpdateMonitorTest.this.mStrongAuthTracker);
        }
        }