Show dialog when user chnages the region

1. show dialog
2. change the region of the top locale

Bug: 385047778
Flag: com.android.settings.flags.regional_preferences_api_enabled
Test: check hsv, atest
Change-Id: I9746cdec670899b3768dcd1e0aa59e1959dd7e06
This commit is contained in:
danielwbhuang
2024-12-20 20:43:48 +08:00
parent 1ef5e68927
commit 833a0e3c92
6 changed files with 258 additions and 24 deletions

View File

@@ -6,10 +6,14 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import android.app.Activity;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.flag.junit.SetFlagsRule;
import com.android.internal.app.LocaleStore;
import com.android.settings.flags.Flags;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
@@ -24,6 +28,8 @@ public class LocalePickerWithRegionActivityTest {
private LocalePickerWithRegionActivity mActivity;
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
@@ -33,6 +39,7 @@ public class LocalePickerWithRegionActivityTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void onLocaleSelected_resultShouldBeOK() {
final ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
mActivity.onLocaleSelected(mock(LocaleStore.LocaleInfo.class));
@@ -41,6 +48,7 @@ public class LocalePickerWithRegionActivityTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void onLocaleSelected_localeInfoShouldBeSentBack() {
final ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
mActivity.onLocaleSelected(mock(LocaleStore.LocaleInfo.class));