Homescreen migration from a larger grid to a smaller grid.

Adding support for restoring from a larger device, if the grid size
difference is not more that 1.
During restore add all the items in the DB, and run a one-time migration
the next time launcher starts.

The migration strategy is defined in ShrinkWorkspaceTask.java which involves
resizing, moving and removing some items.

Change-Id: I6ee411f6db5bf0152b527e16146a88c56dec2d97
This commit is contained in:
Sunny Goyal
2015-07-27 14:36:07 -07:00
parent e40e77b34f
commit e5bb705fb7
8 changed files with 848 additions and 21 deletions

View File

@@ -24,6 +24,8 @@ import android.database.Cursor;
import android.os.ParcelFileDescriptor;
import android.util.Log;
import com.android.launcher3.model.MigrateFromRestoreTask;
import java.io.IOException;
public class LauncherBackupAgentHelper extends BackupAgentHelper {
@@ -96,6 +98,13 @@ public class LauncherBackupAgentHelper extends BackupAgentHelper {
LauncherAppState.getLauncherProvider().updateFolderItemsRank();
}
if (mHelper.shouldAttemptWorkspaceMigration()) {
MigrateFromRestoreTask.markForMigration(getApplicationContext(),
(int) mHelper.migrationCompatibleProfileData.desktopCols,
(int) mHelper.migrationCompatibleProfileData.desktopRows,
mHelper.widgetSizes);
}
LauncherAppState.getLauncherProvider().convertShortcutsToLauncherActivities();
} else {
if (VERBOSE) Log.v(TAG, "Nothing was restored, clearing DB");