Using java_style enum generation for proto
This makes it easier to track various method parameters and simplifies debug logging Change-Id: Ib7c3d52590d0c36b2c8460c889ee3bead3454569
This commit is contained in:
parent
fa94c79ca6
commit
6c46a6d324
|
@ -41,6 +41,8 @@ LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
||||||
|
|
||||||
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
|
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
|
||||||
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/
|
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/
|
||||||
|
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java
|
||||||
|
|
||||||
LOCAL_AAPT_FLAGS := \
|
LOCAL_AAPT_FLAGS := \
|
||||||
--auto-add-overlay \
|
--auto-add-overlay \
|
||||||
--extra-packages android.support.v7.recyclerview \
|
--extra-packages android.support.v7.recyclerview \
|
||||||
|
@ -66,6 +68,7 @@ LOCAL_SRC_FILES := $(call all-proto-files-under, protos)
|
||||||
|
|
||||||
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
|
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
|
||||||
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/
|
LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/
|
||||||
|
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java
|
||||||
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
LOCAL_MODULE_TAGS := optional
|
||||||
LOCAL_MODULE := launcher_proto_lib
|
LOCAL_MODULE := launcher_proto_lib
|
||||||
|
|
|
@ -85,6 +85,7 @@ protobuf {
|
||||||
remove java
|
remove java
|
||||||
javanano {
|
javanano {
|
||||||
option "java_package=launcher_log.proto|com.android.launcher3.userevent.nano"
|
option "java_package=launcher_log.proto|com.android.launcher3.userevent.nano"
|
||||||
|
option "enum_style=java"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,3 +91,6 @@
|
||||||
#}
|
#}
|
||||||
-keep class android.support.v7.widget.RecyclerView { *; }
|
-keep class android.support.v7.widget.RecyclerView { *; }
|
||||||
|
|
||||||
|
-keep interface com.android.launcher3.userevent.nano.LauncherLogProto.** {
|
||||||
|
*;
|
||||||
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import android.widget.TextView;
|
||||||
import com.android.launcher3.config.FeatureFlags;
|
import com.android.launcher3.config.FeatureFlags;
|
||||||
import com.android.launcher3.dynamicui.ExtractedColors;
|
import com.android.launcher3.dynamicui.ExtractedColors;
|
||||||
import com.android.launcher3.logging.UserEventDispatcher;
|
import com.android.launcher3.logging.UserEventDispatcher;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||||
|
|
||||||
public class Hotseat extends FrameLayout
|
public class Hotseat extends FrameLayout
|
||||||
|
@ -175,7 +175,7 @@ public class Hotseat extends FrameLayout
|
||||||
public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
|
public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
|
||||||
target.gridX = info.cellX;
|
target.gridX = info.cellX;
|
||||||
target.gridY = info.cellY;
|
target.gridY = info.cellY;
|
||||||
targetParent.containerType = LauncherLogProto.HOTSEAT;
|
targetParent.containerType = ContainerType.HOTSEAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateColor(ExtractedColors extractedColors, boolean animate) {
|
public void updateColor(ExtractedColors extractedColors, boolean animate) {
|
||||||
|
|
|
@ -111,7 +111,9 @@ import com.android.launcher3.pageindicators.PageIndicator;
|
||||||
import com.android.launcher3.shortcuts.DeepShortcutManager;
|
import com.android.launcher3.shortcuts.DeepShortcutManager;
|
||||||
import com.android.launcher3.shortcuts.DeepShortcutsContainer;
|
import com.android.launcher3.shortcuts.DeepShortcutsContainer;
|
||||||
import com.android.launcher3.shortcuts.ShortcutKey;
|
import com.android.launcher3.shortcuts.ShortcutKey;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
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.util.ActivityResultInfo;
|
import com.android.launcher3.util.ActivityResultInfo;
|
||||||
import com.android.launcher3.util.ComponentKey;
|
import com.android.launcher3.util.ComponentKey;
|
||||||
import com.android.launcher3.util.ItemInfoMatcher;
|
import com.android.launcher3.util.ItemInfoMatcher;
|
||||||
|
@ -1350,7 +1352,7 @@ public class Launcher extends Activity
|
||||||
|
|
||||||
// Bind wallpaper button actions
|
// Bind wallpaper button actions
|
||||||
View wallpaperButton = findViewById(R.id.wallpaper_button);
|
View wallpaperButton = findViewById(R.id.wallpaper_button);
|
||||||
new OverviewButtonClickListener(LauncherLogProto.WALLPAPER_BUTTON) {
|
new OverviewButtonClickListener(ControlType.WALLPAPER_BUTTON) {
|
||||||
@Override
|
@Override
|
||||||
public void handleViewClick(View view) {
|
public void handleViewClick(View view) {
|
||||||
onClickWallpaperPicker(view);
|
onClickWallpaperPicker(view);
|
||||||
|
@ -1360,7 +1362,7 @@ public class Launcher extends Activity
|
||||||
|
|
||||||
// Bind widget button actions
|
// Bind widget button actions
|
||||||
mWidgetsButton = findViewById(R.id.widget_button);
|
mWidgetsButton = findViewById(R.id.widget_button);
|
||||||
new OverviewButtonClickListener(LauncherLogProto.WIDGETS_BUTTON) {
|
new OverviewButtonClickListener(ControlType.WIDGETS_BUTTON) {
|
||||||
@Override
|
@Override
|
||||||
public void handleViewClick(View view) {
|
public void handleViewClick(View view) {
|
||||||
onClickAddWidgetButton(view);
|
onClickAddWidgetButton(view);
|
||||||
|
@ -1372,7 +1374,7 @@ public class Launcher extends Activity
|
||||||
View settingsButton = findViewById(R.id.settings_button);
|
View settingsButton = findViewById(R.id.settings_button);
|
||||||
boolean hasSettings = hasSettings();
|
boolean hasSettings = hasSettings();
|
||||||
if (hasSettings) {
|
if (hasSettings) {
|
||||||
new OverviewButtonClickListener(LauncherLogProto.SETTINGS_BUTTON) {
|
new OverviewButtonClickListener(ControlType.SETTINGS_BUTTON) {
|
||||||
@Override
|
@Override
|
||||||
public void handleViewClick(View view) {
|
public void handleViewClick(View view) {
|
||||||
onClickSettingsButton(view);
|
onClickSettingsButton(view);
|
||||||
|
@ -1694,13 +1696,13 @@ public class Launcher extends Activity
|
||||||
|
|
||||||
AbstractFloatingView topOpenView = AbstractFloatingView.getTopOpenView(this);
|
AbstractFloatingView topOpenView = AbstractFloatingView.getTopOpenView(this);
|
||||||
if (topOpenView instanceof DeepShortcutsContainer) {
|
if (topOpenView instanceof DeepShortcutsContainer) {
|
||||||
ued.logActionCommand(LauncherLogProto.Action.HOME_INTENT,
|
ued.logActionCommand(Action.Command.HOME_INTENT,
|
||||||
topOpenView.getExtendedTouchView(), LauncherLogProto.DEEPSHORTCUTS);
|
topOpenView.getExtendedTouchView(), ContainerType.DEEPSHORTCUTS);
|
||||||
} else if (topOpenView instanceof Folder) {
|
} else if (topOpenView instanceof Folder) {
|
||||||
ued.logActionCommand(LauncherLogProto.Action.HOME_INTENT,
|
ued.logActionCommand(Action.Command.HOME_INTENT,
|
||||||
((Folder) topOpenView).getFolderIcon(), LauncherLogProto.FOLDER);
|
((Folder) topOpenView).getFolderIcon(), ContainerType.FOLDER);
|
||||||
} else if (alreadyOnHome) {
|
} else if (alreadyOnHome) {
|
||||||
ued.logActionCommand(LauncherLogProto.Action.HOME_INTENT,
|
ued.logActionCommand(Action.Command.HOME_INTENT,
|
||||||
mWorkspace.getState().containerType, mWorkspace.getCurrentPage());
|
mWorkspace.getState().containerType, mWorkspace.getCurrentPage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2216,22 +2218,22 @@ public class Launcher extends Activity
|
||||||
topView.getActiveTextView().dispatchBackKey();
|
topView.getActiveTextView().dispatchBackKey();
|
||||||
} else {
|
} else {
|
||||||
if (topView instanceof DeepShortcutsContainer) {
|
if (topView instanceof DeepShortcutsContainer) {
|
||||||
ued.logActionCommand(LauncherLogProto.Action.BACK,
|
ued.logActionCommand(Action.Command.BACK,
|
||||||
topView.getExtendedTouchView(), LauncherLogProto.DEEPSHORTCUTS);
|
topView.getExtendedTouchView(), ContainerType.DEEPSHORTCUTS);
|
||||||
} else if (topView instanceof Folder) {
|
} else if (topView instanceof Folder) {
|
||||||
ued.logActionCommand(LauncherLogProto.Action.BACK,
|
ued.logActionCommand(Action.Command.BACK,
|
||||||
((Folder) topView).getFolderIcon(), LauncherLogProto.FOLDER);
|
((Folder) topView).getFolderIcon(), ContainerType.FOLDER);
|
||||||
}
|
}
|
||||||
topView.close(true);
|
topView.close(true);
|
||||||
}
|
}
|
||||||
} else if (isAppsViewVisible()) {
|
} else if (isAppsViewVisible()) {
|
||||||
ued.logActionCommand(LauncherLogProto.Action.BACK, LauncherLogProto.ALLAPPS);
|
ued.logActionCommand(Action.Command.BACK, ContainerType.ALLAPPS);
|
||||||
showWorkspace(true);
|
showWorkspace(true);
|
||||||
} else if (isWidgetsViewVisible()) {
|
} else if (isWidgetsViewVisible()) {
|
||||||
ued.logActionCommand(LauncherLogProto.Action.BACK, LauncherLogProto.WIDGETS);
|
ued.logActionCommand(Action.Command.BACK, ContainerType.WIDGETS);
|
||||||
showOverviewMode(true);
|
showOverviewMode(true);
|
||||||
} else if (mWorkspace.isInOverviewMode()) {
|
} else if (mWorkspace.isInOverviewMode()) {
|
||||||
ued.logActionCommand(LauncherLogProto.Action.BACK, LauncherLogProto.OVERVIEW);
|
ued.logActionCommand(Action.Command.BACK, ContainerType.OVERVIEW);
|
||||||
showWorkspace(true);
|
showWorkspace(true);
|
||||||
} else {
|
} else {
|
||||||
// TODO: Log this case.
|
// TODO: Log this case.
|
||||||
|
@ -2365,8 +2367,8 @@ public class Launcher extends Activity
|
||||||
protected void onClickAllAppsButton(View v) {
|
protected void onClickAllAppsButton(View v) {
|
||||||
if (LOGD) Log.d(TAG, "onClickAllAppsButton");
|
if (LOGD) Log.d(TAG, "onClickAllAppsButton");
|
||||||
if (!isAppsViewVisible()) {
|
if (!isAppsViewVisible()) {
|
||||||
getUserEventDispatcher().logActionOnControl(LauncherLogProto.Action.TAP,
|
getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
|
||||||
LauncherLogProto.ALL_APPS_BUTTON);
|
ControlType.ALL_APPS_BUTTON);
|
||||||
showAppsView(true /* animated */, true /* updatePredictedApps */,
|
showAppsView(true /* animated */, true /* updatePredictedApps */,
|
||||||
false /* focusSearchBar */);
|
false /* focusSearchBar */);
|
||||||
}
|
}
|
||||||
|
@ -2375,8 +2377,8 @@ public class Launcher extends Activity
|
||||||
protected void onLongClickAllAppsButton(View v) {
|
protected void onLongClickAllAppsButton(View v) {
|
||||||
if (LOGD) Log.d(TAG, "onLongClickAllAppsButton");
|
if (LOGD) Log.d(TAG, "onLongClickAllAppsButton");
|
||||||
if (!isAppsViewVisible()) {
|
if (!isAppsViewVisible()) {
|
||||||
getUserEventDispatcher().logActionOnControl(LauncherLogProto.Action.LONGPRESS,
|
getUserEventDispatcher().logActionOnControl(Action.Touch.LONGPRESS,
|
||||||
LauncherLogProto.ALL_APPS_BUTTON);
|
ControlType.ALL_APPS_BUTTON);
|
||||||
showAppsView(true /* animated */,
|
showAppsView(true /* animated */,
|
||||||
true /* updatePredictedApps */, true /* focusSearchBar */);
|
true /* updatePredictedApps */, true /* focusSearchBar */);
|
||||||
}
|
}
|
||||||
|
@ -2759,8 +2761,8 @@ public class Launcher extends Activity
|
||||||
if (v instanceof Workspace) {
|
if (v instanceof Workspace) {
|
||||||
if (!mWorkspace.isInOverviewMode()) {
|
if (!mWorkspace.isInOverviewMode()) {
|
||||||
if (!mWorkspace.isTouchActive() && !ignoreLongPressToOverview) {
|
if (!mWorkspace.isTouchActive() && !ignoreLongPressToOverview) {
|
||||||
getUserEventDispatcher().logActionOnContainer(LauncherLogProto.Action.LONGPRESS,
|
getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
|
||||||
LauncherLogProto.Action.NONE, LauncherLogProto.WORKSPACE,
|
Action.Direction.NONE, ContainerType.WORKSPACE,
|
||||||
mWorkspace.getCurrentPage());
|
mWorkspace.getCurrentPage());
|
||||||
showOverviewMode(true);
|
showOverviewMode(true);
|
||||||
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
|
mWorkspace.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
|
||||||
|
@ -2790,14 +2792,14 @@ public class Launcher extends Activity
|
||||||
// User long pressed on empty space
|
// User long pressed on empty space
|
||||||
if (mWorkspace.isInOverviewMode()) {
|
if (mWorkspace.isInOverviewMode()) {
|
||||||
mWorkspace.startReordering(v);
|
mWorkspace.startReordering(v);
|
||||||
getUserEventDispatcher().logActionOnContainer(LauncherLogProto.Action.LONGPRESS,
|
getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
|
||||||
LauncherLogProto.Action.NONE, LauncherLogProto.OVERVIEW);
|
Action.Direction.NONE, ContainerType.OVERVIEW);
|
||||||
} else {
|
} else {
|
||||||
if (ignoreLongPressToOverview) {
|
if (ignoreLongPressToOverview) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
getUserEventDispatcher().logActionOnContainer(LauncherLogProto.Action.LONGPRESS,
|
getUserEventDispatcher().logActionOnContainer(Action.Touch.LONGPRESS,
|
||||||
LauncherLogProto.Action.NONE, LauncherLogProto.WORKSPACE,
|
Action.Direction.NONE, ContainerType.WORKSPACE,
|
||||||
mWorkspace.getCurrentPage());
|
mWorkspace.getCurrentPage());
|
||||||
showOverviewMode(true);
|
showOverviewMode(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.android.launcher3;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A specialized listener for Overview buttons where both clicks and long clicks are logged
|
* A specialized listener for Overview buttons where both clicks and long clicks are logged
|
||||||
|
@ -11,7 +11,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto;
|
||||||
public abstract class OverviewButtonClickListener implements View.OnClickListener,
|
public abstract class OverviewButtonClickListener implements View.OnClickListener,
|
||||||
View.OnLongClickListener {
|
View.OnLongClickListener {
|
||||||
|
|
||||||
private int mControlType; /** ControlType enum as defined in {@link LauncherLogProto} */
|
private int mControlType; /** ControlType enum as defined in {@link Action.Touch} */
|
||||||
|
|
||||||
public OverviewButtonClickListener(int controlType) {
|
public OverviewButtonClickListener(int controlType) {
|
||||||
mControlType = controlType;
|
mControlType = controlType;
|
||||||
|
@ -25,14 +25,14 @@ public abstract class OverviewButtonClickListener implements View.OnClickListene
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (shouldPerformClick(view)) {
|
if (shouldPerformClick(view)) {
|
||||||
handleViewClick(view, LauncherLogProto.Action.TAP);
|
handleViewClick(view, Action.Touch.TAP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View view) {
|
public boolean onLongClick(View view) {
|
||||||
if (shouldPerformClick(view)) {
|
if (shouldPerformClick(view)) {
|
||||||
handleViewClick(view, LauncherLogProto.Action.LONGPRESS);
|
handleViewClick(view, Action.Touch.LONGPRESS);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@ import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.animation.LinearInterpolator;
|
import android.view.animation.LinearInterpolator;
|
||||||
|
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
|
||||||
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
|
|
||||||
import static com.android.launcher3.Workspace.State.NORMAL;
|
import static com.android.launcher3.Workspace.State.NORMAL;
|
||||||
import static com.android.launcher3.Workspace.State.OVERVIEW;
|
import static com.android.launcher3.Workspace.State.OVERVIEW;
|
||||||
|
@ -164,14 +165,14 @@ public class PinchAnimationManager {
|
||||||
// Passing threshold 3 ends the pinch and snaps to the new state.
|
// Passing threshold 3 ends the pinch and snaps to the new state.
|
||||||
if (startState == OVERVIEW && goingTowards == NORMAL) {
|
if (startState == OVERVIEW && goingTowards == NORMAL) {
|
||||||
mLauncher.getUserEventDispatcher().logActionOnContainer(
|
mLauncher.getUserEventDispatcher().logActionOnContainer(
|
||||||
LauncherLogProto.Action.PINCH, LauncherLogProto.Action.NONE,
|
Action.Touch.PINCH, Action.Direction.NONE,
|
||||||
LauncherLogProto.OVERVIEW, mWorkspace.getCurrentPage());
|
ContainerType.OVERVIEW, mWorkspace.getCurrentPage());
|
||||||
mLauncher.showWorkspace(true);
|
mLauncher.showWorkspace(true);
|
||||||
mWorkspace.snapToPage(mWorkspace.getCurrentPage());
|
mWorkspace.snapToPage(mWorkspace.getCurrentPage());
|
||||||
} else if (startState == NORMAL && goingTowards == OVERVIEW) {
|
} else if (startState == NORMAL && goingTowards == OVERVIEW) {
|
||||||
mLauncher.getUserEventDispatcher().logActionOnContainer(
|
mLauncher.getUserEventDispatcher().logActionOnContainer(
|
||||||
LauncherLogProto.Action.PINCH, LauncherLogProto.Action.NONE,
|
Action.Touch.PINCH, Action.Direction.NONE,
|
||||||
LauncherLogProto.WORKSPACE, mWorkspace.getCurrentPage());
|
ContainerType.WORKSPACE, mWorkspace.getCurrentPage());
|
||||||
mLauncher.showOverviewMode(true);
|
mLauncher.showOverviewMode(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -73,7 +73,7 @@ import com.android.launcher3.folder.Folder;
|
||||||
import com.android.launcher3.folder.FolderIcon;
|
import com.android.launcher3.folder.FolderIcon;
|
||||||
import com.android.launcher3.graphics.DragPreviewProvider;
|
import com.android.launcher3.graphics.DragPreviewProvider;
|
||||||
import com.android.launcher3.shortcuts.DeepShortcutsContainer;
|
import com.android.launcher3.shortcuts.DeepShortcutsContainer;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||||
import com.android.launcher3.util.ItemInfoMatcher;
|
import com.android.launcher3.util.ItemInfoMatcher;
|
||||||
import com.android.launcher3.util.LongArrayMap;
|
import com.android.launcher3.util.LongArrayMap;
|
||||||
|
@ -188,11 +188,11 @@ public class Workspace extends PagedView
|
||||||
// in all apps or customize mode)
|
// in all apps or customize mode)
|
||||||
|
|
||||||
public enum State {
|
public enum State {
|
||||||
NORMAL (false, false, LauncherLogProto.WORKSPACE),
|
NORMAL (false, false, ContainerType.WORKSPACE),
|
||||||
NORMAL_HIDDEN (false, false, LauncherLogProto.ALLAPPS),
|
NORMAL_HIDDEN (false, false, ContainerType.ALLAPPS),
|
||||||
SPRING_LOADED (false, true, LauncherLogProto.WORKSPACE),
|
SPRING_LOADED (false, true, ContainerType.WORKSPACE),
|
||||||
OVERVIEW (true, true, LauncherLogProto.OVERVIEW),
|
OVERVIEW (true, true, ContainerType.OVERVIEW),
|
||||||
OVERVIEW_HIDDEN (true, false, LauncherLogProto.WIDGETS);
|
OVERVIEW_HIDDEN (true, false, ContainerType.WIDGETS);
|
||||||
|
|
||||||
public final boolean shouldUpdateWidget;
|
public final boolean shouldUpdateWidget;
|
||||||
public final boolean hasMultipleVisiblePages;
|
public final boolean hasMultipleVisiblePages;
|
||||||
|
@ -4155,12 +4155,12 @@ public class Workspace extends PagedView
|
||||||
target.gridX = info.cellX;
|
target.gridX = info.cellX;
|
||||||
target.gridY = info.cellY;
|
target.gridY = info.cellY;
|
||||||
target.pageIndex = getCurrentPage();
|
target.pageIndex = getCurrentPage();
|
||||||
targetParent.containerType = LauncherLogProto.WORKSPACE;
|
targetParent.containerType = ContainerType.WORKSPACE;
|
||||||
if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
|
if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
|
||||||
target.rank = info.rank;
|
target.rank = info.rank;
|
||||||
targetParent.containerType = LauncherLogProto.HOTSEAT;
|
targetParent.containerType = ContainerType.HOTSEAT;
|
||||||
} else if (info.container >= 0) {
|
} else if (info.container >= 0) {
|
||||||
targetParent.containerType = LauncherLogProto.FOLDER;
|
targetParent.containerType = ContainerType.FOLDER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import com.android.launcher3.BubbleTextView;
|
||||||
import com.android.launcher3.DeviceProfile;
|
import com.android.launcher3.DeviceProfile;
|
||||||
import com.android.launcher3.Launcher;
|
import com.android.launcher3.Launcher;
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||||
|
|
||||||
public int getContainerType(View v) {
|
public int getContainerType(View v) {
|
||||||
if (mApps.hasFilter()) {
|
if (mApps.hasFilter()) {
|
||||||
return LauncherLogProto.SEARCHRESULT;
|
return ContainerType.SEARCHRESULT;
|
||||||
} else {
|
} else {
|
||||||
if (v instanceof BubbleTextView) {
|
if (v instanceof BubbleTextView) {
|
||||||
BubbleTextView icon = (BubbleTextView) v;
|
BubbleTextView icon = (BubbleTextView) v;
|
||||||
|
@ -193,11 +193,11 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
|
||||||
List<AlphabeticalAppsList.AdapterItem> items = mApps.getAdapterItems();
|
List<AlphabeticalAppsList.AdapterItem> items = mApps.getAdapterItems();
|
||||||
AlphabeticalAppsList.AdapterItem item = items.get(position);
|
AlphabeticalAppsList.AdapterItem item = items.get(position);
|
||||||
if (item.viewType == AllAppsGridAdapter.VIEW_TYPE_PREDICTION_ICON) {
|
if (item.viewType == AllAppsGridAdapter.VIEW_TYPE_PREDICTION_ICON) {
|
||||||
return LauncherLogProto.PREDICTION;
|
return ContainerType.PREDICTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return LauncherLogProto.ALLAPPS;
|
return ContainerType.ALLAPPS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ import com.android.launcher3.Utilities;
|
||||||
import com.android.launcher3.Workspace;
|
import com.android.launcher3.Workspace;
|
||||||
import com.android.launcher3.shortcuts.DeepShortcutsContainer;
|
import com.android.launcher3.shortcuts.DeepShortcutsContainer;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
||||||
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
|
||||||
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
import com.android.launcher3.util.TouchController;
|
import com.android.launcher3.util.TouchController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -225,9 +227,9 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
||||||
|
|
||||||
if (!mLauncher.isAllAppsVisible()) {
|
if (!mLauncher.isAllAppsVisible()) {
|
||||||
mLauncher.getUserEventDispatcher().logActionOnContainer(
|
mLauncher.getUserEventDispatcher().logActionOnContainer(
|
||||||
LauncherLogProto.Action.FLING,
|
Action.Touch.FLING,
|
||||||
LauncherLogProto.Action.UP,
|
Action.Direction.UP,
|
||||||
LauncherLogProto.HOTSEAT);
|
ContainerType.HOTSEAT);
|
||||||
}
|
}
|
||||||
mLauncher.showAppsView(true /* animated */,
|
mLauncher.showAppsView(true /* animated */,
|
||||||
false /* updatePredictedApps */,
|
false /* updatePredictedApps */,
|
||||||
|
@ -245,9 +247,9 @@ public class AllAppsTransitionController implements TouchController, VerticalPul
|
||||||
calculateDuration(velocity, Math.abs(mAppsView.getTranslationY()));
|
calculateDuration(velocity, Math.abs(mAppsView.getTranslationY()));
|
||||||
if (!mLauncher.isAllAppsVisible()) {
|
if (!mLauncher.isAllAppsVisible()) {
|
||||||
mLauncher.getUserEventDispatcher().logActionOnContainer(
|
mLauncher.getUserEventDispatcher().logActionOnContainer(
|
||||||
LauncherLogProto.Action.SWIPE,
|
Action.Touch.SWIPE,
|
||||||
LauncherLogProto.Action.UP,
|
Action.Direction.UP,
|
||||||
LauncherLogProto.HOTSEAT);
|
ContainerType.HOTSEAT);
|
||||||
}
|
}
|
||||||
mLauncher.showAppsView(true, /* animated */
|
mLauncher.showAppsView(true, /* animated */
|
||||||
false /* updatePredictedApps */,
|
false /* updatePredictedApps */,
|
||||||
|
|
|
@ -76,7 +76,7 @@ import com.android.launcher3.dragndrop.DragController.DragListener;
|
||||||
import com.android.launcher3.dragndrop.DragLayer;
|
import com.android.launcher3.dragndrop.DragLayer;
|
||||||
import com.android.launcher3.dragndrop.DragOptions;
|
import com.android.launcher3.dragndrop.DragOptions;
|
||||||
import com.android.launcher3.pageindicators.PageIndicatorDots;
|
import com.android.launcher3.pageindicators.PageIndicatorDots;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||||
import com.android.launcher3.util.CircleRevealOutlineProvider;
|
import com.android.launcher3.util.CircleRevealOutlineProvider;
|
||||||
import com.android.launcher3.util.Thunk;
|
import com.android.launcher3.util.Thunk;
|
||||||
|
@ -1448,7 +1448,7 @@ public class Folder extends AbstractFloatingView implements DragSource, View.OnC
|
||||||
target.gridX = info.cellX;
|
target.gridX = info.cellX;
|
||||||
target.gridY = info.cellY;
|
target.gridY = info.cellY;
|
||||||
target.pageIndex = mContent.getCurrentPage();
|
target.pageIndex = mContent.getCurrentPage();
|
||||||
targetParent.containerType = LauncherLogProto.FOLDER;
|
targetParent.containerType = ContainerType.FOLDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OnScrollHintListener implements OnAlarmListener {
|
private class OnScrollHintListener implements OnAlarmListener {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.android.launcher3.logging;
|
package com.android.launcher3.logging;
|
||||||
|
|
||||||
|
import android.util.ArrayMap;
|
||||||
|
import android.util.SparseArray;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import com.android.launcher3.ButtonDropTarget;
|
import com.android.launcher3.ButtonDropTarget;
|
||||||
|
@ -8,81 +10,73 @@ import com.android.launcher3.InfoDropTarget;
|
||||||
import com.android.launcher3.ItemInfo;
|
import com.android.launcher3.ItemInfo;
|
||||||
import com.android.launcher3.LauncherSettings;
|
import com.android.launcher3.LauncherSettings;
|
||||||
import com.android.launcher3.UninstallDropTarget;
|
import com.android.launcher3.UninstallDropTarget;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
|
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.LauncherEvent;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debugging helper methods.
|
* Helper methods for logging.
|
||||||
* toString() cannot be overriden inside auto generated {@link LauncherLogProto}.
|
|
||||||
* Note: switch statement cannot be replaced with reflection as proguard strips the constants
|
|
||||||
*/
|
*/
|
||||||
public class LoggerUtils {
|
public class LoggerUtils {
|
||||||
private static final String TAG = "LoggerUtils";
|
private static final ArrayMap<Class, SparseArray<String>> sNameCache = new ArrayMap<>();
|
||||||
|
private static final String UNKNOWN = "UNKNOWN";
|
||||||
|
|
||||||
private static String getCommandStr(Action action) {
|
private static String getFieldName(int value, Class c) {
|
||||||
switch (action.command) {
|
SparseArray<String> cache;
|
||||||
case Action.HOME_INTENT: return "HOME_INTENT";
|
synchronized (sNameCache) {
|
||||||
case Action.BACK: return "BACK";
|
cache = sNameCache.get(c);
|
||||||
default: return "UNKNOWN";
|
if (cache == null) {
|
||||||
|
cache = new SparseArray<>();
|
||||||
|
for (Field f : c.getDeclaredFields()) {
|
||||||
|
if (f.getType() == int.class && Modifier.isStatic(f.getModifiers())) {
|
||||||
|
try {
|
||||||
|
f.setAccessible(true);
|
||||||
|
cache.put(f.getInt(null), f.getName());
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
// Ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sNameCache.put(c, cache);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
String result = cache.get(value);
|
||||||
|
return result != null ? result : UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getTouchStr(Action action) {
|
public static String getActionStr(Action action) {
|
||||||
switch (action.touch) {
|
|
||||||
case Action.TAP: return "TAP";
|
|
||||||
case Action.LONGPRESS: return "LONGPRESS";
|
|
||||||
case Action.DRAGDROP: return "DRAGDROP";
|
|
||||||
case Action.PINCH: return "PINCH";
|
|
||||||
case Action.SWIPE: return "SWIPE";
|
|
||||||
case Action.FLING: return "FLING";
|
|
||||||
default: return "UNKNOWN";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getActionStr(LauncherLogProto.Action action) {
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case Action.TOUCH: return getTouchStr(action);
|
case Action.Type.TOUCH: return getFieldName(action.touch, Action.Touch.class);
|
||||||
case Action.COMMAND: return getCommandStr(action);
|
case Action.Type.COMMAND: return getFieldName(action.command, Action.Command.class);
|
||||||
default: return "UNKNOWN";
|
default: return UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTargetStr(Target t) {
|
public static String getTargetStr(Target t) {
|
||||||
String typeStr = "";
|
|
||||||
if (t == null){
|
if (t == null){
|
||||||
return typeStr;
|
return "";
|
||||||
}
|
}
|
||||||
switch (t.type) {
|
switch (t.type) {
|
||||||
case Target.ITEM:
|
case Target.Type.ITEM:
|
||||||
return getItemStr(t);
|
return getItemStr(t);
|
||||||
case Target.CONTROL:
|
case Target.Type.CONTROL:
|
||||||
return getControlStr(t);
|
return getFieldName(t.controlType, ControlType.class);
|
||||||
case Target.CONTAINER:
|
case Target.Type.CONTAINER:
|
||||||
return getContainerStr(t);
|
return getFieldName(t.containerType, ContainerType.class)
|
||||||
|
+ " id=" + t.pageIndex;
|
||||||
default:
|
default:
|
||||||
return "UNKNOWN TARGET TYPE";
|
return "UNKNOWN TARGET TYPE";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getItemStr(Target t) {
|
private static String getItemStr(Target t) {
|
||||||
String typeStr = "";
|
String typeStr = getFieldName(t.itemType, ItemType.class);
|
||||||
if (t == null){
|
|
||||||
return typeStr;
|
|
||||||
}
|
|
||||||
switch(t.itemType){
|
|
||||||
case LauncherLogProto.APP_ICON: typeStr = "APPICON"; break;
|
|
||||||
case LauncherLogProto.SHORTCUT: typeStr = "SHORTCUT"; break;
|
|
||||||
case LauncherLogProto.WIDGET: typeStr = "WIDGET"; break;
|
|
||||||
case LauncherLogProto.DEEPSHORTCUT: typeStr = "DEEPSHORTCUT"; break;
|
|
||||||
case LauncherLogProto.FOLDER_ICON: typeStr = "FOLDERICON"; break;
|
|
||||||
case LauncherLogProto.SEARCHBOX: typeStr = "SEARCHBOX"; break;
|
|
||||||
case LauncherLogProto.EDITTEXT: typeStr = "EDITTEXT"; break;
|
|
||||||
|
|
||||||
default: typeStr = "UNKNOWN";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (t.packageNameHash != 0) {
|
if (t.packageNameHash != 0) {
|
||||||
typeStr += ", packageHash=" + t.packageNameHash;
|
typeStr += ", packageHash=" + t.packageNameHash;
|
||||||
}
|
}
|
||||||
|
@ -95,88 +89,32 @@ public class LoggerUtils {
|
||||||
if (t.spanX != 0) {
|
if (t.spanX != 0) {
|
||||||
typeStr += ", spanX=" + t.spanX;
|
typeStr += ", spanX=" + t.spanX;
|
||||||
}
|
}
|
||||||
return typeStr += ", grid=(" + t.gridX + "," + t.gridY + "), id=" + t.pageIndex;
|
return typeStr + ", grid=(" + t.gridX + "," + t.gridY + "), id=" + t.pageIndex;
|
||||||
}
|
|
||||||
|
|
||||||
private static String getControlStr(Target t) {
|
|
||||||
if (t == null){
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
switch(t.controlType) {
|
|
||||||
case LauncherLogProto.ALL_APPS_BUTTON: return "ALL_APPS_BUTTON";
|
|
||||||
case LauncherLogProto.WIDGETS_BUTTON: return "WIDGETS_BUTTON";
|
|
||||||
case LauncherLogProto.WALLPAPER_BUTTON: return "WALLPAPER_BUTTON";
|
|
||||||
case LauncherLogProto.SETTINGS_BUTTON: return "SETTINGS_BUTTON";
|
|
||||||
case LauncherLogProto.REMOVE_TARGET: return "REMOVE_TARGET";
|
|
||||||
case LauncherLogProto.UNINSTALL_TARGET: return "UNINSTALL_TARGET";
|
|
||||||
case LauncherLogProto.APPINFO_TARGET: return "APPINFO_TARGET";
|
|
||||||
case LauncherLogProto.RESIZE_HANDLE: return "RESIZE_HANDLE";
|
|
||||||
default: return "UNKNOWN";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getContainerStr(LauncherLogProto.Target t) {
|
|
||||||
String str = "";
|
|
||||||
if (t == null) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
switch (t.containerType) {
|
|
||||||
case LauncherLogProto.WORKSPACE:
|
|
||||||
str = "WORKSPACE";
|
|
||||||
break;
|
|
||||||
case LauncherLogProto.HOTSEAT:
|
|
||||||
str = "HOTSEAT";
|
|
||||||
break;
|
|
||||||
case LauncherLogProto.FOLDER:
|
|
||||||
str = "FOLDER";
|
|
||||||
break;
|
|
||||||
case LauncherLogProto.ALLAPPS:
|
|
||||||
str = "ALLAPPS";
|
|
||||||
break;
|
|
||||||
case LauncherLogProto.WIDGETS:
|
|
||||||
str = "WIDGETS";
|
|
||||||
break;
|
|
||||||
case LauncherLogProto.OVERVIEW:
|
|
||||||
str = "OVERVIEW";
|
|
||||||
break;
|
|
||||||
case LauncherLogProto.PREDICTION:
|
|
||||||
str = "PREDICTION";
|
|
||||||
break;
|
|
||||||
case LauncherLogProto.SEARCHRESULT:
|
|
||||||
str = "SEARCHRESULT";
|
|
||||||
break;
|
|
||||||
case LauncherLogProto.DEEPSHORTCUTS:
|
|
||||||
str = "DEEPSHORTCUTS";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
str = "UNKNOWN";
|
|
||||||
}
|
|
||||||
return str + " id=" + t.pageIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Target newItemTarget(View v) {
|
public static Target newItemTarget(View v) {
|
||||||
return (v.getTag() instanceof ItemInfo)
|
return (v.getTag() instanceof ItemInfo)
|
||||||
? newItemTarget((ItemInfo) v.getTag())
|
? newItemTarget((ItemInfo) v.getTag())
|
||||||
: newTarget(Target.ITEM);
|
: newTarget(Target.Type.ITEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Target newItemTarget(ItemInfo info) {
|
public static Target newItemTarget(ItemInfo info) {
|
||||||
Target t = newTarget(Target.ITEM);
|
Target t = newTarget(Target.Type.ITEM);
|
||||||
switch (info.itemType) {
|
switch (info.itemType) {
|
||||||
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
|
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
|
||||||
t.itemType = LauncherLogProto.APP_ICON;
|
t.itemType = ItemType.APP_ICON;
|
||||||
break;
|
break;
|
||||||
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
|
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
|
||||||
t.itemType = LauncherLogProto.SHORTCUT;
|
t.itemType = ItemType.SHORTCUT;
|
||||||
break;
|
break;
|
||||||
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
|
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
|
||||||
t.itemType = LauncherLogProto.FOLDER_ICON;
|
t.itemType = ItemType.FOLDER_ICON;
|
||||||
break;
|
break;
|
||||||
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
|
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
|
||||||
t.itemType = LauncherLogProto.WIDGET;
|
t.itemType = ItemType.WIDGET;
|
||||||
break;
|
break;
|
||||||
case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT:
|
case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT:
|
||||||
t.itemType = LauncherLogProto.DEEPSHORTCUT;
|
t.itemType = ItemType.DEEPSHORTCUT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
|
@ -184,26 +122,26 @@ public class LoggerUtils {
|
||||||
|
|
||||||
public static Target newDropTarget(View v) {
|
public static Target newDropTarget(View v) {
|
||||||
if (!(v instanceof ButtonDropTarget)) {
|
if (!(v instanceof ButtonDropTarget)) {
|
||||||
return newTarget(Target.CONTAINER);
|
return newTarget(Target.Type.CONTAINER);
|
||||||
}
|
}
|
||||||
Target t = newTarget(Target.CONTROL);
|
Target t = newTarget(Target.Type.CONTROL);
|
||||||
if (v instanceof InfoDropTarget) {
|
if (v instanceof InfoDropTarget) {
|
||||||
t.controlType = LauncherLogProto.APPINFO_TARGET;
|
t.controlType = ControlType.APPINFO_TARGET;
|
||||||
} else if (v instanceof UninstallDropTarget) {
|
} else if (v instanceof UninstallDropTarget) {
|
||||||
t.controlType = LauncherLogProto.UNINSTALL_TARGET;
|
t.controlType = ControlType.UNINSTALL_TARGET;
|
||||||
} else if (v instanceof DeleteDropTarget) {
|
} else if (v instanceof DeleteDropTarget) {
|
||||||
t.controlType = LauncherLogProto.REMOVE_TARGET;
|
t.controlType = ControlType.REMOVE_TARGET;
|
||||||
}
|
}
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Target newTarget(int targetType) {
|
public static Target newTarget(int targetType) {
|
||||||
Target t = new LauncherLogProto.Target();
|
Target t = new Target();
|
||||||
t.type = targetType;
|
t.type = targetType;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
public static Target newContainerTarget(int containerType) {
|
public static Target newContainerTarget(int containerType) {
|
||||||
Target t = newTarget(Target.CONTAINER);
|
Target t = newTarget(Target.Type.CONTAINER);
|
||||||
t.containerType = containerType;
|
t.containerType = containerType;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -214,18 +152,18 @@ public class LoggerUtils {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
public static Action newCommandAction(int command) {
|
public static Action newCommandAction(int command) {
|
||||||
Action a = newAction(Action.COMMAND);
|
Action a = newAction(Action.Type.COMMAND);
|
||||||
a.command = command;
|
a.command = command;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
public static Action newTouchAction(int touch) {
|
public static Action newTouchAction(int touch) {
|
||||||
Action a = newAction(Action.TOUCH);
|
Action a = newAction(Action.Type.TOUCH);
|
||||||
a.touch = touch;
|
a.touch = touch;
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LauncherEvent newLauncherEvent(Action action, Target... srcTargets) {
|
public static LauncherEvent newLauncherEvent(Action action, Target... srcTargets) {
|
||||||
LauncherLogProto.LauncherEvent event = new LauncherLogProto.LauncherEvent();
|
LauncherEvent event = new LauncherEvent();
|
||||||
event.srcTarget = srcTargets;
|
event.srcTarget = srcTargets;
|
||||||
event.action = action;
|
event.action = action;
|
||||||
return event;
|
return event;
|
||||||
|
|
|
@ -27,8 +27,8 @@ import com.android.launcher3.DropTarget;
|
||||||
import com.android.launcher3.ItemInfo;
|
import com.android.launcher3.ItemInfo;
|
||||||
import com.android.launcher3.Utilities;
|
import com.android.launcher3.Utilities;
|
||||||
import com.android.launcher3.config.ProviderConfig;
|
import com.android.launcher3.config.ProviderConfig;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
|
||||||
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||||
import com.android.launcher3.util.ComponentKey;
|
import com.android.launcher3.util.ComponentKey;
|
||||||
|
@ -54,7 +54,9 @@ public class UserEventDispatcher {
|
||||||
|
|
||||||
private final static int MAXIMUM_VIEW_HIERARCHY_LEVEL = 5;
|
private final static int MAXIMUM_VIEW_HIERARCHY_LEVEL = 5;
|
||||||
|
|
||||||
private final boolean mIsVerbose;
|
private static final String TAG = "UserEvent";
|
||||||
|
private static final boolean IS_VERBOSE =
|
||||||
|
ProviderConfig.IS_DOGFOOD_BUILD && Utilities.isPropertyEnabled(TAG);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implemented by containers to provide a container source for a given child.
|
* Implemented by containers to provide a container source for a given child.
|
||||||
|
@ -76,8 +78,7 @@ public class UserEventDispatcher {
|
||||||
* Recursively finds the parent of the given child which implements IconLogInfoProvider
|
* Recursively finds the parent of the given child which implements IconLogInfoProvider
|
||||||
*/
|
*/
|
||||||
public static LogContainerProvider getLaunchProviderRecursive(View v) {
|
public static LogContainerProvider getLaunchProviderRecursive(View v) {
|
||||||
ViewParent parent = null;
|
ViewParent parent;
|
||||||
|
|
||||||
if (v != null) {
|
if (v != null) {
|
||||||
parent = v.getParent();
|
parent = v.getParent();
|
||||||
} else {
|
} else {
|
||||||
|
@ -96,8 +97,6 @@ public class UserEventDispatcher {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String TAG = "UserEvent";
|
|
||||||
|
|
||||||
private long mElapsedContainerMillis;
|
private long mElapsedContainerMillis;
|
||||||
private long mElapsedSessionMillis;
|
private long mElapsedSessionMillis;
|
||||||
private long mActionDurationMillis;
|
private long mActionDurationMillis;
|
||||||
|
@ -105,14 +104,6 @@ public class UserEventDispatcher {
|
||||||
// Used for filling in predictedRank on {@link Target}s.
|
// Used for filling in predictedRank on {@link Target}s.
|
||||||
private List<ComponentKey> mPredictedApps;
|
private List<ComponentKey> mPredictedApps;
|
||||||
|
|
||||||
public UserEventDispatcher() {
|
|
||||||
if (ProviderConfig.IS_DOGFOOD_BUILD) {
|
|
||||||
mIsVerbose = Utilities.isPropertyEnabled(TAG);
|
|
||||||
} else {
|
|
||||||
mIsVerbose = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// APP_ICON SHORTCUT WIDGET
|
// APP_ICON SHORTCUT WIDGET
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
// packageNameHash required optional required
|
// packageNameHash required optional required
|
||||||
|
@ -121,8 +112,8 @@ public class UserEventDispatcher {
|
||||||
// --------------------------------------------------------------
|
// --------------------------------------------------------------
|
||||||
|
|
||||||
protected LauncherEvent createLauncherEvent(View v, Intent intent) {
|
protected LauncherEvent createLauncherEvent(View v, Intent intent) {
|
||||||
LauncherEvent event = newLauncherEvent(newTouchAction(Action.TAP),
|
LauncherEvent event = newLauncherEvent(newTouchAction(Action.Touch.TAP),
|
||||||
newItemTarget(v), newTarget(Target.CONTAINER));
|
newItemTarget(v), newTarget(Target.Type.CONTAINER));
|
||||||
|
|
||||||
// TODO: make idx percolate up the view hierarchy if needed.
|
// TODO: make idx percolate up the view hierarchy if needed.
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
@ -176,20 +167,21 @@ public class UserEventDispatcher {
|
||||||
* TODO: Make this function work when a container view is passed as the 2nd param.
|
* TODO: Make this function work when a container view is passed as the 2nd param.
|
||||||
*/
|
*/
|
||||||
public void logActionCommand(int command, View itemView, int containerType) {
|
public void logActionCommand(int command, View itemView, int containerType) {
|
||||||
LauncherEvent event = newLauncherEvent(
|
LauncherEvent event = newLauncherEvent(newCommandAction(command),
|
||||||
newCommandAction(command), newItemTarget(itemView), newTarget(Target.CONTAINER));
|
newItemTarget(itemView), newTarget(Target.Type.CONTAINER));
|
||||||
|
|
||||||
if (fillInLogContainerData(event, itemView)) {
|
if (fillInLogContainerData(event, itemView)) {
|
||||||
// TODO: Remove the following two lines once fillInLogContainerData can take in a
|
// TODO: Remove the following two lines once fillInLogContainerData can take in a
|
||||||
// container view.
|
// container view.
|
||||||
event.srcTarget[0].type = Target.CONTAINER;
|
event.srcTarget[0].type = Target.Type.CONTAINER;
|
||||||
event.srcTarget[0].containerType = containerType;
|
event.srcTarget[0].containerType = containerType;
|
||||||
}
|
}
|
||||||
dispatchUserEvent(event, null);
|
dispatchUserEvent(event, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logActionOnControl(int action, int controlType) {
|
public void logActionOnControl(int action, int controlType) {
|
||||||
LauncherEvent event = newLauncherEvent(newTouchAction(action), newTarget(Target.CONTROL));
|
LauncherEvent event = newLauncherEvent(
|
||||||
|
newTouchAction(action), newTarget(Target.Type.CONTROL));
|
||||||
event.srcTarget[0].controlType = controlType;
|
event.srcTarget[0].controlType = controlType;
|
||||||
dispatchUserEvent(event, null);
|
dispatchUserEvent(event, null);
|
||||||
}
|
}
|
||||||
|
@ -212,8 +204,8 @@ public class UserEventDispatcher {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ItemInfo info = (ItemInfo) icon.getTag();
|
ItemInfo info = (ItemInfo) icon.getTag();
|
||||||
LauncherEvent event = newLauncherEvent(
|
LauncherEvent event = newLauncherEvent(newTouchAction(Action.Touch.LONGPRESS),
|
||||||
newTouchAction(Action.LONGPRESS), newItemTarget(info), newTarget(Target.CONTAINER));
|
newItemTarget(info), newTarget(Target.Type.CONTAINER));
|
||||||
provider.fillInLogContainerData(icon, info, event.srcTarget[0], event.srcTarget[1]);
|
provider.fillInLogContainerData(icon, info, event.srcTarget[0], event.srcTarget[1]);
|
||||||
dispatchUserEvent(event, null);
|
dispatchUserEvent(event, null);
|
||||||
|
|
||||||
|
@ -227,16 +219,16 @@ public class UserEventDispatcher {
|
||||||
/* Currently we are only interested in whether this event happens or not and don't
|
/* Currently we are only interested in whether this event happens or not and don't
|
||||||
* care about which screen moves to where. */
|
* care about which screen moves to where. */
|
||||||
public void logOverviewReorder() {
|
public void logOverviewReorder() {
|
||||||
LauncherEvent event = newLauncherEvent(newTouchAction(Action.DRAGDROP),
|
LauncherEvent event = newLauncherEvent(newTouchAction(Action.Touch.DRAGDROP),
|
||||||
newContainerTarget(LauncherLogProto.WORKSPACE),
|
newContainerTarget(ContainerType.WORKSPACE),
|
||||||
newContainerTarget(LauncherLogProto.OVERVIEW));
|
newContainerTarget(ContainerType.OVERVIEW));
|
||||||
dispatchUserEvent(event, null);
|
dispatchUserEvent(event, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logDragNDrop(DropTarget.DragObject dragObj, View dropTargetAsView) {
|
public void logDragNDrop(DropTarget.DragObject dragObj, View dropTargetAsView) {
|
||||||
LauncherEvent event = newLauncherEvent(newTouchAction(Action.DRAGDROP),
|
LauncherEvent event = newLauncherEvent(newTouchAction(Action.Touch.DRAGDROP),
|
||||||
newItemTarget(dragObj.originalDragInfo), newTarget(Target.CONTAINER));
|
newItemTarget(dragObj.originalDragInfo), newTarget(Target.Type.CONTAINER));
|
||||||
event.destTarget = new LauncherLogProto.Target[] {
|
event.destTarget = new Target[] {
|
||||||
newItemTarget(dragObj.originalDragInfo), newDropTarget(dropTargetAsView)
|
newItemTarget(dragObj.originalDragInfo), newDropTarget(dropTargetAsView)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -272,26 +264,26 @@ public class UserEventDispatcher {
|
||||||
ev.elapsedContainerMillis = SystemClock.uptimeMillis() - mElapsedContainerMillis;
|
ev.elapsedContainerMillis = SystemClock.uptimeMillis() - mElapsedContainerMillis;
|
||||||
ev.elapsedSessionMillis = SystemClock.uptimeMillis() - mElapsedSessionMillis;
|
ev.elapsedSessionMillis = SystemClock.uptimeMillis() - mElapsedSessionMillis;
|
||||||
|
|
||||||
if (!mIsVerbose) {
|
if (!IS_VERBOSE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.d(TAG, String.format(Locale.US,
|
String log = "action:" + LoggerUtils.getActionStr(ev.action);
|
||||||
"\naction:%s\n Source child:%s\tparent:%s",
|
if (ev.srcTarget != null && ev.srcTarget.length > 0) {
|
||||||
LoggerUtils.getActionStr(ev.action),
|
log += "\n Source " + getTargetsStr(ev.srcTarget);
|
||||||
LoggerUtils.getTargetStr(ev.srcTarget != null ? ev.srcTarget[0] : null),
|
|
||||||
LoggerUtils.getTargetStr(ev.srcTarget != null && ev.srcTarget.length > 1 ?
|
|
||||||
ev.srcTarget[1] : null)));
|
|
||||||
if (ev.destTarget != null && ev.destTarget.length > 0) {
|
|
||||||
Log.d(TAG, String.format(Locale.US,
|
|
||||||
" Destination child:%s\tparent:%s",
|
|
||||||
LoggerUtils.getTargetStr(ev.destTarget != null ? ev.destTarget[0] : null),
|
|
||||||
LoggerUtils.getTargetStr(ev.destTarget != null && ev.destTarget.length > 1 ?
|
|
||||||
ev.destTarget[1] : null)));
|
|
||||||
}
|
}
|
||||||
Log.d(TAG, String.format(Locale.US,
|
if (ev.destTarget != null && ev.destTarget.length > 0) {
|
||||||
" Elapsed container %d ms session %d ms action %d ms",
|
log += "\n Destination " + getTargetsStr(ev.destTarget);
|
||||||
|
}
|
||||||
|
log += String.format(Locale.US,
|
||||||
|
"\n Elapsed container %d ms session %d ms action %d ms",
|
||||||
ev.elapsedContainerMillis,
|
ev.elapsedContainerMillis,
|
||||||
ev.elapsedSessionMillis,
|
ev.elapsedSessionMillis,
|
||||||
ev.actionDurationMillis));
|
ev.actionDurationMillis);
|
||||||
|
Log.d(TAG, log);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getTargetsStr(Target[] targets) {
|
||||||
|
return "child:" + LoggerUtils.getTargetStr(targets[0]) +
|
||||||
|
(targets.length > 1 ? "\tparent:" + LoggerUtils.getTargetStr(targets[1]) : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,8 @@ import com.android.launcher3.dragndrop.DragLayer;
|
||||||
import com.android.launcher3.dragndrop.DragOptions;
|
import com.android.launcher3.dragndrop.DragOptions;
|
||||||
import com.android.launcher3.dragndrop.DragView;
|
import com.android.launcher3.dragndrop.DragView;
|
||||||
import com.android.launcher3.graphics.TriangleShape;
|
import com.android.launcher3.graphics.TriangleShape;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ItemType;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -523,9 +524,9 @@ public class DeepShortcutsContainer extends AbstractFloatingView
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
|
public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
|
||||||
target.itemType = LauncherLogProto.DEEPSHORTCUT;
|
target.itemType = ItemType.DEEPSHORTCUT;
|
||||||
// TODO: add target.rank
|
// TODO: add target.rank
|
||||||
targetParent.containerType = LauncherLogProto.DEEPSHORTCUTS;
|
targetParent.containerType = ContainerType.DEEPSHORTCUTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -46,6 +46,7 @@ import com.android.launcher3.graphics.LauncherIcons;
|
||||||
import com.android.launcher3.model.PackageItemInfo;
|
import com.android.launcher3.model.PackageItemInfo;
|
||||||
import com.android.launcher3.model.WidgetItem;
|
import com.android.launcher3.model.WidgetItem;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
||||||
|
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
|
||||||
import com.android.launcher3.util.MultiHashMap;
|
import com.android.launcher3.util.MultiHashMap;
|
||||||
import com.android.launcher3.util.Thunk;
|
import com.android.launcher3.util.Thunk;
|
||||||
|
@ -309,6 +310,6 @@ public class WidgetsContainerView extends BaseContainerView
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
|
public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
|
||||||
targetParent.containerType = LauncherLogProto.WIDGETS;
|
targetParent.containerType = ContainerType.WIDGETS;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,5 +20,5 @@ public class ProviderConfig {
|
||||||
|
|
||||||
public static final String AUTHORITY = "com.android.launcher3.settings".intern();
|
public static final String AUTHORITY = "com.android.launcher3.settings".intern();
|
||||||
|
|
||||||
public static boolean IS_DOGFOOD_BUILD = true;
|
public static final boolean IS_DOGFOOD_BUILD = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue