[Android][WebSignin] Add metric SuppressedSigninNotAllowed for account picker

This CL adds a metric SuppressedSigninNotAllowed to
Signin.AccountConsistencyPromoAction when web sign-in bottom sheet is
not shown due to sign-in not allowed.

(cherry picked from commit b709fc4209f19a2a64f479b05b4891235fc343c8)

Bug: 1135096
Change-Id: Ic2f3334a28c1a46da955ed4bd1069f3d76651e00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450090
Reviewed-by: Boris Sazonov <[email protected]>
Commit-Queue: Alice Wang <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#814583}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2460811
Reviewed-by: Alice Wang <[email protected]>
Cr-Commit-Position: refs/branch-heads/4280@{#136}
Cr-Branched-From: ea420fb963f9658c9969b6513c56b8f47efa1a2a-refs/heads/master@{#812852}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninUtils.java
index 3104c6b..75f7006 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninUtils.java
@@ -85,6 +85,8 @@
         SigninManager signinManager = IdentityServicesProvider.get().getSigninManager(
                 Profile.getLastUsedRegularProfile());
         if (!signinManager.isSignInAllowed()) {
+            AccountPickerDelegate.recordAccountConsistencyPromoAction(
+                    AccountConsistencyPromoAction.SUPPRESSED_SIGNIN_NOT_ALLOWED);
             return;
         }
         if (AccountManagerFacadeProvider.getInstance().tryGetGoogleAccounts().isEmpty()) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountConsistencyPromoAction.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountConsistencyPromoAction.java
index 1c421a8..a103016 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountConsistencyPromoAction.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/account_picker/AccountConsistencyPromoAction.java
@@ -24,6 +24,7 @@
         AccountConsistencyPromoAction.SIGNED_IN_WITH_DEFAULT_ACCOUNT,
         AccountConsistencyPromoAction.SIGNED_IN_WITH_NON_DEFAULT_ACCOUNT,
         AccountConsistencyPromoAction.SHOWN,
+        AccountConsistencyPromoAction.SUPPRESSED_SIGNIN_NOT_ALLOWED,
 })
 @Retention(RetentionPolicy.SOURCE)
 public @interface AccountConsistencyPromoAction {
@@ -64,5 +65,11 @@
      */
     int SHOWN = 6;
 
-    int MAX = 7;
+    /**
+     * Promo is not shown due to sign-in being disallowed either by an enterprise policy
+     * or by |Allow Chrome sign-in| toggle.
+     */
+    int SUPPRESSED_SIGNIN_NOT_ALLOWED = 7;
+
+    int MAX = 8;
 }
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 29fddee1..fefcb75 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -965,9 +965,13 @@
     User has selected the default account and signed in with it.
   </int>
   <int value="5" label="SignedInWithNonDefaultAccount">
-    User has selected one of the non default accounta and signed in with it.
+    User has selected one of the non default account and signed in with it.
   </int>
   <int value="6" label="Shown">The promo was shown to user.</int>
+  <int value="7" label="SuppressedSigninNotAllowed">
+    Promo is not shown due to sign-in being disallowed either by an enterprise
+    policy or by |Allow Chrome sign-in| toggle.
+  </int>
 </enum>
 
 <enum name="AccountManagerAccountAdditionSource">