use of android.content.pm.LauncherActivityInfo in project robolectric by robolectric.
the class ShadowLauncherAppsTest method testGetActivityListS_getsActivitiesFromAllPackagesForUser.
@Test
@Config(minSdk = S)
public void testGetActivityListS_getsActivitiesFromAllPackagesForUser() {
LauncherActivityInfo launcherActivityInfo = createLauncherActivityInfoS(TEST_PACKAGE_NAME, USER_HANDLE);
LauncherActivityInfo launcherActivityInfo2 = createLauncherActivityInfoS(TEST_PACKAGE_NAME_2, USER_HANDLE);
shadowOf(launcherApps).addActivity(USER_HANDLE, launcherActivityInfo);
shadowOf(launcherApps).addActivity(USER_HANDLE, launcherActivityInfo2);
assertThat(launcherApps.getActivityList(null, USER_HANDLE)).containsExactly(launcherActivityInfo, launcherActivityInfo2);
}
use of android.content.pm.LauncherActivityInfo in project robolectric by robolectric.
the class ShadowLauncherAppsTest method createLauncherActivityInfoPostN.
private LauncherActivityInfo createLauncherActivityInfoPostN(String packageName, UserHandle userHandle) {
ActivityInfo info = new ActivityInfo();
info.packageName = packageName;
info.name = packageName;
info.nonLocalizedLabel = packageName;
return ReflectionHelpers.callConstructor(LauncherActivityInfo.class, ClassParameter.from(Context.class, ApplicationProvider.getApplicationContext()), ClassParameter.from(ActivityInfo.class, info), ClassParameter.from(UserHandle.class, userHandle));
}
use of android.content.pm.LauncherActivityInfo in project robolectric by robolectric.
the class ShadowLauncherAppsTest method getShortcutConfigActivityListS_getsShortcutsForUserHandle.
@Test
@Config(minSdk = S)
public void getShortcutConfigActivityListS_getsShortcutsForUserHandle() {
LauncherActivityInfo launcherActivityInfo1 = createLauncherActivityInfoS(TEST_PACKAGE_NAME, USER_HANDLE);
LauncherActivityInfo launcherActivityInfo2 = createLauncherActivityInfoS(TEST_PACKAGE_NAME, UserHandle.of(10));
shadowOf(launcherApps).addShortcutConfigActivity(USER_HANDLE, launcherActivityInfo1);
shadowOf(launcherApps).addShortcutConfigActivity(UserHandle.of(10), launcherActivityInfo2);
assertThat(launcherApps.getShortcutConfigActivityList(TEST_PACKAGE_NAME, UserHandle.of(10))).contains(launcherActivityInfo2);
}
use of android.content.pm.LauncherActivityInfo in project robolectric by robolectric.
the class ShadowLauncherAppsTest method getShortcutConfigActivityListS_packageNull_getsShortcutFromAllPackagesForUser.
@Test
@Config(minSdk = S)
public void getShortcutConfigActivityListS_packageNull_getsShortcutFromAllPackagesForUser() {
LauncherActivityInfo launcherActivityInfo1 = createLauncherActivityInfoS(TEST_PACKAGE_NAME, USER_HANDLE);
LauncherActivityInfo launcherActivityInfo2 = createLauncherActivityInfoS(TEST_PACKAGE_NAME_2, USER_HANDLE);
LauncherActivityInfo launcherActivityInfo3 = createLauncherActivityInfoS(TEST_PACKAGE_NAME_3, UserHandle.of(10));
shadowOf(launcherApps).addShortcutConfigActivity(USER_HANDLE, launcherActivityInfo1);
shadowOf(launcherApps).addShortcutConfigActivity(USER_HANDLE, launcherActivityInfo2);
shadowOf(launcherApps).addShortcutConfigActivity(UserHandle.of(10), launcherActivityInfo3);
assertThat(launcherApps.getShortcutConfigActivityList(null, USER_HANDLE)).containsExactly(launcherActivityInfo1, launcherActivityInfo2);
}
use of android.content.pm.LauncherActivityInfo in project robolectric by robolectric.
the class ShadowLauncherAppsTest method testGetActivityList.
@Test
@Config(minSdk = N, maxSdk = R)
public void testGetActivityList() {
assertThat(launcherApps.getActivityList(TEST_PACKAGE_NAME, USER_HANDLE)).isEmpty();
LauncherActivityInfo launcherActivityInfo1 = createLauncherActivityInfoPostN(TEST_PACKAGE_NAME, USER_HANDLE);
shadowOf(launcherApps).addActivity(USER_HANDLE, launcherActivityInfo1);
assertThat(launcherApps.getActivityList(TEST_PACKAGE_NAME, USER_HANDLE)).contains(launcherActivityInfo1);
}
Aggregations