Implement ConnectivityStateMetrics sample

Test: ConnectivitySampleMetricsTest
Change-Id: I0afdda023208c3f8620cb5b89add66448af596d7
This commit is contained in:
Chalard Jean
2023-08-22 19:07:47 +09:00
parent 0f5c4fe9cb
commit f95e2de35a
7 changed files with 459 additions and 2 deletions

View File

@@ -755,6 +755,9 @@ public class ConnectivityServiceTest {
if (Context.TETHERING_SERVICE.equals(name)) return mTetheringManager;
if (Context.ACTIVITY_SERVICE.equals(name)) return mActivityManager;
if (Context.TELEPHONY_SUBSCRIPTION_SERVICE.equals(name)) return mSubscriptionManager;
// StatsManager is final and can't be mocked, and uses static methods for mostly
// everything. The simplest fix is to return null and not have metrics in tests.
if (Context.STATS_MANAGER.equals(name)) return null;
return super.getSystemService(name);
}