diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-08-29 10:06:57 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2016-08-29 11:19:26 -0700 |
commit | b05a00a441d7e608fd709fae62bde1c661936e2a (patch) | |
tree | 45cbfdfacd22198f383652c1de06fca7b251c565 /src/com/android/launcher3/provider | |
parent | 4a4b49ff3482cbe7f8192807cdc99437810fe518 (diff) | |
download | android_packages_apps_Trebuchet-b05a00a441d7e608fd709fae62bde1c661936e2a.tar.gz android_packages_apps_Trebuchet-b05a00a441d7e608fd709fae62bde1c661936e2a.tar.bz2 android_packages_apps_Trebuchet-b05a00a441d7e608fd709fae62bde1c661936e2a.zip |
Adding a debug flag to prevent broken downlodas from getting removed during
restore
After setting this flag apps do not need to have an active settion during restore
which would simplyfy debugging backup-restore bugs.
Change-Id: I89f2d3ec677281887f8bab8559ace991709caadc
Diffstat (limited to 'src/com/android/launcher3/provider')
-rw-r--r-- | src/com/android/launcher3/provider/RestoreDbTask.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/com/android/launcher3/provider/RestoreDbTask.java b/src/com/android/launcher3/provider/RestoreDbTask.java index 9d8b6b3f4..47bee0669 100644 --- a/src/com/android/launcher3/provider/RestoreDbTask.java +++ b/src/com/android/launcher3/provider/RestoreDbTask.java @@ -24,6 +24,7 @@ import android.database.sqlite.SQLiteDatabase; import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherProvider.DatabaseHelper; import com.android.launcher3.LauncherSettings.Favorites; +import com.android.launcher3.ShortcutInfo; import com.android.launcher3.Utilities; import com.android.launcher3.logging.FileLog; @@ -43,6 +44,13 @@ public class RestoreDbTask { private static final String INFO_COLUMN_NAME = "name"; private static final String INFO_COLUMN_DEFAULT_VALUE = "dflt_value"; + /** + * When enabled all icons are kept on the home screen, even if they don't have an active + * session. To enable use: + * adb shell setprop log.tag.launcher_keep_all_icons VERBOSE + */ + private static final String KEEP_ALL_ICONS = "launcher_keep_all_icons"; + public static boolean performRestore(DatabaseHelper helper) { SQLiteDatabase db = helper.getWritableDatabase(); db.beginTransaction(); @@ -77,15 +85,17 @@ public class RestoreDbTask { } // Mark all items as restored. + boolean keepAllIcons = Utilities.isPropertyEnabled(KEEP_ALL_ICONS); ContentValues values = new ContentValues(); - values.put(Favorites.RESTORED, 1); + values.put(Favorites.RESTORED, ShortcutInfo.FLAG_RESTORED_ICON + | (keepAllIcons ? ShortcutInfo.FLAG_RESTORE_STARTED : 0)); db.update(Favorites.TABLE_NAME, values, null, null); // Mark widgets with appropriate restore flag - values.put(Favorites.RESTORED, - LauncherAppWidgetInfo.FLAG_ID_NOT_VALID | - LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY | - LauncherAppWidgetInfo.FLAG_UI_NOT_READY); + values.put(Favorites.RESTORED, LauncherAppWidgetInfo.FLAG_ID_NOT_VALID | + LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY | + LauncherAppWidgetInfo.FLAG_UI_NOT_READY | + (keepAllIcons ? LauncherAppWidgetInfo.FLAG_RESTORE_STARTED : 0)); db.update(Favorites.TABLE_NAME, values, "itemType = ?", new String[]{Integer.toString(Favorites.ITEM_TYPE_APPWIDGET)}); |