Support wallet launch in Double Tap Power Gesture Settings
Modify Double Tap Power Gesture Settings screen to be able to set the
gesture to launch the wallet.
If the feature flag is disabled, the
Double Tap Power Gesture Settings screen defaults to the current
screen ("Quickly open camera"), which only provides the option to open the camera upon detecting the
gesture.
If the feature flag is enabled, the Double Tap Power Gesture Settings
screen defaults to the new "Double Tap Power Button" screen, which
provides the option to open the camera, the wallet, or neither upon
detecting the gesture.
Android Settings Feature Request: b/380287172
Bug: 378131008
Test: manual tested screen alternates based on feature flag
Test: atest DoubleTapPowerSettingsTest
Test: atest DoubleTapPowerPreferenceControllerTest
Test: atest DoubleTapPowerToOpenCameraPreferenceControllerTest
FLAG: android.service.quickaccesswallet.launch_wallet_option_on_power_double_tap
Change-Id: I1fc05ab3cfee2e86a80a1756655c368aae16747c
This commit is contained in:
@@ -18,11 +18,16 @@ package com.android.settings.gestures;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.annotations.EnableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
import android.provider.SearchIndexableResource;
|
||||
import android.service.quickaccesswallet.Flags;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
@@ -33,6 +38,7 @@ import java.util.List;
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class DoubleTapPowerSettingsTest {
|
||||
|
||||
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
private DoubleTapPowerSettings mSettings;
|
||||
|
||||
@Before
|
||||
@@ -41,18 +47,38 @@ public class DoubleTapPowerSettingsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getPreferenceResId_returnsResId() {
|
||||
@EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP)
|
||||
public void getPreferenceScreenResId_flagEnabled_returnsFlagEnabledResId() {
|
||||
assertThat(mSettings.getPreferenceScreenResId()).isEqualTo(R.xml.double_tap_power_settings);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP)
|
||||
public void getPreferenceScreenResId_flagDisabled_returnsFlagDisabledResId() {
|
||||
assertThat(mSettings.getPreferenceScreenResId())
|
||||
.isEqualTo(R.xml.double_tap_power_to_open_camera_settings);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchIndexProvider_shouldIndexResource() {
|
||||
@EnableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP)
|
||||
public void testSearchIndexProvider_flagEnabled_shouldIndexFlagEnabledResource() {
|
||||
final List<SearchIndexableResource> indexRes =
|
||||
DoubleTapPowerSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
|
||||
RuntimeEnvironment.application, true /* enabled */);
|
||||
RuntimeEnvironment.getApplication(), true /* enabled */);
|
||||
|
||||
assertThat(indexRes).isNotNull();
|
||||
assertThat(indexRes.get(0).xmlResId).isEqualTo(mSettings.getPreferenceScreenResId());
|
||||
assertThat(indexRes.get(0).xmlResId).isEqualTo(R.xml.double_tap_power_settings);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_LAUNCH_WALLET_OPTION_ON_POWER_DOUBLE_TAP)
|
||||
public void testSearchIndexProvider_flagDisabled_shouldIndexFlagDisabledResource() {
|
||||
final List<SearchIndexableResource> indexRes =
|
||||
DoubleTapPowerSettings.SEARCH_INDEX_DATA_PROVIDER.getXmlResourcesToIndex(
|
||||
RuntimeEnvironment.getApplication(), true /* enabled */);
|
||||
|
||||
assertThat(indexRes).isNotNull();
|
||||
assertThat(indexRes.get(0).xmlResId)
|
||||
.isEqualTo(R.xml.double_tap_power_to_open_camera_settings);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user