[Panlingual] Can't set per-app languages for apps on work profile page
Use startActivityAsUser instead of startActivity API to start the AppLocalePickerActivity of different users Bug: 274378136 Test: 1. Perform AppLocalePickerActivityTest robolectric test 2. Perform the manual test by switching different users 3. Perform the manual test by switching different profiles Change-Id: I0dfc40b29a7a35f18f6bcffd22fb421c6ad9c230 Merged-In: I4405b3b7e832b71b9ef66fa71d9e42ce12da167c
This commit is contained in:
@@ -73,7 +73,6 @@ import java.util.Locale;
|
||||
shadows = {
|
||||
AppLocalePickerActivityTest.ShadowApplicationPackageManager.class,
|
||||
AppLocalePickerActivityTest.ShadowResources.class,
|
||||
AppLocalePickerActivityTest.ShadowUserHandle.class,
|
||||
AppLocalePickerActivityTest.ShadowLocaleConfig.class,
|
||||
})
|
||||
public class AppLocalePickerActivityTest {
|
||||
@@ -100,7 +99,6 @@ public class AppLocalePickerActivityTest {
|
||||
mPackageManager.removePackage(TEST_PACKAGE_NAME);
|
||||
ShadowResources.setDisAllowPackage(false);
|
||||
ShadowApplicationPackageManager.setNoLaunchEntry(false);
|
||||
ShadowUserHandle.setUserId(0);
|
||||
ShadowLocaleConfig.setStatus(LocaleConfig.STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
@@ -164,17 +162,6 @@ public class AppLocalePickerActivityTest {
|
||||
assertThat(controller.get().isFinishing()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void launchAppLocalePickerActivity_modifyAppLocalesOfAnotherUser_failed() {
|
||||
ShadowUserHandle.setUserId(10);
|
||||
|
||||
ActivityController<TestAppLocalePickerActivity> controller =
|
||||
initActivityController(true);
|
||||
controller.create();
|
||||
|
||||
assertThat(controller.get().isFinishing()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void launchAppLocalePickerActivity_intentWithoutPackageName_failed() {
|
||||
ActivityController<TestAppLocalePickerActivity> controller =
|
||||
@@ -286,19 +273,6 @@ public class AppLocalePickerActivityTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Implements(UserHandle.class)
|
||||
public static class ShadowUserHandle {
|
||||
private static int sUserId = 0;
|
||||
private static void setUserId(int userId) {
|
||||
sUserId = userId;
|
||||
}
|
||||
|
||||
@Implementation
|
||||
public static int getUserId(int userId) {
|
||||
return sUserId;
|
||||
}
|
||||
}
|
||||
|
||||
@Implements(LocaleConfig.class)
|
||||
public static class ShadowLocaleConfig {
|
||||
private static int sStatus = 0;
|
||||
|
Reference in New Issue
Block a user