From 6470cf449f1caf6a030e7ea93e785bb6ba414a59 Mon Sep 17 00:00:00 2001 From: Hyunyoung Song Date: Tue, 10 May 2016 16:59:55 -0700 Subject: Send predictedApps rank via user event logging Change-Id: Ib492cb77bce0bc57f60bc4b1310df0810b63d0aa --- .../launcher3/logging/UserEventDispatcher.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java index 89ad07515..c06dc19fd 100644 --- a/src/com/android/launcher3/logging/UserEventDispatcher.java +++ b/src/com/android/launcher3/logging/UserEventDispatcher.java @@ -16,6 +16,7 @@ package com.android.launcher3.logging; +import android.content.ComponentName; import android.content.Intent; import android.view.View; import android.view.ViewParent; @@ -88,7 +89,7 @@ public abstract class UserEventDispatcher { // intentHash required // -------------------------------------------------------------- - protected LauncherEvent createLauncherEvent(View v) { + protected LauncherEvent createLauncherEvent(View v, Intent intent) { LauncherEvent event = LoggerUtils.initLauncherEvent( Action.TOUCH, Target.ITEM, Target.CONTAINER); event.action.touch = Action.TAP; @@ -97,9 +98,17 @@ public abstract class UserEventDispatcher { // TODO: make this percolate up the view hierarchy if needed. int idx = 0; LaunchSourceProvider provider = getLaunchProviderRecursive(v); - provider.fillInLaunchSourceData(v, (ItemInfo) v.getTag(), event.srcTarget[idx], event.srcTarget[idx + 1]); - - // TODO: Fill in all the hashes and the predictedRank + ItemInfo itemInfo = (ItemInfo) v.getTag(); + provider.fillInLaunchSourceData(v, itemInfo, event.srcTarget[idx], event.srcTarget[idx + 1]); + + event.srcTarget[idx].intentHash = intent.hashCode(); + ComponentName cn = intent.getComponent(); + if (cn != null) { + event.srcTarget[idx].packageNameHash = cn.getPackageName().hashCode(); + event.srcTarget[idx].componentHash = cn.hashCode(); + event.srcTarget[idx].predictedRank = mPredictedApps.indexOf( + new ComponentKey(cn, itemInfo.user)); + } // Fill in the duration of time spent navigating in Launcher and the container. event.elapsedContainerMillis = System.currentTimeMillis() - mElapsedContainerMillis; @@ -108,7 +117,7 @@ public abstract class UserEventDispatcher { } public void logAppLaunch(View v, Intent intent) { - dispatchUserEvent(createLauncherEvent(v), intent); + dispatchUserEvent(createLauncherEvent(v, intent), intent); } public void logTap(View v) { -- cgit v1.2.3