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

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

Initial udfps vibration should always play

Even if battery saver mode is enabled or
user manually disables vibration & haptics
in settings.

Test: manual, atest UdfpsControllerTest
Fixes: 197751697
Change-Id: I7f8bfcdd77b38dcd15b7641b0b851c3cb5c1beed
parent e454d516
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -163,7 +163,8 @@ public class UdfpsController implements DozeReceiver {
    public static final AudioAttributes VIBRATION_SONIFICATION_ATTRIBUTES =
            new AudioAttributes.Builder()
                    .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
                    .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
                    // vibration will bypass battery saver mode:
                    .setUsage(AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY)
                    .build();

    public static final VibrationEffect EFFECT_CLICK =
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.biometrics;

import static android.media.AudioAttributes.USAGE_ASSISTANCE_ACCESSIBILITY;

import static junit.framework.Assert.assertEquals;

import static org.mockito.ArgumentMatchers.any;
@@ -563,5 +565,10 @@ public class UdfpsControllerTest extends SysuiTestCase {
                eq(mUdfpsController.EFFECT_CLICK),
                eq("udfps-onStart"),
                eq(UdfpsController.VIBRATION_SONIFICATION_ATTRIBUTES));

        // THEN make sure vibration attributes has so that it always will play the haptic,
        // even in battery saver mode
        assertEquals(USAGE_ASSISTANCE_ACCESSIBILITY,
                UdfpsController.VIBRATION_SONIFICATION_ATTRIBUTES.getUsage());
    }
}