summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2019-12-16 17:43:13 (GMT)
committerHyunyoung Song <hyunyoungs@google.com>2019-12-18 22:34:55 (GMT)
commitb0738b0739dac1dc8b55e3c83e36188ba66974e9 (patch)
tree5d8e7818fe70ca8beec15ebb06275a885225f4a4
parentaf431d130c91a58ce94378944cf5fe6bad7e4681 (diff)
downloadandroid_packages_apps_Trebuchet-b0738b0739dac1dc8b55e3c83e36188ba66974e9.zip
android_packages_apps_Trebuchet-b0738b0739dac1dc8b55e3c83e36188ba66974e9.tar.gz
android_packages_apps_Trebuchet-b0738b0739dac1dc8b55e3c83e36188ba66974e9.tar.bz2
Fix shortcut componentname in workspace layout logging
Bug: 146172747 Test: $ adb shell dumpsys activity provider com.google.android.apps.nexuslauncher/com.android.launcher3.LauncherProvider --proto --debug SHORTCUT, package=com.android.vending, component=VIEW_MY_DOWNLOADS, grid(3,4), span(1,1), pageIdx=0 user=0 Change-Id: Ic8537d499d66675fbe190f137b50fb693d6c21d5 (cherry picked from commit b9ba427576d6597a3cbf15fcbba2b4ed14a6ca12)
-rw-r--r--src/com/android/launcher3/logging/DumpTargetWrapper.java32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/com/android/launcher3/logging/DumpTargetWrapper.java b/src/com/android/launcher3/logging/DumpTargetWrapper.java
index 365e8f2..067bdfd 100644
--- a/src/com/android/launcher3/logging/DumpTargetWrapper.java
+++ b/src/com/android/launcher3/logging/DumpTargetWrapper.java
@@ -15,17 +15,22 @@
*/
package com.android.launcher3.logging;
+import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
+
+import android.content.ComponentName;
import android.os.Process;
import android.text.TextUtils;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherSettings;
+import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.model.nano.LauncherDumpProto;
import com.android.launcher3.model.nano.LauncherDumpProto.ContainerType;
import com.android.launcher3.model.nano.LauncherDumpProto.DumpTarget;
import com.android.launcher3.model.nano.LauncherDumpProto.ItemType;
import com.android.launcher3.model.nano.LauncherDumpProto.UserType;
+import com.android.launcher3.util.ShortcutUtil;
import java.util.ArrayList;
import java.util.List;
@@ -73,20 +78,23 @@ public class DumpTargetWrapper {
public DumpTarget newItemTarget(ItemInfo info) {
DumpTarget dt = new DumpTarget();
dt.type = DumpTarget.Type.ITEM;
-
+ if (info == null) {
+ return dt;
+ }
switch (info.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
dt.itemType = ItemType.APP_ICON;
break;
- case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
- dt.itemType = ItemType.UNKNOWN_ITEMTYPE;
- break;
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
dt.itemType = ItemType.WIDGET;
break;
- case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT:
+ case ITEM_TYPE_DEEP_SHORTCUT:
+ case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
dt.itemType = ItemType.SHORTCUT;
break;
+ default:
+ dt.itemType = ItemType.UNKNOWN_ITEMTYPE;
+ break;
}
return dt;
}
@@ -120,6 +128,9 @@ public class DumpTargetWrapper {
}
private static String getItemStr(DumpTarget t) {
+ if (t == null) {
+ return "";
+ }
String typeStr = LoggerUtils.getFieldName(t.itemType, ItemType.class);
if (!TextUtils.isEmpty(t.packageName)) {
typeStr += ", package=" + t.packageName;
@@ -132,8 +143,15 @@ public class DumpTargetWrapper {
}
public DumpTarget writeToDumpTarget(ItemInfo info) {
- node.component = info.getTargetComponent() == null? "":
- info.getTargetComponent().flattenToString();
+ if (info == null) {
+ return node;
+ }
+ if (ShortcutUtil.isDeepShortcut(info)) {
+ node.component = ((WorkspaceItemInfo) info).getDeepShortcutId();
+ } else {
+ ComponentName cmp = info.getTargetComponent();
+ node.component = cmp == null ? "" : cmp.flattenToString();
+ }
node.packageName = info.getTargetComponent() == null? "":
info.getTargetComponent().getPackageName();
if (info instanceof LauncherAppWidgetInfo) {