mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 18:58:19 +00:00
Revert "Revert "Revert "Revert "Changing GridMigrationTask to use ModelDbController directly""""
This reverts commit 3772b246c2.
Reason for revert: Fixed the test failure
Change-Id: Ibdc9e184fcb32c7caa4ab25d8753a46fa322b703
This commit is contained in:
@@ -16,16 +16,16 @@
|
||||
|
||||
package com.android.launcher3.model;
|
||||
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.TABLE_NAME;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherActivityInfo;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.database.Cursor;
|
||||
import android.database.CursorWrapper;
|
||||
import android.net.Uri;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.BaseColumns;
|
||||
import android.text.TextUtils;
|
||||
@@ -66,9 +66,7 @@ public class LoaderCursor extends CursorWrapper {
|
||||
private final LongSparseArray<UserHandle> allUsers;
|
||||
|
||||
private final LauncherAppState mApp;
|
||||
private final Uri mContentUri;
|
||||
private final Context mContext;
|
||||
private final PackageManager mPM;
|
||||
private final IconCache mIconCache;
|
||||
private final InvariantDeviceProfile mIDP;
|
||||
|
||||
@@ -108,17 +106,14 @@ public class LoaderCursor extends CursorWrapper {
|
||||
public int itemType;
|
||||
public int restoreFlag;
|
||||
|
||||
public LoaderCursor(Cursor cursor, Uri contentUri, LauncherAppState app,
|
||||
UserManagerState userManagerState) {
|
||||
public LoaderCursor(Cursor cursor, LauncherAppState app, UserManagerState userManagerState) {
|
||||
super(cursor);
|
||||
|
||||
mApp = app;
|
||||
allUsers = userManagerState.allUsers;
|
||||
mContentUri = contentUri;
|
||||
mContext = app.getContext();
|
||||
mIconCache = app.getIconCache();
|
||||
mIDP = app.getInvariantDeviceProfile();
|
||||
mPM = mContext.getPackageManager();
|
||||
|
||||
// Init column indices
|
||||
mIconIndex = getColumnIndexOrThrow(Favorites.ICON);
|
||||
@@ -390,7 +385,7 @@ public class LoaderCursor extends CursorWrapper {
|
||||
*/
|
||||
public ContentWriter updater() {
|
||||
return new ContentWriter(mContext, new ContentWriter.CommitParams(
|
||||
mApp.getModel().getModelDbController().getDatabaseHelper(),
|
||||
mApp.getModel().getModelDbController(),
|
||||
BaseColumns._ID + "= ?", new String[]{Integer.toString(id)}));
|
||||
}
|
||||
|
||||
@@ -409,8 +404,8 @@ public class LoaderCursor extends CursorWrapper {
|
||||
public boolean commitDeleted() {
|
||||
if (mItemsToRemove.size() > 0) {
|
||||
// Remove dead items
|
||||
mContext.getContentResolver().delete(mContentUri, Utilities.createDbSelectionQuery(
|
||||
Favorites._ID, mItemsToRemove), null);
|
||||
mApp.getModel().getModelDbController().delete(TABLE_NAME,
|
||||
Utilities.createDbSelectionQuery(Favorites._ID, mItemsToRemove), null);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -435,9 +430,8 @@ public class LoaderCursor extends CursorWrapper {
|
||||
// Update restored items that no longer require special handling
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(Favorites.RESTORED, 0);
|
||||
mContext.getContentResolver().update(mContentUri, values,
|
||||
Utilities.createDbSelectionQuery(
|
||||
Favorites._ID, mRestoredRows), null);
|
||||
mApp.getModel().getModelDbController().update(TABLE_NAME, values,
|
||||
Utilities.createDbSelectionQuery(Favorites._ID, mRestoredRows), null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user