use of com.android.launcher3.util.LauncherModelHelper in project android_packages_apps_404Launcher by P-404.
the class LoaderCursorTest method setup.
@Before
public void setup() {
mModelHelper = new LauncherModelHelper();
mContext = mModelHelper.sandboxContext;
mIDP = InvariantDeviceProfile.INSTANCE.get(mContext);
mApp = LauncherAppState.getInstance(mContext);
mCursor = new MatrixCursor(new String[] { ICON, ICON_PACKAGE, ICON_RESOURCE, TITLE, _ID, CONTAINER, ITEM_TYPE, PROFILE_ID, SCREEN, CELLX, CELLY, RESTORED, INTENT });
UserManagerState ums = new UserManagerState();
mLoaderCursor = new LoaderCursor(mCursor, Favorites.CONTENT_URI, mApp, ums);
ums.allUsers.put(0, Process.myUserHandle());
}
use of com.android.launcher3.util.LauncherModelHelper in project android_packages_apps_404Launcher by P-404.
the class PackageInstallStateChangedTaskTest method setup.
@Before
public void setup() throws Exception {
mModelHelper = new LauncherModelHelper();
mModelHelper.initializeData("package_install_state_change_task_data");
}
use of com.android.launcher3.util.LauncherModelHelper in project android_packages_apps_404Launcher by P-404.
the class LauncherModelHelper method setupDefaultLayoutProvider.
/**
* Sets up a mock provider to load the provided layout by default, next time the layout loads
*/
public LauncherModelHelper setupDefaultLayoutProvider(LauncherLayoutBuilder builder) throws Exception {
InvariantDeviceProfile idp = InvariantDeviceProfile.INSTANCE.get(sandboxContext);
idp.numRows = idp.numColumns = idp.numDatabaseHotseatIcons = DEFAULT_GRID_SIZE;
idp.iconBitmapSize = DEFAULT_BITMAP_SIZE;
UiDevice.getInstance(getInstrumentation()).executeShellCommand("settings put secure launcher3.layout.provider " + TEST_PROVIDER_AUTHORITY);
ContentProvider cp = new TestInformationProvider() {
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
try {
ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createPipe();
AutoCloseOutputStream outputStream = new AutoCloseOutputStream(pipe[1]);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
builder.build(new OutputStreamWriter(bos));
outputStream.write(bos.toByteArray());
outputStream.flush();
outputStream.close();
return pipe[0];
} catch (Exception e) {
throw new FileNotFoundException(e.getMessage());
}
}
};
setupProvider(TEST_PROVIDER_AUTHORITY, cp);
return this;
}
use of com.android.launcher3.util.LauncherModelHelper in project android_packages_apps_Launcher3 by crdroidandroid.
the class GridSizeMigrationTaskTest method setUp.
@Before
public void setUp() {
mModelHelper = new LauncherModelHelper();
mContext = RuntimeEnvironment.application;
mDb = mModelHelper.provider.getDb();
mValidPackages = new HashSet<>();
mValidPackages.add(TEST_PACKAGE);
mIdp = InvariantDeviceProfile.INSTANCE.get(mContext);
}
use of com.android.launcher3.util.LauncherModelHelper in project android_packages_apps_Launcher3 by crdroidandroid.
the class ModelMultiCallbacksTest method setUp.
@Before
public void setUp() throws Exception {
mModelHelper = new LauncherModelHelper();
mModelHelper.installApp(TEST_PACKAGE);
mSpm = shadowOf(RuntimeEnvironment.application.getPackageManager());
// Since robolectric tests run on main thread, we run the loader-UI calls on a temp thread,
// so that we can wait appropriately for the loader to complete.
mTempMainExecutor = new LooperExecutor(createAndStartNewLooper("tempMain"));
ShadowLooperExecutor sle = Shadow.extract(Executors.MAIN_EXECUTOR);
sle.setHandler(mTempMainExecutor.getHandler());
}
Aggregations