use of com.android.launcher3.util.LauncherModelHelper in project android_packages_apps_404Launcher by P-404.
the class DefaultLayoutProviderTest method setUp.
@Before
public void setUp() {
mModelHelper = new LauncherModelHelper();
mTargetContext = mModelHelper.sandboxContext;
}
use of com.android.launcher3.util.LauncherModelHelper in project android_packages_apps_404Launcher by P-404.
the class WidgetsPredicationUpdateTaskTest method setup.
@Before
public void setup() throws Exception {
mModelHelper = new LauncherModelHelper();
MockitoAnnotations.initMocks(this);
doAnswer(invocation -> {
ComponentWithLabel componentWithLabel = invocation.getArgument(0);
return componentWithLabel.getComponent().getShortClassName();
}).when(mIconCache).getTitleNoCache(any());
mUserHandle = myUserHandle();
mApp1Provider1 = createAppWidgetProviderInfo(ComponentName.createRelative("app1", "provider1"));
mApp1Provider2 = createAppWidgetProviderInfo(ComponentName.createRelative("app1", "provider2"));
mApp2Provider1 = createAppWidgetProviderInfo(ComponentName.createRelative("app2", "provider1"));
mApp4Provider1 = createAppWidgetProviderInfo(ComponentName.createRelative("app4", "provider1"));
mApp4Provider2 = createAppWidgetProviderInfo(ComponentName.createRelative("app4", ".provider2"));
mApp5Provider1 = createAppWidgetProviderInfo(ComponentName.createRelative("app5", "provider1"));
allWidgets = Arrays.asList(mApp1Provider1, mApp1Provider2, mApp2Provider1, mApp4Provider1, mApp4Provider2, mApp5Provider1);
AppWidgetManager manager = mModelHelper.sandboxContext.spyService(AppWidgetManager.class);
doReturn(allWidgets).when(manager).getInstalledProviders();
doReturn(allWidgets).when(manager).getInstalledProvidersForProfile(eq(myUserHandle()));
doAnswer(i -> {
String pkg = i.getArgument(0);
Log.e("Hello", "Getting v " + pkg);
return TextUtils.isEmpty(pkg) ? allWidgets : allWidgets.stream().filter(a -> pkg.equals(a.provider.getPackageName())).collect(Collectors.toList());
}).when(manager).getInstalledProvidersForPackage(any(), eq(myUserHandle()));
// 2 widgets, app4/provider1 & app5/provider1, have already been added to the workspace.
mModelHelper.initializeData("widgets_predication_update_task_data");
MAIN_EXECUTOR.submit(() -> mModelHelper.getModel().addCallbacks(mCallback)).get();
MODEL_EXECUTOR.post(() -> mModelHelper.getBgDataModel().widgetsModel.update(LauncherAppState.getInstance(mModelHelper.sandboxContext), /* packageUser= */
null));
MODEL_EXECUTOR.submit(() -> {
}).get();
MAIN_EXECUTOR.submit(() -> {
}).get();
}
use of com.android.launcher3.util.LauncherModelHelper in project android_packages_apps_404Launcher by P-404.
the class AddWorkspaceItemsTaskTest method setup.
@Before
public void setup() {
mModelHelper = new LauncherModelHelper();
mTargetContext = mModelHelper.sandboxContext;
mIdp = InvariantDeviceProfile.INSTANCE.get(mTargetContext);
mIdp.numColumns = mIdp.numRows = 5;
mAppState = LauncherAppState.getInstance(mTargetContext);
mExistingScreens = new IntArray();
mScreenOccupancy = new IntSparseArrayMap<>();
mNewScreens = new IntArray();
}
use of com.android.launcher3.util.LauncherModelHelper in project android_packages_apps_404Launcher by P-404.
the class BackupRestoreTest method setUp.
@Before
public void setUp() {
mModelHelper = new LauncherModelHelper();
mCurrentMyProfileId = mModelHelper.defaultProfileId;
mOldMyProfileId = mCurrentMyProfileId + 1;
mCurrentWorkProfileId = mOldMyProfileId + 1;
mOldWorkProfileId = mCurrentWorkProfileId + 1;
mWorkUserHandle = UserHandle.getUserHandleForUid(PER_USER_RANGE);
mUserChangeListener = UserCache.INSTANCE.get(mModelHelper.sandboxContext).addUserChangeListener(() -> {
});
setupUserManager();
setupBackupManager();
RestoreDbTask.setPending(mModelHelper.sandboxContext);
mDb = mModelHelper.provider.getDb();
mIdp = InvariantDeviceProfile.INSTANCE.get(mModelHelper.sandboxContext);
}
use of com.android.launcher3.util.LauncherModelHelper in project android_packages_apps_404Launcher by P-404.
the class GridSizeMigrationTaskV2Test method setUp.
@Before
public void setUp() {
mModelHelper = new LauncherModelHelper();
mContext = mModelHelper.sandboxContext;
mDb = mModelHelper.provider.getDb();
mValidPackages = new HashSet<>();
mValidPackages.add(TEST_PACKAGE);
mValidPackages.add(testPackage1);
mValidPackages.add(testPackage2);
mValidPackages.add(testPackage3);
mValidPackages.add(testPackage4);
mValidPackages.add(testPackage5);
mValidPackages.add(testPackage6);
mValidPackages.add(testPackage7);
mValidPackages.add(testPackage8);
mValidPackages.add(testPackage9);
mValidPackages.add(testPackage10);
mIdp = InvariantDeviceProfile.INSTANCE.get(mContext);
long userSerial = UserCache.INSTANCE.get(mContext).getSerialNumberForUser(Process.myUserHandle());
dropTable(mDb, LauncherSettings.Favorites.TMP_TABLE);
LauncherSettings.Favorites.addTableToDb(mDb, userSerial, false, LauncherSettings.Favorites.TMP_TABLE);
}
Aggregations