Cleanup LoggerUtils
Change-Id: Ibeccb61b25236ee905f61bdb5ea2255f778d4b05
This commit is contained in:
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.android.launcher3.logging;
|
||||
|
||||
import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType.NAVBAR;
|
||||
|
||||
import android.util.ArrayMap;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
@@ -27,12 +25,9 @@ import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogExtensions.TargetExtension;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.ItemType;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.TipType;
|
||||
import com.android.launcher3.util.InstantAppResolver;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@@ -70,93 +65,6 @@ public class LoggerUtils {
|
||||
return result != null ? result : UNKNOWN;
|
||||
}
|
||||
|
||||
public static String getActionStr(Action action) {
|
||||
String str = "";
|
||||
switch (action.type) {
|
||||
case Action.Type.TOUCH:
|
||||
str += getFieldName(action.touch, Action.Touch.class);
|
||||
if (action.touch == Action.Touch.SWIPE || action.touch == Action.Touch.FLING) {
|
||||
str += " direction=" + getFieldName(action.dir, Action.Direction.class);
|
||||
}
|
||||
break;
|
||||
case Action.Type.COMMAND:
|
||||
str += getFieldName(action.command, Action.Command.class);
|
||||
break;
|
||||
default: return getFieldName(action.type, Action.Type.class);
|
||||
}
|
||||
if (action.touch == Action.Touch.SWIPE || action.touch == Action.Touch.FLING ||
|
||||
(action.command == Action.Command.BACK && action.dir != Action.Direction.NONE)) {
|
||||
str += " direction=" + getFieldName(action.dir, Action.Direction.class);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static String getTargetStr(Target t) {
|
||||
if (t == null) {
|
||||
return "";
|
||||
}
|
||||
String str = "";
|
||||
switch (t.type) {
|
||||
case Target.Type.ITEM:
|
||||
str = getItemStr(t);
|
||||
break;
|
||||
case Target.Type.CONTROL:
|
||||
str = getFieldName(t.controlType, ControlType.class);
|
||||
break;
|
||||
case Target.Type.CONTAINER:
|
||||
str = getFieldName(t.containerType, ContainerType.class);
|
||||
if (t.containerType == ContainerType.WORKSPACE ||
|
||||
t.containerType == ContainerType.HOTSEAT ||
|
||||
t.containerType == NAVBAR) {
|
||||
str += " id=" + t.pageIndex;
|
||||
} else if (t.containerType == ContainerType.FOLDER) {
|
||||
str += " grid(" + t.gridX + "," + t.gridY + ")";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
str += "UNKNOWN TARGET TYPE";
|
||||
}
|
||||
|
||||
if (t.spanX != 1 || t.spanY != 1) {
|
||||
str += " span(" + t.spanX + "," + t.spanY + ")";
|
||||
}
|
||||
|
||||
if (t.tipType != TipType.DEFAULT_NONE) {
|
||||
str += " " + getFieldName(t.tipType, TipType.class);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
private static String getItemStr(Target t) {
|
||||
String typeStr = getFieldName(t.itemType, ItemType.class);
|
||||
if (t.packageNameHash != 0) {
|
||||
typeStr += ", packageHash=" + t.packageNameHash;
|
||||
}
|
||||
if (t.componentHash != 0) {
|
||||
typeStr += ", componentHash=" + t.componentHash;
|
||||
}
|
||||
if (t.intentHash != 0) {
|
||||
typeStr += ", intentHash=" + t.intentHash;
|
||||
}
|
||||
if (t.itemType == ItemType.FOLDER_ICON) {
|
||||
typeStr += ", grid(" + t.gridX + "," + t.gridY + ")";
|
||||
} else if ((t.packageNameHash != 0 || t.componentHash != 0 || t.intentHash != 0)
|
||||
&& t.itemType != ItemType.TASK) {
|
||||
typeStr +=
|
||||
", isWorkApp=" + t.isWorkApp + ", predictiveRank=" + t.predictedRank + ", grid("
|
||||
+ t.gridX + "," + t.gridY + "), span(" + t.spanX + "," + t.spanY
|
||||
+ "), pageIdx=" + t.pageIndex;
|
||||
}
|
||||
if (t.searchQueryLength != 0) {
|
||||
typeStr += ", searchQueryLength=" + t.searchQueryLength;
|
||||
}
|
||||
if (t.itemType == ItemType.TASK) {
|
||||
typeStr += ", pageIdx=" + t.pageIndex;
|
||||
}
|
||||
return typeStr;
|
||||
}
|
||||
|
||||
public static Target newItemTarget(int itemType) {
|
||||
Target t = newTarget(Target.Type.ITEM);
|
||||
t.itemType = itemType;
|
||||
|
||||
Reference in New Issue
Block a user