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:
1 parent
814d644d81
commit
658c5dafd4
16 files changed
+139
-17
No files matched your search
@@ -15,14 +15,15 @@
|
||||
*/
|
||||
package com.android.launcher3.widget;
|
||||
|
||||
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY;
|
||||
|
||||
import android.appwidget.AppWidgetHostView;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.PendingAddItemInfo;
|
||||
import com.android.launcher3.logger.LauncherAtom;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.widget.util.WidgetSizes;
|
||||
|
||||
/**
|
||||
@@ -36,8 +37,9 @@ public class PendingAddWidgetInfo extends PendingAddItemInfo {
|
||||
public LauncherAppWidgetProviderInfo info;
|
||||
public AppWidgetHostView boundWidget;
|
||||
public Bundle bindOptions = null;
|
||||
public int sourceContainer;
|
||||
|
||||
public PendingAddWidgetInfo(LauncherAppWidgetProviderInfo i) {
|
||||
public PendingAddWidgetInfo(LauncherAppWidgetProviderInfo i, int container) {
|
||||
if (i.isCustomWidget()) {
|
||||
itemType = LauncherSettings.Favorites.ITEM_TYPE_CUSTOM_APPWIDGET;
|
||||
} else {
|
||||
@@ -53,7 +55,7 @@ public class PendingAddWidgetInfo extends PendingAddItemInfo {
|
||||
spanY = i.spanY;
|
||||
minSpanX = i.minSpanX;
|
||||
minSpanY = i.minSpanY;
|
||||
this.container = CONTAINER_WIDGETS_TRAY;
|
||||
this.sourceContainer = this.container = container;
|
||||
}
|
||||
|
||||
public WidgetAddFlowHandler getHandler() {
|
||||
@@ -63,4 +65,12 @@ public class PendingAddWidgetInfo extends PendingAddItemInfo {
|
||||
public Bundle getDefaultSizeOptions(Context context) {
|
||||
return WidgetSizes.getWidgetSizeOptions(context, componentName, spanX, spanY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LauncherAtom.ItemInfo buildProto(FolderInfo folderInfo) {
|
||||
LauncherAtom.ItemInfo info = super.buildProto(folderInfo);
|
||||
return info.toBuilder()
|
||||
.setAttribute(LauncherAppWidgetInfo.getAttribute(sourceContainer))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user