Commit 0a54890b authored by Sky Malice's avatar Sky Malice Committed by Commit Bot

Set PRIVACY_METRICS_REPORTING to false on CCT skip.

This approach is a short term work around to keep UMA disabled when CCT
FRE is skipped due to policy. On FRE load, this pref is set to true (the
default), with the expectation that it will be overridden when the user
accepts the ToS. However, when the FRE is skipped, the user never
accepts the ToS, and the default/incorrect value is persisted.

Note that this pref is not the main signal that UMA metrics should be
reported, but it is read by a non-zero number of locations. And it seems
best to keep this pref in sync with what it should hold.

The long term fix will be to remove the default being written to prefs,
but doing this would be more risky, and not as suitable for a late
merge. See bug for more details.

Bug: 1128955
Change-Id: I28b9ab0aeb1e86de9cad5f73b6a2650d9c34aa21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2416885Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarWenyu Fu <wenyufu@chromium.org>
Commit-Queue: Sky Malice <skym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808121}
parent cd4ee96c
...@@ -25,6 +25,7 @@ import org.chromium.chrome.browser.datareduction.DataReductionPromoUtils; ...@@ -25,6 +25,7 @@ import org.chromium.chrome.browser.datareduction.DataReductionPromoUtils;
import org.chromium.chrome.browser.datareduction.DataReductionProxyUma; import org.chromium.chrome.browser.datareduction.DataReductionProxyUma;
import org.chromium.chrome.browser.metrics.UmaUtils; import org.chromium.chrome.browser.metrics.UmaUtils;
import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManager;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.searchwidget.SearchWidgetProvider; import org.chromium.chrome.browser.searchwidget.SearchWidgetProvider;
import org.chromium.ui.base.LocalizationUtils; import org.chromium.ui.base.LocalizationUtils;
...@@ -452,6 +453,13 @@ public class FirstRunActivity extends FirstRunActivityBase implements FirstRunPa ...@@ -452,6 +453,13 @@ public class FirstRunActivity extends FirstRunActivityBase implements FirstRunPa
// intent. The re-launched intent will still need to know to avoid the FRE. // intent. The re-launched intent will still need to know to avoid the FRE.
FirstRunStatus.setEphemeralSkipFirstRun(true); FirstRunStatus.setEphemeralSkipFirstRun(true);
// This pref is written to have a value of true during the FRE's startup. If the user
// presses the accept ToS button, this pref's value is overridden with their choice.
// However, when the FRE is skipped, that initial value is the opposite of what we want, so
// manually set it to false here.
// TODO(https://crbug.com/1128955): Remove this once the default is not written on startup.
PrivacyPreferencesManager.getInstance().setUsageAndCrashReporting(false);
launchPendingIntentAndFinish(); launchPendingIntentAndFinish();
} }
......
...@@ -42,6 +42,7 @@ import org.chromium.chrome.browser.locale.DefaultSearchEngineDialogHelperUtils; ...@@ -42,6 +42,7 @@ import org.chromium.chrome.browser.locale.DefaultSearchEngineDialogHelperUtils;
import org.chromium.chrome.browser.locale.LocaleManager; import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.locale.LocaleManager.SearchEnginePromoType; import org.chromium.chrome.browser.locale.LocaleManager.SearchEnginePromoType;
import org.chromium.chrome.browser.policy.EnterpriseInfo; import org.chromium.chrome.browser.policy.EnterpriseInfo;
import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManager;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.MultiActivityTestRule; import org.chromium.chrome.test.MultiActivityTestRule;
...@@ -286,6 +287,9 @@ public class FirstRunIntegrationTest { ...@@ -286,6 +287,9 @@ public class FirstRunIntegrationTest {
"native never initialized."); "native never initialized.");
waitForActivity(CustomTabActivity.class); waitForActivity(CustomTabActivity.class);
Assert.assertFalse("Usage and crash reporting pref was set to true after skip",
PrivacyPreferencesManager.getInstance().isUsageAndCrashReportingPermittedByUser());
} }
@Test @Test
......
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