[Panlingual] Use feature flag to switch opt-in on/off

- Currently per app language use opt-out by default. This change is to
   add a new idea to have a way to change opt-out to opt-in, and let
   user be able to use LocaleConfig.xml to control the feature more
   precise.
 - If app does not support locale picker or there is no locale provided, remove entries' UI.

Bug: b/231396734
Bug: b/230688538
Test: local
Change-Id: I2661fffab804a2816744711130b26aa2ec47f820
This commit is contained in:
tom hsu
2022-05-05 16:36:15 +08:00
parent afe6d302e4
commit 8976293162
3 changed files with 75 additions and 40 deletions

View File

@@ -37,6 +37,7 @@ import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -71,6 +72,7 @@ public class AppLocaleUtilTest {
}
@Test
@Ignore("b/231904717")
public void canDisplayLocaleUi_showUI() throws PackageManager.NameNotFoundException {
setApplicationInfo(/*no platform key*/ false);
setActivityInfo(mAllowedPackage);
@@ -79,6 +81,7 @@ public class AppLocaleUtilTest {
}
@Test
@Ignore("b/231904717")
public void canDisplayLocaleUi_notShowUI_hasPlatformKey()
throws PackageManager.NameNotFoundException {
setApplicationInfo(/*has platform key*/ true);
@@ -88,6 +91,7 @@ public class AppLocaleUtilTest {
}
@Test
@Ignore("b/231904717")
public void canDisplayLocaleUi_notShowUI_noLauncherEntry()
throws PackageManager.NameNotFoundException {
setApplicationInfo(/*no platform key*/false);
@@ -97,6 +101,7 @@ public class AppLocaleUtilTest {
}
@Test
@Ignore("b/231904717")
public void canDisplayLocaleUi_notShowUI_matchDisallowedPackageList()
throws PackageManager.NameNotFoundException {
setApplicationInfo(/*no platform key*/false);