Fix keyboard vibration settings delay

The default settings observer delay is 10s for
background service. It cause the apps get the
settings update delay and lead a unsync behavior.

Update the settings change without delay.

Bug: 327094397
Test: Manual test with bug steps
Test: atest KeyboardVibrationTogglePreferenceControllerTest
Change-Id: Ib1c23ec9e1442e8397c7a36ffa157594ac64a9b3
This commit is contained in:
Wilson Wu
2024-03-13 06:33:08 +00:00
parent 01bd498503
commit f2174611b8
2 changed files with 11 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ import static org.mockito.Mockito.when;
import static org.mockito.Mockito.verify;
import android.app.settings.SettingsEnums;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
import android.os.vibrator.Flags;
@@ -60,6 +61,9 @@ public class KeyboardVibrationTogglePreferenceControllerTest {
@Mock
private PreferenceScreen mPreferenceScreen;
@Mock
private ContentResolver mContentResolver;
private Context mContext;
private Resources mResources;
private KeyboardVibrationTogglePreferenceController mController;
@@ -72,6 +76,7 @@ public class KeyboardVibrationTogglePreferenceControllerTest {
mContext = spy(ApplicationProvider.getApplicationContext());
mResources = spy(mContext.getResources());
when(mContext.getResources()).thenReturn(mResources);
when(mContext.getContentResolver()).thenReturn(mContentResolver);
mFeatureFactory = FakeFeatureFactory.setupForTest();
mController = new KeyboardVibrationTogglePreferenceController(mContext, "preferenceKey");
mPreference = new SwitchPreference(mContext);