From 4bcca528e3af74e36ebebda0b8d1c847dc7f97c0 Mon Sep 17 00:00:00 2001 From: Susi Kharraz-Post Date: Tue, 23 Apr 2019 15:07:10 -0400 Subject: [PATCH] Restructure logging for selection of share targets After discussions with Matt restructuring the logging so each category corresponds to one of the fields in the new sharesheet and add a field that indicates the number of caller supplied share targets. Also fixing a bug that resulted in double logging. Bug: 131170860 Test: Manual testing with adb logcat Change-Id: I75e69f7dec2d6634fca7d55321298d9d8acf4382 --- core/java/com/android/internal/app/ChooserActivity.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java index be66de22cdcf..f0c64134c6af 100644 --- a/core/java/com/android/internal/app/ChooserActivity.java +++ b/core/java/com/android/internal/app/ChooserActivity.java @@ -1018,12 +1018,9 @@ public class ChooserActivity extends ResolverActivity { int cat = 0; int value = which; int directTargetAlsoRanked = -1; + int numCallerProvided = 0; HashedStringCache.HashResult directTargetHashed = null; switch (mChooserListAdapter.getPositionTargetType(which)) { - case ChooserListAdapter.TARGET_CALLER: - cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_APP_TARGET; - value -= mChooserListAdapter.getSelectableServiceTargetCount(); - break; case ChooserListAdapter.TARGET_SERVICE: cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET; // Log the package name + target name to answer the question if most users @@ -1039,13 +1036,14 @@ public class ChooserActivity extends ResolverActivity { directTargetAlsoRanked = getRankedPosition((SelectableTargetInfo) targetInfo); if (mCallerChooserTargets != null) { - value -= mCallerChooserTargets.length; + numCallerProvided = mCallerChooserTargets.length; } break; + case ChooserListAdapter.TARGET_CALLER: case ChooserListAdapter.TARGET_STANDARD: - cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET; - value -= mChooserListAdapter.getCallerTargetCount() - + mChooserListAdapter.getSelectableServiceTargetCount(); + cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_APP_TARGET; + value -= mChooserListAdapter.getSelectableServiceTargetCount(); + numCallerProvided = mChooserListAdapter.getCallerTargetCount(); break; case ChooserListAdapter.TARGET_STANDARD_AZ: // A-Z targets are unranked standard targets; we use -1 to mark that they @@ -1066,8 +1064,9 @@ public class ChooserActivity extends ResolverActivity { targetLogMaker.addTaggedData(MetricsEvent.FIELD_RANKED_POSITION, directTargetAlsoRanked); } + targetLogMaker.addTaggedData(MetricsEvent.FIELD_IS_CATEGORY_USED, + numCallerProvided); getMetricsLogger().write(targetLogMaker); - MetricsLogger.action(this, cat, value); } if (mIsSuccessfullySelected) { -- 2.11.0