Merge "Sharesheet - Fix wrong metric value being recorded" into qt-dev

This commit is contained in:
TreeHugger Robot
2019-04-21 00:27:23 +00:00
committed by Android (Google) Code Review

View File

@@ -224,6 +224,7 @@ public class ChooserActivity extends ResolverActivity {
public static final int LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS = 250; public static final int LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS = 250;
private static final int MAX_EXTRA_INITIAL_INTENTS = 2; private static final int MAX_EXTRA_INITIAL_INTENTS = 2;
private static final int MAX_EXTRA_CHOOSER_TARGETS = 2;
private boolean mListViewDataChanged = false; private boolean mListViewDataChanged = false;
@@ -412,8 +413,9 @@ public class ChooserActivity extends ResolverActivity {
pa = intent.getParcelableArrayExtra(Intent.EXTRA_CHOOSER_TARGETS); pa = intent.getParcelableArrayExtra(Intent.EXTRA_CHOOSER_TARGETS);
if (pa != null) { if (pa != null) {
ChooserTarget[] targets = new ChooserTarget[pa.length]; int count = Math.min(pa.length, MAX_EXTRA_CHOOSER_TARGETS);
for (int i = 0; i < pa.length; i++) { ChooserTarget[] targets = new ChooserTarget[count];
for (int i = 0; i < count; i++) {
if (!(pa[i] instanceof ChooserTarget)) { if (!(pa[i] instanceof ChooserTarget)) {
Log.w(TAG, "Chooser target #" + i + " not a ChooserTarget: " + pa[i]); Log.w(TAG, "Chooser target #" + i + " not a ChooserTarget: " + pa[i]);
targets = null; targets = null;
@@ -1024,7 +1026,6 @@ public class ChooserActivity extends ResolverActivity {
break; break;
case ChooserListAdapter.TARGET_SERVICE: case ChooserListAdapter.TARGET_SERVICE:
cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET; cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_SERVICE_TARGET;
value -= mChooserListAdapter.getCallerTargetCount();
// Log the package name + target name to answer the question if most users // Log the package name + target name to answer the question if most users
// share to mostly the same person or to a bunch of different people. // share to mostly the same person or to a bunch of different people.
ChooserTarget target = ChooserTarget target =
@@ -1036,6 +1037,10 @@ public class ChooserActivity extends ResolverActivity {
+ target.getTitle().toString(), + target.getTitle().toString(),
mMaxHashSaltDays); mMaxHashSaltDays);
directTargetAlsoRanked = getRankedPosition((SelectableTargetInfo) targetInfo); directTargetAlsoRanked = getRankedPosition((SelectableTargetInfo) targetInfo);
if (mCallerChooserTargets != null) {
value -= mCallerChooserTargets.length;
}
break; break;
case ChooserListAdapter.TARGET_STANDARD: case ChooserListAdapter.TARGET_STANDARD:
cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET; cat = MetricsEvent.ACTION_ACTIVITY_CHOOSER_PICKED_STANDARD_TARGET;