Search in sources :

Example 46 with LauncherActivityInfo

use of android.content.pm.LauncherActivityInfo in project robolectric by robolectric.

the class ShadowLauncherAppsTest method getShortcutConfigActivityList_getsShortcutsForPackageName.

@Test
@Config(minSdk = O, maxSdk = R)
public void getShortcutConfigActivityList_getsShortcutsForPackageName() {
    LauncherActivityInfo launcherActivityInfo1 = createLauncherActivityInfoPostN(TEST_PACKAGE_NAME, USER_HANDLE);
    LauncherActivityInfo launcherActivityInfo2 = createLauncherActivityInfoPostN(TEST_PACKAGE_NAME_2, USER_HANDLE);
    shadowOf(launcherApps).addShortcutConfigActivity(USER_HANDLE, launcherActivityInfo1);
    shadowOf(launcherApps).addShortcutConfigActivity(USER_HANDLE, launcherActivityInfo2);
    assertThat(launcherApps.getShortcutConfigActivityList(TEST_PACKAGE_NAME, USER_HANDLE)).contains(launcherActivityInfo1);
}
Also used : LauncherActivityInfo(android.content.pm.LauncherActivityInfo) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 47 with LauncherActivityInfo

use of android.content.pm.LauncherActivityInfo in project robolectric by robolectric.

the class ShadowLauncherAppsTest method getShortcutConfigActivityList_packageNull_getsShortcutFromAllPackagesForUser.

@Test
@Config(minSdk = O, maxSdk = R)
public void getShortcutConfigActivityList_packageNull_getsShortcutFromAllPackagesForUser() {
    LauncherActivityInfo launcherActivityInfo1 = createLauncherActivityInfoPostN(TEST_PACKAGE_NAME, USER_HANDLE);
    LauncherActivityInfo launcherActivityInfo2 = createLauncherActivityInfoPostN(TEST_PACKAGE_NAME_2, USER_HANDLE);
    LauncherActivityInfo launcherActivityInfo3 = createLauncherActivityInfoPostN(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);
}
Also used : LauncherActivityInfo(android.content.pm.LauncherActivityInfo) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 48 with LauncherActivityInfo

use of android.content.pm.LauncherActivityInfo in project robolectric by robolectric.

the class ShadowLauncherAppsTest method testGetActivityListS.

@Test
@Config(minSdk = S)
public void testGetActivityListS() {
    LauncherActivityInfo launcherActivityInfo = createLauncherActivityInfoS(TEST_PACKAGE_NAME, USER_HANDLE);
    shadowOf(launcherApps).addActivity(USER_HANDLE, launcherActivityInfo);
    assertThat(launcherApps.getActivityList(TEST_PACKAGE_NAME, USER_HANDLE)).contains(launcherActivityInfo);
}
Also used : LauncherActivityInfo(android.content.pm.LauncherActivityInfo) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 49 with LauncherActivityInfo

use of android.content.pm.LauncherActivityInfo in project robolectric by robolectric.

the class ShadowLauncherAppsTest method testGetActivityList_packageNull_getsActivitiesFromAllPackagesForUser.

@Test
@Config(minSdk = N, maxSdk = R)
public void testGetActivityList_packageNull_getsActivitiesFromAllPackagesForUser() {
    LauncherActivityInfo launcherActivityInfo1 = createLauncherActivityInfoPostN(TEST_PACKAGE_NAME, USER_HANDLE);
    LauncherActivityInfo launcherActivityInfo2 = createLauncherActivityInfoPostN(TEST_PACKAGE_NAME_2, USER_HANDLE);
    LauncherActivityInfo launcherActivityInfo3 = createLauncherActivityInfoPostN(TEST_PACKAGE_NAME_3, UserHandle.of(10));
    shadowOf(launcherApps).addActivity(USER_HANDLE, launcherActivityInfo1);
    shadowOf(launcherApps).addActivity(USER_HANDLE, launcherActivityInfo2);
    shadowOf(launcherApps).addActivity(UserHandle.of(10), launcherActivityInfo3);
    assertThat(launcherApps.getActivityList(null, USER_HANDLE)).containsExactly(launcherActivityInfo1, launcherActivityInfo2);
}
Also used : LauncherActivityInfo(android.content.pm.LauncherActivityInfo) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 50 with LauncherActivityInfo

use of android.content.pm.LauncherActivityInfo in project robolectric by robolectric.

the class ShadowLauncherAppsTest method getShortcutConfigActivityList_getsShortcutsForUserHandle.

@Test
@Config(minSdk = O, maxSdk = R)
public void getShortcutConfigActivityList_getsShortcutsForUserHandle() {
    LauncherActivityInfo launcherActivityInfo1 = createLauncherActivityInfoPostN(TEST_PACKAGE_NAME, USER_HANDLE);
    LauncherActivityInfo launcherActivityInfo2 = createLauncherActivityInfoPostN(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);
}
Also used : LauncherActivityInfo(android.content.pm.LauncherActivityInfo) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

LauncherActivityInfo (android.content.pm.LauncherActivityInfo)134 LauncherApps (android.content.pm.LauncherApps)70 ArrayList (java.util.ArrayList)57 UserHandle (android.os.UserHandle)50 Intent (android.content.Intent)36 ComponentName (android.content.ComponentName)31 List (java.util.List)30 AppInfo (com.android.launcher3.model.data.AppInfo)28 ShortcutInfo (android.content.pm.ShortcutInfo)27 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)26 Context (android.content.Context)23 Point (android.graphics.Point)22 SessionInfo (android.content.pm.PackageInstaller.SessionInfo)19 SuppressLint (android.annotation.SuppressLint)16 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)16 PackageUserKey (com.android.launcher3.util.PackageUserKey)14 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)13 IconRequestInfo (com.android.launcher3.model.data.IconRequestInfo)12 CancellationException (java.util.concurrent.CancellationException)12 PackageInstaller (android.content.pm.PackageInstaller)11