Decouple CrOS secondary user UMA consent from device owner consent.

This change ensures that regardless of the Device Owner's UMA enabled
state, secondary users can manage their UMA consent (during OOBE, or
from chrome://settings toggle).

During the OOBE consent flow, secondary users will continue to
be opt-in by default.

The scope of this change is for unmanaged ChromeOS devices. Managed
devices do not allow users to change consent, as it is managed by the
admins enterprise policy.

Prior to this change, the OOBE flow was confusing. For example,
if the Device Owner turns off UMA, subsequent users didn't have the
option to enable consent. When the Device Owner consents to UMA,
secondary users have the ability to toggle their consent.

This previous behaviour was confusing because a user with
multiple profiles on the same CrOS device might incorrectly think that
turning off UMA for their secondary profile will turn off UMA for
everyone on the device.

Test plan & new OOBE flows: go/cros-per-user-consent-flow-changes

BUG=b/283174830

Change-Id: Ife60d6f2fb0fe7961038006c6bf9a417a515d3fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5297698
Reviewed-by: Osama Fathy <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Commit-Queue: Hirthanan Subenderan <[email protected]>
Reviewed-by: Jong Ahn <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1288835}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 2785684..f324c89 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -1042,6 +1042,12 @@
 // Deprecated 04/2024.
 inline constexpr char kDIPSTimerLastUpdate[] = "dips_timer_last_update";
 
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+// Deprecated 04/2024
+constexpr char kMetricsUserInheritOwnerConsent[] =
+    "metrics.user_inherit_owner_consent";
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH)
+
 // Register local state used only for migration (clearing or moving to a new
 // key).
 void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) {
@@ -1484,6 +1490,11 @@
 
   // Deprecated 04/2024.
   registry->RegisterTimePref(kDIPSTimerLastUpdate, base::Time());
+
+  // Deprecated 04/2024.
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+  registry->RegisterBooleanPref(kMetricsUserInheritOwnerConsent, true);
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH)
 }
 
 void ClearSyncRequestedPrefAndMaybeMigrate(PrefService* profile_prefs) {
@@ -2794,6 +2805,11 @@
   // Added 04/2024.
   profile_prefs->ClearPref(kDIPSTimerLastUpdate);
 
+  // Added 04/2024.
+#if BUILDFLAG(IS_CHROMEOS_ASH)
+  profile_prefs->ClearPref(kMetricsUserInheritOwnerConsent);
+#endif  // BUILDFLAG(IS_CHROMEOS_ASH)
+
   // Please don't delete the following line. It is used by PRESUBMIT.py.
   // END_MIGRATE_OBSOLETE_PROFILE_PREFS