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-05-24 23:23:15 +01:00
parent 814d644d81
commit 658c5dafd4
16 changed files with 139 additions and 17 deletions
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.model;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_PREDICTION;
import android.app.prediction.AppTarget;
import android.content.ComponentName;
import android.text.TextUtils;
@@ -73,7 +75,9 @@ public final class WidgetsPredictionUpdateTask extends BaseModelUpdateTask {
if (notAddedWidgets.size() > 0) {
// Even an apps have more than one widgets, we only include one widget.
fixedContainerItems.items.add(
new PendingAddWidgetInfo(notAddedWidgets.get(0).widgetInfo));
new PendingAddWidgetInfo(
notAddedWidgets.get(0).widgetInfo,
CONTAINER_WIDGETS_PREDICTION));
}
}
}
@@ -90,7 +94,9 @@ public final class WidgetsPredictionUpdateTask extends BaseModelUpdateTask {
new ComponentName(app.getPackageName(), app.getClassName()), app.getUser());
if (widgetItems.containsKey(targetWidget)) {
fixedContainerItems.items.add(
new PendingAddWidgetInfo(widgetItems.get(targetWidget).widgetInfo));
new PendingAddWidgetInfo(widgetItems.get(
targetWidget).widgetInfo,
CONTAINER_WIDGETS_PREDICTION));
}
}
}