Log widgets source.

Test: manual
(1) Upgrading to new DB version is successful (no errors thrown in logcat)
(2) Widgets that were added with the old DB version have CONTAINER_UNKNOWN as their source container
(3) Widgets that are added with the new DB version still log source container after reboot
Bug: 185778648
Change-Id: Iaa38f0be6bc4cb0d29842f9a2ea0d08de000c930
This commit is contained in:
Yogisha Dixit
2021-06-30 17:48:14 +00:00
parent 814d644d81
commit 658c5dafd4
16 changed files with 139 additions and 17 deletions
@@ -197,6 +197,8 @@ public class LauncherSettings {
public static final int CONTAINER_HOTSEAT_PREDICTION = -103;
public static final int CONTAINER_ALL_APPS = -104;
public static final int CONTAINER_WIDGETS_TRAY = -105;
public static final int CONTAINER_BOTTOM_WIDGETS_TRAY = -112;
public static final int CONTAINER_PIN_WIDGETS = -113;
// Represents search results view.
public static final int CONTAINER_SEARCH_RESULTS = -106;
public static final int CONTAINER_SHORTCUTS = -107;
@@ -207,6 +209,8 @@ public class LauncherSettings {
// Represents any of the extended containers implemented in non-AOSP variants.
public static final int EXTENDED_CONTAINERS = -200;
public static final int CONTAINER_UNKNOWN = -1;
public static final String containerToString(int container) {
switch (container) {
case CONTAINER_DESKTOP: return "desktop";
@@ -306,6 +310,12 @@ public class LauncherSettings {
*/
public static final String OPTIONS = "options";
/**
* Stores the source container that the widget was added from.
* <p>Type: INTEGER</p>
*/
public static final String APPWIDGET_SOURCE = "appWidgetSource";
public static void addTableToDb(SQLiteDatabase db, long myProfileId, boolean optional) {
addTableToDb(db, myProfileId, optional, TABLE_NAME);
}
@@ -333,7 +343,8 @@ public class LauncherSettings {
"restored INTEGER NOT NULL DEFAULT 0," +
"profileId INTEGER DEFAULT " + myProfileId + "," +
"rank INTEGER NOT NULL DEFAULT 0," +
"options INTEGER NOT NULL DEFAULT 0" +
"options INTEGER NOT NULL DEFAULT 0," +
APPWIDGET_SOURCE + " INTEGER NOT NULL DEFAULT " + CONTAINER_UNKNOWN +
");");
}
}