Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 929e3a27 authored by Andras Kloczl's avatar Andras Kloczl
Browse files

Remove widget panel related leftover workspace items

Upgrade launcher DB version and remove items with
widget panel IDs from the database.

Test: follow test instructions (in CL comment)
Bug: 198254728
Change-Id: I077a5f70ee93b7eca738b38f6b0e788d49f7ce70
parent 4926bf70
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -2,8 +2,9 @@
  // Note: Comments are not supported in JSON schema, but android parser is lenient.
  // Note: Comments are not supported in JSON schema, but android parser is lenient.


  // Maximum DB version supported by this schema
  // Maximum DB version supported by this schema
  "version" : 29,
  "version" : 30,


  "downgrade_to_29" : [],
  "downgrade_to_28" : [
  "downgrade_to_28" : [
    "ALTER TABLE favorites RENAME TO temp_favorites;",
    "ALTER TABLE favorites RENAME TO temp_favorites;",
    "CREATE TABLE favorites(_id INTEGER PRIMARY KEY, title TEXT, intent TEXT, container INTEGER, screen INTEGER, cellX INTEGER, cellY INTEGER, spanX INTEGER, spanY INTEGER, itemType INTEGER, appWidgetId INTEGER NOT NULL DEFAULT - 1, iconPackage TEXT, iconResource TEXT, icon BLOB, appWidgetProvider TEXT, modified INTEGER NOT NULL DEFAULT 0, restored INTEGER NOT NULL DEFAULT 0, profileId INTEGER DEFAULT 0, rank INTEGER NOT NULL DEFAULT 0, options INTEGER NOT NULL DEFAULT 0);",
    "CREATE TABLE favorites(_id INTEGER PRIMARY KEY, title TEXT, intent TEXT, container INTEGER, screen INTEGER, cellX INTEGER, cellY INTEGER, spanX INTEGER, spanY INTEGER, itemType INTEGER, appWidgetId INTEGER NOT NULL DEFAULT - 1, iconPackage TEXT, iconResource TEXT, icon BLOB, appWidgetProvider TEXT, modified INTEGER NOT NULL DEFAULT 0, restored INTEGER NOT NULL DEFAULT 0, profileId INTEGER DEFAULT 0, rank INTEGER NOT NULL DEFAULT 0, options INTEGER NOT NULL DEFAULT 0);",
+6 −1
Original line number Original line Diff line number Diff line
@@ -97,7 +97,7 @@ public class LauncherProvider extends ContentProvider {
     * Represents the schema of the database. Changes in scheme need not be backwards compatible.
     * Represents the schema of the database. Changes in scheme need not be backwards compatible.
     * When increasing the scheme version, ensure that downgrade_schema.json is updated
     * When increasing the scheme version, ensure that downgrade_schema.json is updated
     */
     */
    public static final int SCHEMA_VERSION = 29;
    public static final int SCHEMA_VERSION = 30;


    public static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".settings";
    public static final String AUTHORITY = BuildConfig.APPLICATION_ID + ".settings";
    public static final String KEY_LAYOUT_PROVIDER_AUTHORITY = "KEY_LAYOUT_PROVIDER_AUTHORITY";
    public static final String KEY_LAYOUT_PROVIDER_AUTHORITY = "KEY_LAYOUT_PROVIDER_AUTHORITY";
@@ -864,6 +864,11 @@ public class LauncherProvider extends ContentProvider {
                    }
                    }
                }
                }
                case 29: {
                case 29: {
                    // Remove widget panel related leftover workspace items
                    db.delete(Favorites.TABLE_NAME, Utilities.createDbSelectionQuery(
                            Favorites.SCREEN, IntArray.wrap(-777, -778)), null);
                }
                case 30: {
                    // DB Upgraded successfully
                    // DB Upgraded successfully
                    return;
                    return;
                }
                }