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

Commit 65921274 authored by Beverly's avatar Beverly Committed by Beverly Tai
Browse files

Update AOD udfps

By default, the udfps long press doze sensor will be enabled as long as
the device has a UDFPS. Eventually this should change to only register the
sensor when the user has enrolled UDFPS.
This can be disabled/enabled through an adb command in:
  adb shell settings put secure doze_pulse_on_auth

Instead of waking up the device when udfps long press is triggered,
requestPulse so device doesn't flash the LS when authenticating from AOD
via udfps.

Test: atest DozeSensorsTest DozeTriggersTest
Test: manual
Bug: 171392825
Change-Id: I61c3291625675c71cd2806c5a8748ca1719e55ee
parent df1d9b98
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -456,6 +456,15 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
        }
    }

   /**
     * Whether the current user has a UDFP enrolled.
     */
    public boolean hasUdfpsEnrolled() {
        // TODO: (b/171392825) right now only checks whether the UDFPS sensor exists on this device
        //  but not whether user has enrolled or not
        return mUdfpsController != null;
    }

    private void showDialog(SomeArgs args, boolean skipAnimation, Bundle savedState) {
        mCurrentDialogArgs = args;
        final @BiometricAuthenticator.Modality int type = args.argi1;
+6 −4
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import com.android.internal.logging.UiEvent;
import com.android.internal.logging.UiEventLogger;
import com.android.internal.logging.UiEventLoggerImpl;
import com.android.internal.logging.nano.MetricsProto;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.plugins.SensorManagerPlugin;
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.util.sensors.AsyncSensorManager;
@@ -98,7 +99,8 @@ public class DozeSensors {
    DozeSensors(Context context, AsyncSensorManager sensorManager,
            DozeParameters dozeParameters, AmbientDisplayConfiguration config, WakeLock wakeLock,
            Callback callback, Consumer<Boolean> proxCallback, DozeLog dozeLog,
            ProximitySensor proximitySensor, SecureSettings secureSettings) {
            ProximitySensor proximitySensor, SecureSettings secureSettings,
            AuthController authController) {
        mContext = context;
        mSensorManager = sensorManager;
        mConfig = config;
@@ -152,9 +154,9 @@ public class DozeSensors {
                        dozeLog),
                new TriggerSensor(
                        findSensorWithType(config.udfpsLongPressSensorType()),
                        Settings.Secure.DOZE_PULSE_ON_LONG_PRESS,
                        false /* settingDef */,
                        true /* configured */,
                        "doze_pulse_on_auth",
                        true /* settingDef */,
                        authController.hasUdfpsEnrolled() /* configured */,
                        DozeLog.REASON_SENSOR_UDFPS_LONG_PRESS,
                        true /* reports touch coordinates */,
                        true /* touchscreen */,
+2 −2
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ public class DozeTriggers implements DozeMachine.Part {
        mAllowPulseTriggers = true;
        mDozeSensors = new DozeSensors(context, mSensorManager, dozeParameters,
                config, wakeLock, this::onSensor, this::onProximityFar, dozeLog, proximitySensor,
                secureSettings);
                secureSettings, authController);
        mUiModeManager = mContext.getSystemService(UiModeManager.class);
        mDockManager = dockManager;
        mProxCheck = proxCheck;
@@ -286,7 +286,7 @@ public class DozeTriggers implements DozeMachine.Part {
                } else if (isPickup) {
                    gentleWakeUp(pulseReason);
                } else if (isUdfpsLongPress) {
                    gentleWakeUp(pulseReason);
                    requestPulse(DozeLog.REASON_SENSOR_UDFPS_LONG_PRESS, true, null);
                    // Since the gesture won't be received by the UDFPS view, manually inject an
                    // event.
                    mAuthController.onAodInterrupt((int) screenX, (int) screenY);
+4 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.testing.TestableLooper.RunWithLooper;
import androidx.test.filters.SmallTest;

import com.android.systemui.SysuiTestCase;
import com.android.systemui.biometrics.AuthController;
import com.android.systemui.doze.DozeSensors.TriggerSensor;
import com.android.systemui.plugins.SensorManagerPlugin;
import com.android.systemui.statusbar.phone.DozeParameters;
@@ -84,6 +85,8 @@ public class DozeSensorsTest extends SysuiTestCase {
    @Mock
    private DozeLog mDozeLog;
    @Mock
    private AuthController mAuthController;
    @Mock
    private ProximitySensor mProximitySensor;
    private FakeSettings mFakeSettings = new FakeSettings();
    private SensorManagerPlugin.SensorEventListener mWakeLockScreenListener;
@@ -156,7 +159,7 @@ public class DozeSensorsTest extends SysuiTestCase {
        TestableDozeSensors() {
            super(getContext(), mSensorManager, mDozeParameters,
                    mAmbientDisplayConfiguration, mWakeLock, mCallback, mProxCallback, mDozeLog,
                    mProximitySensor, mFakeSettings);
                    mProximitySensor, mFakeSettings, mAuthController);
            for (TriggerSensor sensor : mSensors) {
                if (sensor instanceof PluginSensor
                        && ((PluginSensor) sensor).mPluginSensor.getType()
+1 −0
Original line number Diff line number Diff line
@@ -196,6 +196,7 @@ public class DozeTriggersTest extends SysuiTestCase {
        final int screenY = 100;
        final int reason = DozeLog.REASON_SENSOR_UDFPS_LONG_PRESS;
        mTriggers.onSensor(reason, screenX, screenY, null);
        verify(mHost).extendPulse(reason);
        verify(mAuthController).onAodInterrupt(eq(screenX), eq(screenY));
    }