summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherModel.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-12-14 14:27:38 -0800
committerSunny Goyal <sunnygoyal@google.com>2016-01-06 10:16:44 -0800
commitf862a26347b583bd84be22a8ceff4bc13158ec7e (patch)
tree1f5a38b3f23b23c90f39210501737077cafd5fc1 /src/com/android/launcher3/LauncherModel.java
parent52279f3bc3878a4e919ae32a7f62ee4bf8eb7070 (diff)
downloadandroid_packages_apps_Trebuchet-f862a26347b583bd84be22a8ceff4bc13158ec7e.tar.gz
android_packages_apps_Trebuchet-f862a26347b583bd84be22a8ceff4bc13158ec7e.tar.bz2
android_packages_apps_Trebuchet-f862a26347b583bd84be22a8ceff4bc13158ec7e.zip
Extending the grid migration logic to handle density changes
For hotseat migratino, we simply drop the items with least weight If the workspace row/column decreases by 2 or more, we clear the whole workspace Bug: 25958224 Change-Id: I7131b955023d185ed10955f593184b9238546dc8
Diffstat (limited to 'src/com/android/launcher3/LauncherModel.java')
-rw-r--r--src/com/android/launcher3/LauncherModel.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index fe0abc024..0eb1a90b0 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -57,7 +57,7 @@ import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
import com.android.launcher3.compat.UserHandleCompat;
import com.android.launcher3.compat.UserManagerCompat;
import com.android.launcher3.config.ProviderConfig;
-import com.android.launcher3.model.MigrateFromRestoreTask;
+import com.android.launcher3.model.GridSizeMigrationTask;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.CursorIconInfo;
@@ -1651,14 +1651,14 @@ public class LauncherModel extends BroadcastReceiver
int countX = profile.numColumns;
int countY = profile.numRows;
- if (MigrateFromRestoreTask.ENABLED && MigrateFromRestoreTask.shouldRunTask(mContext)) {
+ if (GridSizeMigrationTask.ENABLED && GridSizeMigrationTask.shouldRunTask(mContext)) {
long migrationStartTime = System.currentTimeMillis();
Log.v(TAG, "Starting workspace migration after restore");
try {
- MigrateFromRestoreTask task = new MigrateFromRestoreTask(mContext);
+ GridSizeMigrationTask task = new GridSizeMigrationTask(mContext);
// Clear the flags before starting the task, so that we do not run the task
// again, in case there was an uncaught error.
- MigrateFromRestoreTask.clearFlags(mContext);
+ GridSizeMigrationTask.clearFlags(mContext);
task.execute();
} catch (Exception e) {
Log.e(TAG, "Error during grid migration", e);
@@ -1668,6 +1668,8 @@ public class LauncherModel extends BroadcastReceiver
}
Log.v(TAG, "Workspace migration completed in "
+ (System.currentTimeMillis() - migrationStartTime));
+
+ GridSizeMigrationTask.saveCurrentConfig(mContext);
}
if ((mFlags & LOADER_FLAG_CLEAR_WORKSPACE) != 0) {