Re-initialize max ids after changing grid size
This commit is contained in:
@@ -452,6 +452,10 @@ public class LauncherProvider extends ContentProvider {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
case LauncherSettings.Settings.METHOD_RE_INITIALIZE_IDS: {
|
||||
mOpenHelper.reInitIds();
|
||||
return null;
|
||||
}
|
||||
case LauncherSettings.Settings.METHOD_PREP_FOR_PREVIEW: {
|
||||
if (MULTI_DB_GRID_MIRATION_ALGO.get()) {
|
||||
Bundle result = new Bundle();
|
||||
@@ -704,6 +708,11 @@ public class LauncherProvider extends ContentProvider {
|
||||
}
|
||||
}
|
||||
|
||||
protected void reInitIds() {
|
||||
mMaxItemId = initializeMaxItemId(getWritableDatabase());
|
||||
mMaxScreenId = initializeMaxScreenId(getWritableDatabase());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase db) {
|
||||
if (LOGD) Log.d(TAG, "creating new launcher database");
|
||||
|
||||
@@ -381,6 +381,8 @@ public class LauncherSettings {
|
||||
|
||||
public static final String METHOD_UPDATE_CURRENT_OPEN_HELPER = "update_current_open_helper";
|
||||
|
||||
public static final String METHOD_RE_INITIALIZE_IDS = "re_initialize_ids";
|
||||
|
||||
public static final String METHOD_PREP_FOR_PREVIEW = "prep_for_preview";
|
||||
|
||||
public static final String METHOD_SWITCH_DATABASE = "switch_database";
|
||||
|
||||
@@ -205,6 +205,11 @@ public class GridSizeMigrationTaskV2 {
|
||||
}
|
||||
|
||||
t.commit();
|
||||
|
||||
// reinitialize max ids
|
||||
LauncherSettings.Settings.call(context.getContentResolver(),
|
||||
LauncherSettings.Settings.METHOD_RE_INITIALIZE_IDS);
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Error during grid migration", e);
|
||||
|
||||
Reference in New Issue
Block a user