Fix user id is not used correctly when fetching app info
FIXES: 73994288 Test: m -j RunSettingsRoboTest Test: Install an app in work profile, set it to be restricted, observe that the app is rendered properly in restricted app list Change-Id: Ic8a79eb3d0a675f9d1cae3125e8006739e492966
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
package com.android.settings;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
@@ -188,12 +191,13 @@ public class UtilsTest {
|
||||
@Test
|
||||
public void testGetBadgedIcon_usePackageNameAndUserId()
|
||||
throws PackageManager.NameNotFoundException {
|
||||
doReturn(mApplicationInfo).when(mPackageManager).getApplicationInfo(PACKAGE_NAME,
|
||||
PackageManager.GET_META_DATA);
|
||||
doReturn(mApplicationInfo).when(mPackageManager).getApplicationInfoAsUser(
|
||||
PACKAGE_NAME, PackageManager.GET_META_DATA, USER_ID);
|
||||
|
||||
Utils.getBadgedIcon(mIconDrawableFactory, mPackageManager, PACKAGE_NAME, USER_ID);
|
||||
|
||||
// Verify that it uses the correct user id
|
||||
verify(mPackageManager).getApplicationInfoAsUser(eq(PACKAGE_NAME), anyInt(), eq(USER_ID));
|
||||
verify(mIconDrawableFactory).getBadgedIcon(mApplicationInfo, USER_ID);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user