use of com.android.launcher3.tapl.AppIcon in project android_packages_apps_Launcher3 by crdroidandroid.
the class DefaultLayoutProviderTest method testCustomProfileLoaded_with_widget.
@Test
public void testCustomProfileLoaded_with_widget() throws Exception {
String pendingAppPkg = "com.test.pending";
// Add a placeholder session info so that the widget exists
SessionParams params = new SessionParams(SessionParams.MODE_FULL_INSTALL);
params.setAppPackageName(pendingAppPkg);
PackageInstaller installer = mTargetContext.getPackageManager().getPackageInstaller();
int sessionId = installer.createSession(params);
SessionInfo sessionInfo = installer.getSessionInfo(sessionId);
setField(sessionInfo, "installerPackageName", "com.test");
setField(sessionInfo, "appIcon", BitmapInfo.LOW_RES_ICON);
writeLayoutAndLoad(new LauncherLayoutBuilder().atWorkspace(0, 1, 0).putWidget(pendingAppPkg, "PlaceholderWidget", 2, 2));
// Verify widget
assertEquals(1, mModelHelper.getBgDataModel().appWidgets.size());
ItemInfo info = mModelHelper.getBgDataModel().appWidgets.get(0);
assertEquals(LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET, info.itemType);
assertEquals(2, info.spanX);
assertEquals(2, info.spanY);
}
use of com.android.launcher3.tapl.AppIcon in project android_packages_apps_Launcher3 by crdroidandroid.
the class TaplTestsLauncher3 method runIconLaunchFromAllAppsTest.
public static void runIconLaunchFromAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
allApps.freeze();
try {
final AppIcon app = allApps.getAppIcon("TestActivity7");
assertNotNull("AppIcon.launch returned null", app.launch(getAppPackageName()));
test.executeOnLauncher(launcher -> assertTrue("Launcher activity is the top activity; expecting another activity to be the " + "top " + "one", test.isInBackground(launcher)));
} finally {
allApps.unfreeze();
}
}
use of com.android.launcher3.tapl.AppIcon in project android_packages_apps_Launcher3 by AOSPA.
the class TaplTestsLauncher3 method runIconLaunchFromAllAppsTest.
public static void runIconLaunchFromAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
allApps.freeze();
try {
final AppIcon app = allApps.getAppIcon("TestActivity7");
assertNotNull("AppIcon.launch returned null", app.launch(getAppPackageName()));
test.executeOnLauncher(launcher -> assertTrue("Launcher activity is the top activity; expecting another activity to be the " + "top " + "one", test.isInBackground(launcher)));
} finally {
allApps.unfreeze();
}
}
use of com.android.launcher3.tapl.AppIcon in project android_packages_apps_Launcher3 by AOSPA.
the class TaplTestsLauncher3 method testDragToFolder.
@Ignore("b/205014516")
@Test
@PortraitLandscape
public void testDragToFolder() throws Exception {
final AppIcon playStoreIcon = createShortcutIfNotExist("Play Store");
final AppIcon gmailIcon = createShortcutIfNotExist("Gmail");
FolderIcon folderIcon = gmailIcon.dragToIcon(playStoreIcon);
Folder folder = folderIcon.open();
folder.getAppIcon("Play Store");
folder.getAppIcon("Gmail");
Workspace workspace = folder.close();
assertNull("Gmail should be moved to a folder.", workspace.tryGetWorkspaceAppIcon("Gmail"));
assertNull("Play Store should be moved to a folder.", workspace.tryGetWorkspaceAppIcon("Play Store"));
final AppIcon youTubeIcon = createShortcutIfNotExist("YouTube");
folderIcon = youTubeIcon.dragToIcon(folderIcon);
folder = folderIcon.open();
folder.getAppIcon("YouTube");
folder.close();
}
use of com.android.launcher3.tapl.AppIcon in project android_packages_apps_Launcher3 by AOSPA.
the class TaplTestsLauncher3 method createShortcutIfNotExist.
private AppIcon createShortcutIfNotExist(String name) {
AppIcon appIcon = mLauncher.getWorkspace().tryGetWorkspaceAppIcon(name);
if (appIcon == null) {
AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
appIcon = allApps.getAppIcon(name);
appIcon.dragToWorkspace(false, false);
} finally {
allApps.unfreeze();
}
appIcon = mLauncher.getWorkspace().getWorkspaceAppIcon(name);
}
return appIcon;
}
Aggregations