Skip to content

Commit

Permalink
[CT][Engagement Signals] Add experiment override to CustomTabsFeature…
Browse files Browse the repository at this point in the history
…Used enum

(cherry picked from commit 4ada421)

Bug: 1401098
Change-Id: Ib7c070ea19e9d1fb0a04fd1f044f5ddc8174c081
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4129894
Commit-Queue: Sinan Sahin <sinansahin@google.com>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1087678}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4149967
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Donn Denman <donnd@chromium.org>
Commit-Queue: Donn Denman <donnd@chromium.org>
Cr-Commit-Position: refs/branch-heads/5481@{#195}
Cr-Branched-From: 130f3e4-refs/heads/main@{#1084008}
  • Loading branch information
fsinan authored and Chromium LUCI CQ committed Jan 10, 2023
1 parent 5c10a1f commit 410499b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public CustomTabIntentDataProvider(Intent intent, Context context, int colorSche
intent, EXTRA_ENABLE_BACKGROUND_INTERACTION, BACKGROUND_INTERACT_DEFAULT);
mInteractWithBackground = backgroundInteractBehavior != BACKGROUND_INTERACT_OFF;

logCustomTabFeatures(intent, colorScheme);
logCustomTabFeatures(intent, colorScheme, usingDynamicFeatures);
}

/** Returns the toolbar corner radius in px. */
Expand Down Expand Up @@ -740,8 +740,11 @@ private static int convertOrientationType(@ScreenOrientation.LockType int orient
* usage by apps.
* @param intent The intent used to launch the CCT.
* @param colorScheme The requested color scheme to use with the CCT.
* @param isUsingDynamicFeatures Whether the intent specified Features to dynamically enable or
* disable.
*/
private void logCustomTabFeatures(Intent intent, int colorScheme) {
private void logCustomTabFeatures(
Intent intent, int colorScheme, boolean isUsingDynamicFeatures) {
if (!CustomTabsFeatureUsage.isEnabled()) return;
CustomTabsFeatureUsage featureUsage = new CustomTabsFeatureUsage();

Expand Down Expand Up @@ -845,6 +848,9 @@ private void logCustomTabFeatures(Intent intent, int colorScheme) {
featureUsage.log(CustomTabsFeature.EXTRA_ADDITIONAL_TRUSTED_ORIGINS);
}
if (mEnableUrlBarHiding) featureUsage.log(CustomTabsFeature.EXTRA_ENABLE_URLBAR_HIDING);
if (isUsingDynamicFeatures) {
featureUsage.log(CustomTabsFeature.EXTRA_INTENT_FEATURE_OVERRIDES);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public class CustomTabsFeatureUsage {
CustomTabsFeature.EXTRA_LAUNCH_AS_TRUSTED_WEB_ACTIVITY,
CustomTabsFeature.EXTRA_ADDITIONAL_TRUSTED_ORIGINS,
CustomTabsFeature.EXTRA_ENABLE_URLBAR_HIDING,
CustomTabsFeature.EXTRA_AUTO_TRANSLATE_LANGUAGE, CustomTabsFeature.COUNT})
CustomTabsFeature.EXTRA_AUTO_TRANSLATE_LANGUAGE,
CustomTabsFeature.EXTRA_INTENT_FEATURE_OVERRIDES, CustomTabsFeature.COUNT})
@Retention(RetentionPolicy.SOURCE)
public @interface CustomTabsFeature {
/** Special enum for the start of a session. */
Expand Down Expand Up @@ -92,9 +93,10 @@ public class CustomTabsFeatureUsage {
int EXTRA_ADDITIONAL_TRUSTED_ORIGINS = 40;
int EXTRA_ENABLE_URLBAR_HIDING = 41;
int EXTRA_AUTO_TRANSLATE_LANGUAGE = 42;
int EXTRA_INTENT_FEATURE_OVERRIDES = 43;

/** Total count of entries. */
int COUNT = 43;
int COUNT = 44;
}

// Whether flag-enabled or not.
Expand Down
3 changes: 2 additions & 1 deletion tools/metrics/histograms/enums.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23969,7 +23969,7 @@ metrics consent we also won't be able to send UMA metrics. -->
<int value="11" label="Disable download EXTRA_DISABLE_DOWNLOAD_BUTTON"/>
<int value="12" label="Disable star EXTRA_DISABLE_STAR_BUTTON"/>
<int value="13" label="Exit animation EXTRA_EXIT_ANIMATION_BUNDLE"/>
<int value="14" label="GSA experiment ids EXPERIMENT_IDS"/>
<int value="14" label="AGA experiment ids EXPERIMENT_IDS"/>
<int value="15" label="Incognito EXTRA_OPEN_NEW_INCOGNITO_TAB"/>
<int value="16" label="Initial height EXTRA_INITIAL_ACTIVITY_HEIGHT_PX"/>
<int value="17" label="Media EXTRA_ENABLE_EMBEDDED_MEDIA_EXPERIENCE"/>
Expand Down Expand Up @@ -23998,6 +23998,7 @@ metrics consent we also won't be able to send UMA metrics. -->
<int value="40" label="TWA origins EXTRA_ADDITIONAL_TRUSTED_ORIGINS"/>
<int value="41" label="Url bar hiding EXTRA_ENABLE_URLBAR_HIDING"/>
<int value="42" label="Translate specified EXTRA_AUTO_TRANSLATE_LANGUAGE"/>
<int value="43" label="Experiment override EXTRA_AGA_EXPERIMENT_ENABLE"/>
</enum>

<enum name="CustomTabsParallelRequestStatusOnStart">
Expand Down

0 comments on commit 410499b

Please sign in to comment.