Merge "Use flag to control the hierarchy tree changes" into main

This commit is contained in:
Daniel Huang
2024-11-21 10:55:35 +00:00
committed by Android (Google) Code Review
19 changed files with 670 additions and 147 deletions

View File

@@ -24,10 +24,13 @@ import static org.mockito.Mockito.spy;
import android.content.Context;
import android.os.Looper;
import android.platform.test.annotations.DisableFlags;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.settings.flags.Flags;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -65,6 +68,7 @@ public class TermsOfAddressCategoryControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getAvailabilityStatus_returnAvailable() {
Locale.setDefault(Locale.forLanguageTag("fr-FR"));

View File

@@ -19,10 +19,12 @@ package com.android.settings.regionalpreferences;
import static org.junit.Assert.assertEquals;
import android.content.Context;
import android.platform.test.annotations.DisableFlags;
import android.provider.Settings;
import androidx.test.core.app.ApplicationProvider;
import com.android.settings.flags.Flags;
import com.android.settings.testutils.ResourcesUtils;
import org.junit.After;
@@ -54,6 +56,7 @@ public class FirstDayOfWeekControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getSummary_hasProviderValue_resultIsWed() {
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "und-u-fw-wed");
@@ -64,6 +67,7 @@ public class FirstDayOfWeekControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getSummary_hasProviderValue_resultIsSat() {
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "und-u-fw-sat");
@@ -74,6 +78,7 @@ public class FirstDayOfWeekControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getSummary_noProviderValueButHasDefaultLocaleWithSubtag_resultIsSat() {
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "");
Locale.setDefault(Locale.forLanguageTag("en-US-u-fw-sat"));
@@ -85,6 +90,7 @@ public class FirstDayOfWeekControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getSummary_noProviderValueAndDefaultLocaleWithoutSubtag_resultIsdefault() {
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "");
Locale.setDefault(Locale.forLanguageTag("en-US"));

View File

@@ -23,9 +23,12 @@ import static org.junit.Assert.assertEquals;
import android.content.Context;
import android.os.LocaleList;
import android.platform.test.annotations.DisableFlags;
import androidx.test.core.app.ApplicationProvider;
import com.android.settings.flags.Flags;
import org.junit.Before;
import org.junit.Test;
@@ -39,6 +42,7 @@ public class NumberingSystemControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getAvailabilityStatus_noLocale_unavailable() {
LocaleList.setDefault(LocaleList.forLanguageTags("en-US,zh-Hant-TW"));
mController = new NumberingSystemController(mApplicationContext, "key");
@@ -49,6 +53,7 @@ public class NumberingSystemControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getAvailabilityStatus_hasLocaleWithNumberingSystems_available() {
// ar-JO has different numbering system.
LocaleList.setDefault(LocaleList.forLanguageTags("en-US,zh-Hant-TW,ar-JO"));

View File

@@ -19,10 +19,12 @@ package com.android.settings.regionalpreferences;
import static org.junit.Assert.assertEquals;
import android.content.Context;
import android.platform.test.annotations.DisableFlags;
import android.provider.Settings;
import androidx.test.core.app.ApplicationProvider;
import com.android.settings.flags.Flags;
import com.android.settings.testutils.ResourcesUtils;
import org.junit.After;
@@ -54,6 +56,7 @@ public class TemperatureUnitControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getSummary_hasProviderValue_resultIsCelsius() {
RegionalPreferenceTestUtils.setSettingsProviderContent(
mApplicationContext, "und-u-mu-celsius");
@@ -65,6 +68,7 @@ public class TemperatureUnitControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getSummary_hasProviderValue_resultIsFahrenheit() {
RegionalPreferenceTestUtils.setSettingsProviderContent(
mApplicationContext, "und-u-mu-fahrenhe");
@@ -76,6 +80,7 @@ public class TemperatureUnitControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getSummary_noProviderValueButHasDefaultLocaleWithSubtag_resultIsFahrenheit() {
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "");
Locale.setDefault(Locale.forLanguageTag("en-US-u-mu-fahrenhe"));
@@ -87,6 +92,7 @@ public class TemperatureUnitControllerTest {
}
@Test
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
public void getSummary_noProviderValueAndDefaultLocaleWithoutSubtag_resultIsDefault() {
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "");
Locale.setDefault(Locale.forLanguageTag("en-US"));