Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bcca528 authored by Susi Kharraz-Post's avatar Susi Kharraz-Post
Browse files

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
parent 25b06f04
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -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) {