LeOSium_webview/LeOS/patches/Disable-various-metrics.patch

247 lines
11 KiB
Diff
Raw Normal View History

2023-11-18 11:46:19 +01:00
From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Wed, 25 Apr 2018 10:23:51 +0200
Subject: Disable various metrics
Disable metrics on all I/O threads
Set initial metrics opt-out
Disable metrics collection for NTP tiles
Fix startup crash for debug builds (uazo)
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
.../browser/firstrun/FirstRunActivityBase.java | 2 +-
.../android/ntp/most_visited_sites_bridge.cc | 17 -----------------
chrome/browser/browser_process_impl.cc | 2 +-
chrome/browser/chrome_content_browser_client.cc | 15 ---------------
.../chrome_metrics_services_manager_client.cc | 8 ++++----
.../browser/ui/search/ntp_user_data_logger.cc | 4 ----
components/ntp_tiles/BUILD.gn | 3 ---
.../ntp_tiles/custom_links_manager_impl.cc | 1 -
components/ntp_tiles/most_visited_sites.cc | 2 --
services/metrics/public/cpp/ukm_recorder.cc | 2 +-
10 files changed, 7 insertions(+), 49 deletions(-)
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
@@ -57,7 +57,7 @@ public abstract class FirstRunActivityBase
static final String SHOW_SEARCH_ENGINE_PAGE = "ShowSearchEnginePage";
static final String SHOW_SYNC_CONSENT_PAGE = "ShowSyncConsent";
- public static final boolean DEFAULT_METRICS_AND_CRASH_REPORTING = true;
+ public static final boolean DEFAULT_METRICS_AND_CRASH_REPORTING = false;
private static PolicyLoadListenerFactory sPolicyLoadListenerFactoryForTesting;
diff --git a/chrome/browser/android/ntp/most_visited_sites_bridge.cc b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
--- a/chrome/browser/android/ntp/most_visited_sites_bridge.cc
+++ b/chrome/browser/android/ntp/most_visited_sites_bridge.cc
@@ -26,7 +26,6 @@
#include "chrome/browser/profiles/profile_android.h"
#include "components/favicon_base/favicon_types.h"
#include "components/history/core/browser/history_service.h"
-#include "components/ntp_tiles/metrics.h"
#include "components/ntp_tiles/most_visited_sites.h"
#include "components/ntp_tiles/section_type.h"
#include "ui/gfx/android/java_bitmap.h"
@@ -46,7 +45,6 @@ using ntp_tiles::NTPTilesVector;
using ntp_tiles::SectionType;
using ntp_tiles::TileTitleSource;
using ntp_tiles::TileSource;
-using ntp_tiles::TileVisualType;
namespace {
@@ -233,7 +231,6 @@ void MostVisitedSitesBridge::RecordPageImpression(
JNIEnv* env,
const JavaParamRef<jobject>& obj,
jint jtiles_count) {
- ntp_tiles::metrics::RecordPageImpression(jtiles_count);
}
void MostVisitedSitesBridge::RecordTileImpression(
@@ -245,15 +242,6 @@ void MostVisitedSitesBridge::RecordTileImpression(
jint jtitle_source,
jint jsource,
const JavaParamRef<jobject>& jurl) {
- std::unique_ptr<GURL> url = url::GURLAndroid::ToNativeGURL(env, jurl);
- TileTitleSource title_source = static_cast<TileTitleSource>(jtitle_source);
- TileSource source = static_cast<TileSource>(jsource);
- TileVisualType visual_type = static_cast<TileVisualType>(jvisual_type);
- favicon_base::IconType icon_type =
- static_cast<favicon_base::IconType>(jicon_type);
-
- ntp_tiles::metrics::RecordTileImpression(ntp_tiles::NTPTileImpression(
- jindex, source, title_source, visual_type, icon_type, *url));
}
void MostVisitedSitesBridge::RecordOpenedMostVisitedItem(
@@ -263,11 +251,6 @@ void MostVisitedSitesBridge::RecordOpenedMostVisitedItem(
jint tile_type,
jint title_source,
jint source) {
- ntp_tiles::metrics::RecordTileClick(ntp_tiles::NTPTileImpression(
- index, static_cast<TileSource>(source),
- static_cast<TileTitleSource>(title_source),
- static_cast<TileVisualType>(tile_type), favicon_base::IconType::kInvalid,
- /*url_for_rappor=*/GURL()));
}
static jlong JNI_MostVisitedSitesBridge_Init(
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -1043,7 +1043,7 @@ void BrowserProcessImpl::RegisterPrefs(PrefRegistrySimple* registry) {
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
registry->RegisterBooleanPref(metrics::prefs::kMetricsReportingEnabled,
- GoogleUpdateSettings::GetCollectStatsConsent());
+ false);
registry->RegisterBooleanPref(prefs::kDevToolsRemoteDebuggingAllowed, true);
}
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -80,7 +80,6 @@
#include "chrome/browser/hid/chrome_hid_delegate.h"
#include "chrome/browser/interstitials/enterprise_util.h"
#include "chrome/browser/lifetime/browser_shutdown.h"
-#include "chrome/browser/lookalikes/lookalike_url_navigation_throttle.h"
#include "chrome/browser/media/audio_service_util.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/webrtc/audio_debug_recordings_handler.h"
@@ -5029,16 +5028,6 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
content::NavigationHandle* handle) {
std::vector<std::unique_ptr<content::NavigationThrottle>> throttles;
- // MetricsNavigationThrottle requires that it runs before NavigationThrottles
- // that may delay or cancel navigations, so only NavigationThrottles that
- // don't delay or cancel navigations (e.g. throttles that are only observing
- // callbacks without affecting navigation behavior) should be added before
- // MetricsNavigationThrottle.
- if (handle->IsInMainFrame()) {
- throttles.push_back(
- page_load_metrics::MetricsNavigationThrottle::Create(handle));
- }
-
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
MaybeAddThrottle(
SupervisedUserNavigationThrottle::MaybeCreateThrottleFor(handle),
@@ -5139,10 +5128,6 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
throttle_manager->MaybeAppendNavigationThrottles(handle, &throttles);
}
- MaybeAddThrottle(
- LookalikeUrlNavigationThrottle::MaybeCreateNavigationThrottle(handle),
- &throttles);
-
MaybeAddThrottle(PDFIFrameNavigationThrottle::MaybeCreateThrottleFor(handle),
&throttles);
#if BUILDFLAG(ENABLE_PDF)
diff --git a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
--- a/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
+++ b/chrome/browser/metrics/chrome_metrics_services_manager_client.cc
@@ -75,8 +75,8 @@ namespace internal {
// recording and reporting are enabled. If the feature is enabled, but no
// consent is given, then there will be no recording or reporting.
BASE_FEATURE(kMetricsReportingFeature,
- "MetricsReporting",
- base::FEATURE_ENABLED_BY_DEFAULT);
+ "MetricsReporting", // disabled by default
+ base::FEATURE_DISABLED_BY_DEFAULT); // in Bromite
#if BUILDFLAG(IS_ANDROID)
// Same as |kMetricsReportingFeature|, but this feature is associated with a
@@ -85,8 +85,8 @@ BASE_FEATURE(kMetricsReportingFeature,
// the fix to not affect the overall sampling rate, this new feature was
// created. See crbug/1306481.
BASE_FEATURE(kPostFREFixMetricsReportingFeature,
- "PostFREFixMetricsReporting",
- base::FEATURE_ENABLED_BY_DEFAULT);
+ "PostFREFixMetricsReporting", // disabled by deault
+ base::FEATURE_DISABLED_BY_DEFAULT); // in Bromite
#endif // BUILDFLAG(IS_ANDROID)
// Name of the variations param that defines the sampling rate.
diff --git a/chrome/browser/ui/search/ntp_user_data_logger.cc b/chrome/browser/ui/search/ntp_user_data_logger.cc
--- a/chrome/browser/ui/search/ntp_user_data_logger.cc
+++ b/chrome/browser/ui/search/ntp_user_data_logger.cc
@@ -394,8 +394,6 @@ void NTPUserDataLogger::LogMostVisitedImpression(
void NTPUserDataLogger::LogMostVisitedNavigation(
const ntp_tiles::NTPTileImpression& impression) {
- ntp_tiles::metrics::RecordTileClick(impression);
-
// Records the action. This will be available as a time-stamped stream
// server-side and can be used to compute time-to-long-dwell.
base::RecordAction(base::UserMetricsAction("MostVisited_Clicked"));
@@ -424,10 +422,8 @@ void NTPUserDataLogger::EmitNtpStatistics(base::TimeDelta load_time,
if (!impression.has_value()) {
break;
}
- ntp_tiles::metrics::RecordTileImpression(*impression);
++tiles_count;
}
- ntp_tiles::metrics::RecordPageImpression(tiles_count);
DVLOG(1) << "Emitting NTP load time: " << load_time << ", "
<< "number of tiles: " << tiles_count;
diff --git a/components/ntp_tiles/BUILD.gn b/components/ntp_tiles/BUILD.gn
--- a/components/ntp_tiles/BUILD.gn
+++ b/components/ntp_tiles/BUILD.gn
@@ -23,8 +23,6 @@ static_library("ntp_tiles") {
"icon_cacher.h",
"icon_cacher_impl.cc",
"icon_cacher_impl.h",
- "metrics.cc",
- "metrics.h",
"most_visited_sites.cc",
"most_visited_sites.h",
"ntp_tile.cc",
@@ -92,7 +90,6 @@ source_set("unit_tests") {
"custom_links_manager_impl_unittest.cc",
"custom_links_store_unittest.cc",
"icon_cacher_impl_unittest.cc",
- "metrics_unittest.cc",
"most_visited_sites_unittest.cc",
"popular_sites_impl_unittest.cc",
]
diff --git a/components/ntp_tiles/custom_links_manager_impl.cc b/components/ntp_tiles/custom_links_manager_impl.cc
--- a/components/ntp_tiles/custom_links_manager_impl.cc
+++ b/components/ntp_tiles/custom_links_manager_impl.cc
@@ -203,7 +203,6 @@ void CustomLinksManagerImpl::RemoveCustomLinksForPreinstalledApps() {
}
}
if (default_app_links_deleted) {
- metrics::RecordsMigratedDefaultAppDeleted(DeletedTileType::kCustomLink);
prefs_->SetBoolean(prefs::kCustomLinksForPreinstalledAppsRemoved, true);
}
}
diff --git a/components/ntp_tiles/most_visited_sites.cc b/components/ntp_tiles/most_visited_sites.cc
--- a/components/ntp_tiles/most_visited_sites.cc
+++ b/components/ntp_tiles/most_visited_sites.cc
@@ -704,8 +704,6 @@ void MostVisitedSites::SaveTilesAndNotify(
: new_tiles;
if (fixed_tiles.size() != new_tiles.size()) {
- metrics::RecordsMigratedDefaultAppDeleted(
- DeletedTileType::kMostVisitedSite);
}
if (!current_tiles_.has_value() || (*current_tiles_ != fixed_tiles)) {
current_tiles_.emplace(std::move(fixed_tiles));
diff --git a/services/metrics/public/cpp/ukm_recorder.cc b/services/metrics/public/cpp/ukm_recorder.cc
--- a/services/metrics/public/cpp/ukm_recorder.cc
+++ b/services/metrics/public/cpp/ukm_recorder.cc
@@ -14,7 +14,7 @@
namespace ukm {
-BASE_FEATURE(kUkmFeature, "Ukm", base::FEATURE_ENABLED_BY_DEFAULT);
+BASE_FEATURE(kUkmFeature, "Ukm", base::FEATURE_DISABLED_BY_DEFAULT); // disabled in Bromite
BASE_FEATURE(kUkmReduceAddEntryIPC,
"UkmReduceAddEntryIPC",
--
2.25.1