xref: /aosp_15_r20/external/cronet/components/metrics/android_metrics_provider.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "components/metrics/android_metrics_provider.h"
6 
7 #include "base/metrics/histogram_macros.h"
8 #include "base/system/sys_info.h"
9 
10 namespace metrics {
11 
AndroidMetricsProvider()12 AndroidMetricsProvider::AndroidMetricsProvider() {}
13 
~AndroidMetricsProvider()14 AndroidMetricsProvider::~AndroidMetricsProvider() {}
15 
ProvideHistograms()16 bool AndroidMetricsProvider::ProvideHistograms() {
17   // Equivalent to UMA_HISTOGRAM_BOOLEAN with the stability flag set.
18   UMA_STABILITY_HISTOGRAM_ENUMERATION(
19       "MemoryAndroid.LowRamDevice", base::SysInfo::IsLowEndDevice() ? 1 : 0, 2);
20 
21   return true;
22 }
23 
ProvidePreviousSessionData(metrics::ChromeUserMetricsExtension * uma_proto)24 void AndroidMetricsProvider::ProvidePreviousSessionData(
25     metrics::ChromeUserMetricsExtension* uma_proto) {
26   // The low-ram device status is unlikely to change between browser restarts.
27   // Hence, it's safe and useful to attach this status to a previous session
28   // log.
29   ProvideHistograms();
30 }
31 }  // namespace metrics
32