Commit 9bd37671 authored by Sophey Dong's avatar Sophey Dong Committed by Commit Bot

[Sharing Hub] Create method for recording TimeToShare.

This removes copying the histogram name for every new option added.

Bug:1079467

Change-Id: I54dae11cf34535f71146923c3e0f85f87c3bb2ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2324722Reviewed-by: default avatarTanya Gupta <tgupta@chromium.org>
Reviewed-by: default avatarKyle Milka <kmilka@chromium.org>
Commit-Queue: Sophey Dong <sophey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792782}
parent 80b41c10
......@@ -181,9 +181,7 @@ class ChromeProvidedSharingOptionsProvider {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.ScreenshotSelected");
RecordHistogram.recordMediumTimesHistogram(
"Sharing.SharingHubAndroid.TimeToShare",
System.currentTimeMillis() - mShareStartTime);
recordTimeToShare(mShareStartTime);
mScreenshotCoordinator = new ScreenshotCoordinator(mActivity,
mTabProvider.get(), mChromeOptionShareCallback, mBottomSheetController);
// Capture a screenshot once the bottom sheet is fully hidden. The
......@@ -204,9 +202,7 @@ class ChromeProvidedSharingOptionsProvider {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.CopyURLSelected");
RecordHistogram.recordMediumTimesHistogram(
"Sharing.SharingHubAndroid.TimeToShare",
System.currentTimeMillis() - mShareStartTime);
recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true);
ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(
Context.CLIPBOARD_SERVICE);
......@@ -226,9 +222,7 @@ class ChromeProvidedSharingOptionsProvider {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.CopyImageSelected");
RecordHistogram.recordMediumTimesHistogram(
"Sharing.SharingHubAndroid.TimeToShare",
System.currentTimeMillis() - mShareStartTime);
recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true);
if (!mShareParams.getFileUris().isEmpty()) {
Clipboard.getInstance().setImageUri(mShareParams.getFileUris().get(0));
......@@ -246,9 +240,7 @@ class ChromeProvidedSharingOptionsProvider {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.CopyTextSelected");
RecordHistogram.recordMediumTimesHistogram(
"Sharing.SharingHubAndroid.TimeToShare",
System.currentTimeMillis() - mShareStartTime);
recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true);
ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(
Context.CLIPBOARD_SERVICE);
......@@ -268,9 +260,7 @@ class ChromeProvidedSharingOptionsProvider {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.SendTabToSelfSelected");
RecordHistogram.recordMediumTimesHistogram(
"Sharing.SharingHubAndroid.TimeToShare",
System.currentTimeMillis() - mShareStartTime);
recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true);
SendTabToSelfShareActivity.actionHandler(mActivity, mUrl,
mShareParams.getTitle(),
......@@ -294,9 +284,7 @@ class ChromeProvidedSharingOptionsProvider {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.QRCodeSelected");
RecordHistogram.recordMediumTimesHistogram(
"Sharing.SharingHubAndroid.TimeToShare",
System.currentTimeMillis() - mShareStartTime);
recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true);
QrCodeCoordinator qrCodeCoordinator = new QrCodeCoordinator(mActivity, mUrl);
qrCodeCoordinator.show();
......@@ -314,9 +302,7 @@ class ChromeProvidedSharingOptionsProvider {
(view)
-> {
RecordUserAction.record("SharingHubAndroid.PrintSelected");
RecordHistogram.recordMediumTimesHistogram(
"Sharing.SharingHubAndroid.TimeToShare",
System.currentTimeMillis() - mShareStartTime);
recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true);
mPrintTabCallback.onResult(mTabProvider.get());
},
......@@ -332,9 +318,7 @@ class ChromeProvidedSharingOptionsProvider {
(currentActivity)
-> {
RecordUserAction.record("SharingHubAndroid.LinkToTextSelected");
RecordHistogram.recordMediumTimesHistogram(
"Sharing.SharingHubAndroid.TimeToShare",
System.currentTimeMillis() - mShareStartTime);
recordTimeToShare(mShareStartTime);
mBottomSheetController.hideContent(mBottomSheetContent, true);
// TODO(1102382): Init and call link-to-text feature.
},
......@@ -357,4 +341,9 @@ class ChromeProvidedSharingOptionsProvider {
}
return chromeShareExtras.getImageSrcUrl();
}
static void recordTimeToShare(long shareStartTime) {
RecordHistogram.recordMediumTimesHistogram("Sharing.SharingHubAndroid.TimeToShare",
System.currentTimeMillis() - shareStartTime);
}
}
......@@ -101,8 +101,8 @@ public class ShareSheetPropertyModelBuilder {
* <li>If a URL is present, {@code isUrlOfVisiblePage} determines whether to add
* {@link ContentType.LINK_PAGE_VISIBLE} or {@link ContentType.LINK_PAGE_NOT_VISIBLE}.
* <li>If the text being shared is not the same as the URL, add {@link ContentType.TEXT}
<li>If text is highlighted by user, add {@link ContentType.HIGHLIGHTED_TEXT}.
<li>If the share contains files and the {@code fileContentType} is an image, add
* <li>If text is highlighted by user, add {@link ContentType.HIGHLIGHTED_TEXT}.
* <li>If the share contains files and the {@code fileContentType} is an image, add
* {@link ContentType.IMAGE}. Otherwise, add {@link ContentType.OTHER_FILE_TYPE}.
* </ul>
*/
......@@ -181,7 +181,7 @@ public class ShareSheetPropertyModelBuilder {
(String) info.loadLabel(mPackageManager), onClickListener,
/*isFirstParty=*/false);
models.add(propertyModel);
};
}
return models;
}
......@@ -193,8 +193,7 @@ public class ShareSheetPropertyModelBuilder {
RecordUserAction.record("SharingHubAndroid.ThirdPartyAppSelected");
RecordHistogram.recordEnumeratedHistogram(
"Sharing.SharingHubAndroid.ThirdPartyAppUsage", logIndex, MAX_NUM_APPS + 1);
RecordHistogram.recordMediumTimesHistogram("Sharing.SharingHubAndroid.TimeToShare",
System.currentTimeMillis() - shareStartTime);
ChromeProvidedSharingOptionsProvider.recordTimeToShare(shareStartTime);
ComponentName component = new ComponentName(ai.applicationInfo.packageName, ai.name);
if (callback != null) {
callback.onTargetChosen(component);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment