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 committed 2021-06-30 17:48:14 +00:00
1 parent 814d644d81
commit 658c5dafd4
16 files changed
+139 -17

No files matched your search

@@ -16,6 +16,7 @@
package com.android.launcher3.widget;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY;
import static com.android.launcher3.Utilities.ATLEAST_S;
import android.content.Context;
@@ -99,6 +100,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
private RemoteViews mRemoteViewsPreview;
private NavigableAppWidgetHostView mAppWidgetHostViewPreview;
private int mSourceContainer = CONTAINER_WIDGETS_TRAY;
public WidgetCell(Context context) {
this(context, null);
@@ -177,6 +179,10 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
mAppWidgetHostViewPreview = null;
}
public void setSourceContainer(int sourceContainer) {
this.mSourceContainer = sourceContainer;
}
public void applyFromCellItem(WidgetItem item, WidgetPreviewLoader loader) {
applyPreviewOnAppWidgetHostView(item);
@@ -205,7 +211,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
mPreviewWidth += mShortcutPreviewPadding;
mPreviewHeight += mShortcutPreviewPadding;
} else {
setTag(new PendingAddWidgetInfo(item.widgetInfo));
setTag(new PendingAddWidgetInfo(item.widgetInfo, mSourceContainer));
}
}