diff options
| author | Junyu Lai <junyulai@google.com> | 2021-12-16 10:42:15 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-12-16 10:42:15 +0000 |
| commit | 7fee9dd710bb4a7532137478d9733cf95db7ab27 (patch) | |
| tree | 323bfd51af716c0e3a607041d12c3354e6849a67 /core/java/android | |
| parent | 00d8163936a4ef40c130a8912d2222f2a1880f33 (diff) | |
| parent | 9d08a3ff2a07452ead5bbb7e97cfefda8e281c64 (diff) | |
Merge "[MS03] Remove ServiceNotFoundException hidden API usage"
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/SystemServiceRegistry.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index 0171f0a5a327..f9739a489453 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -130,6 +130,7 @@ import android.net.EthernetManager; import android.net.IEthernetManager; import android.net.IIpSecService; import android.net.INetworkPolicyManager; +import android.net.INetworkStatsService; import android.net.IPacProxyManager; import android.net.IVpnManager; import android.net.IpSecManager; @@ -981,7 +982,11 @@ public final class SystemServiceRegistry { new CachedServiceFetcher<NetworkStatsManager>() { @Override public NetworkStatsManager createService(ContextImpl ctx) throws ServiceNotFoundException { - return new NetworkStatsManager(ctx.getOuterContext()); + // TODO: Replace with an initializer in the module, see + // {@code ConnectivityFrameworkInitializer}. + final INetworkStatsService service = INetworkStatsService.Stub.asInterface( + ServiceManager.getServiceOrThrow(Context.NETWORK_STATS_SERVICE)); + return new NetworkStatsManager(ctx.getOuterContext(), service); }}); registerService(Context.PERSISTENT_DATA_BLOCK_SERVICE, PersistentDataBlockManager.class, |
