implements LauncherAppsCompat.OnAppsChangedCallbackCompat {
static final boolean DEBUG_LOADERS = false;
private static final boolean DEBUG_RECEIVER = false;
- private static final boolean REMOVE_UNRESTORED_ICONS = true;
static final String TAG = "Launcher.Model";
restored = false;
itemReplaced = true;
- } else if (REMOVE_UNRESTORED_ICONS) {
+ } else {
FileLog.d(TAG, "Unrestored package removed: " + cn);
itemsToRemove.add(id);
continue;
}
- } else if (REMOVE_UNRESTORED_ICONS) {
+ } else {
FileLog.d(TAG, "Unrestored package removed: " + cn);
itemsToRemove.add(id);
continue;
// App restore has started. Update the flag
appWidgetInfo.restoreStatus |=
LauncherAppWidgetInfo.FLAG_RESTORE_STARTED;
- } else if (REMOVE_UNRESTORED_ICONS && !isSafeMode) {
+ } else if (!isSafeMode) {
FileLog.d(TAG, "Unrestored widget removed: " + component);
itemsToRemove.add(id);
continue;
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;
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();
}
// 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)});