Refactors in UserEventDispatcher
- LaunchSource -> LogContainer
Change-Id: I71bfee992fb1ba7ae80e824d419f7bf8d3020999
diff --git a/src/com/android/launcher3/DragSource.java b/src/com/android/launcher3/DragSource.java
index efbb9d7..2fb495f 100644
--- a/src/com/android/launcher3/DragSource.java
+++ b/src/com/android/launcher3/DragSource.java
@@ -19,12 +19,12 @@
import android.view.View;
import com.android.launcher3.DropTarget.DragObject;
-import com.android.launcher3.logging.UserEventDispatcher.LaunchSourceProvider;
+import com.android.launcher3.logging.UserEventDispatcher.LogContainerProvider;
/**
* Interface defining an object that can originate a drag.
*/
-public interface DragSource extends LaunchSourceProvider {
+public interface DragSource extends LogContainerProvider {
/**
* @return whether items dragged from this source supports
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index f9424d4..11d6b50 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -42,7 +42,7 @@
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
public class Hotseat extends FrameLayout
- implements UserEventDispatcher.LaunchSourceProvider {
+ implements UserEventDispatcher.LogContainerProvider {
private CellLayout mContent;
@@ -172,7 +172,7 @@
}
@Override
- public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) {
+ public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
target.gridX = info.cellX;
target.gridY = info.cellY;
targetParent.containerType = LauncherLogProto.HOTSEAT;
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index d252460..e583be4 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -4256,7 +4256,7 @@
}
@Override
- public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) {
+ public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
target.gridX = info.cellX;
target.gridY = info.cellY;
target.pageIndex = getCurrentPage();
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 77e8ad1..cdd2f1d 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -586,7 +586,7 @@
}
@Override
- public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) {
+ public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
targetParent.containerType = mAppsRecyclerView.getContainerType(v);
}
diff --git a/src/com/android/launcher3/dragndrop/AnotherWindowDragSource.java b/src/com/android/launcher3/dragndrop/AnotherWindowDragSource.java
index 156941a..e968f36 100644
--- a/src/com/android/launcher3/dragndrop/AnotherWindowDragSource.java
+++ b/src/com/android/launcher3/dragndrop/AnotherWindowDragSource.java
@@ -70,7 +70,7 @@
}
@Override
- public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) {
+ public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
// TODO: Probably log something
}
}
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index b85d973..7030b66 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -1430,7 +1430,7 @@
}
@Override
- public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) {
+ public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
target.gridX = info.cellX;
target.gridY = info.cellY;
target.pageIndex = mContent.getCurrentPage();
diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java
index 8c702bf..441d8e5 100644
--- a/src/com/android/launcher3/logging/UserEventDispatcher.java
+++ b/src/com/android/launcher3/logging/UserEventDispatcher.java
@@ -48,13 +48,9 @@
private final boolean mIsVerbose;
/**
- * TODO: change the name of this interface to LogContainerProvider
- * and the method name to fillInLogContainerData. Not changed to minimize CL diff
- * in this branch.
- *
- * Implemented by containers to provide a launch source for a given child.
+ * Implemented by containers to provide a container source for a given child.
*/
- public interface LaunchSourceProvider {
+ public interface LogContainerProvider {
/**
* Copies data from the source to the destination proto.
@@ -64,13 +60,13 @@
* @param target dest of the data
* @param targetParent dest of the data
*/
- void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent);
+ void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent);
}
/**
* Recursively finds the parent of the given child which implements IconLogInfoProvider
*/
- public static LaunchSourceProvider getLaunchProviderRecursive(View v) {
+ public static LogContainerProvider getLaunchProviderRecursive(View v) {
ViewParent parent = null;
if (v != null) {
@@ -82,8 +78,8 @@
// Optimization to only check up to 5 parents.
int count = MAXIMUM_VIEW_HIERARCHY_LEVEL;
while (parent != null && count-- > 0) {
- if (parent instanceof LaunchSourceProvider) {
- return (LaunchSourceProvider) parent;
+ if (parent instanceof LogContainerProvider) {
+ return (LogContainerProvider) parent;
} else {
parent = parent.getParent();
}
@@ -123,12 +119,12 @@
// Fill in grid(x,y), pageIndex of the child and container type of the parent
// TODO: make this percolate up the view hierarchy if needed.
int idx = 0;
- LaunchSourceProvider provider = getLaunchProviderRecursive(v);
+ LogContainerProvider provider = getLaunchProviderRecursive(v);
if (v == null || !(v.getTag() instanceof ItemInfo) || provider == null) {
return null;
}
ItemInfo itemInfo = (ItemInfo) v.getTag();
- provider.fillInLaunchSourceData(v, itemInfo, event.srcTarget[idx], event.srcTarget[idx + 1]);
+ provider.fillInLogContainerData(v, itemInfo, event.srcTarget[idx], event.srcTarget[idx + 1]);
event.srcTarget[idx].intentHash = intent.hashCode();
ComponentName cn = intent.getComponent();
@@ -181,12 +177,12 @@
public void logDeepShortcutsOpen(View icon) {
LauncherEvent event = LoggerUtils.initLauncherEvent(
Action.TOUCH, icon, Target.CONTAINER);
- LaunchSourceProvider provider = getLaunchProviderRecursive(icon);
+ LogContainerProvider provider = getLaunchProviderRecursive(icon);
if (icon == null && !(icon.getTag() instanceof ItemInfo)) {
return;
}
ItemInfo info = (ItemInfo) icon.getTag();
- provider.fillInLaunchSourceData(icon, info, event.srcTarget[0], event.srcTarget[1]);
+ provider.fillInLogContainerData(icon, info, event.srcTarget[0], event.srcTarget[1]);
event.action.touch = Action.LONGPRESS;
dispatchUserEvent(event, null);
@@ -205,11 +201,11 @@
dropTargetAsView);
event.action.touch = Action.DRAGDROP;
- dragObj.dragSource.fillInLaunchSourceData(null, dragObj.originalDragInfo,
+ dragObj.dragSource.fillInLogContainerData(null, dragObj.originalDragInfo,
event.srcTarget[0], event.srcTarget[1]);
- if (dropTargetAsView instanceof LaunchSourceProvider) {
- ((LaunchSourceProvider) dropTargetAsView).fillInLaunchSourceData(null,
+ if (dropTargetAsView instanceof LogContainerProvider) {
+ ((LogContainerProvider) dropTargetAsView).fillInLogContainerData(null,
dragObj.dragInfo, event.destTarget[0], event.destTarget[1]);
}
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
index 31f3823..9f9a99e 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
@@ -506,7 +506,7 @@
}
@Override
- public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) {
+ public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
target.itemType = LauncherLogProto.DEEPSHORTCUT;
// TODO: add target.rank
targetParent.containerType = LauncherLogProto.DEEPSHORTCUTS;
diff --git a/src/com/android/launcher3/widget/WidgetsContainerView.java b/src/com/android/launcher3/widget/WidgetsContainerView.java
index 07c8e38..ecc853d 100644
--- a/src/com/android/launcher3/widget/WidgetsContainerView.java
+++ b/src/com/android/launcher3/widget/WidgetsContainerView.java
@@ -338,7 +338,7 @@
}
@Override
- public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) {
+ public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
targetParent.containerType = LauncherLogProto.WIDGETS;
}
}
\ No newline at end of file