summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherBackupAgentHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher3/LauncherBackupAgentHelper.java')
-rw-r--r--src/com/android/launcher3/LauncherBackupAgentHelper.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/com/android/launcher3/LauncherBackupAgentHelper.java b/src/com/android/launcher3/LauncherBackupAgentHelper.java
index 3868a57f1..8eb4e6369 100644
--- a/src/com/android/launcher3/LauncherBackupAgentHelper.java
+++ b/src/com/android/launcher3/LauncherBackupAgentHelper.java
@@ -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 {
@@ -32,7 +34,7 @@ public class LauncherBackupAgentHelper extends BackupAgentHelper {
private static final String LAUNCHER_DATA_PREFIX = "L";
- static final boolean VERBOSE = true;
+ static final boolean VERBOSE = false;
static final boolean DEBUG = false;
private static BackupManager sBackupManager;
@@ -63,7 +65,7 @@ public class LauncherBackupAgentHelper extends BackupAgentHelper {
@Override
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState)
throws IOException {
- if (!Utilities.isLmpOrAbove()) {
+ if (!Utilities.ATLEAST_LOLLIPOP) {
// No restore for old devices.
Log.i(TAG, "You shall not pass!!!");
Log.d(TAG, "Restore is only supported on devices running Lollipop and above.");
@@ -78,7 +80,7 @@ public class LauncherBackupAgentHelper extends BackupAgentHelper {
super.onRestore(data, appVersionCode, newState);
// If no favorite was migrated, clear the data and start fresh.
final Cursor c = getContentResolver().query(
- LauncherSettings.Favorites.CONTENT_URI_NO_NOTIFICATION, null, null, null, null);
+ LauncherSettings.Favorites.CONTENT_URI, null, null, null, null);
hasData = c.moveToNext();
c.close();
} catch (Exception e) {
@@ -90,6 +92,20 @@ public class LauncherBackupAgentHelper extends BackupAgentHelper {
if (hasData && mHelper.restoreSuccessful) {
LauncherAppState.getLauncherProvider().clearFlagEmptyDbCreated();
LauncherClings.synchonouslyMarkFirstRunClingDismissed(this);
+
+ // Rank was added in v4.
+ if (mHelper.restoredBackupVersion <= 3) {
+ LauncherAppState.getLauncherProvider().updateFolderItemsRank();
+ }
+
+ if (MigrateFromRestoreTask.ENABLED && 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");
LauncherAppState.getLauncherProvider().createEmptyDB();