summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorChalard Jean <jchalard@google.com>2021-10-27 06:36:24 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-10-27 06:36:24 +0000
commit62f13c3f07fae758a19e431213fcd63f89b2fd7f (patch)
treed7539a865b0e6ab80b75390c3df66218999cfd25 /core/java/android
parent3d7e1743e854eb317e34e692718dc2be5f43e1ce (diff)
parent9bdb13089eb3e7f59a416a3465ca53df2b434d4a (diff)
Merge "Remove the static application context fetcher" am: 35cbd1d5ee am: ac2bc495f5 am: 4afb2fa833 am: 9bdb13089e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1870453 Change-Id: I8b19d7075349a7b6f1daac7e917e0507df885413
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/SystemServiceRegistry.java33
1 files changed, 0 insertions, 33 deletions
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index 32ea41b2c75f..e2fd35940b52 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -1914,39 +1914,6 @@ public final class SystemServiceRegistry {
public abstract T createService() throws ServiceNotFoundException;
}
- /**
- * Like StaticServiceFetcher, creates only one instance of the service per application, but when
- * creating the service for the first time, passes it the application context of the creating
- * application.
- *
- * TODO: Delete this once its only user (ConnectivityManager) is known to work well in the
- * case where multiple application components each have their own ConnectivityManager object.
- */
- static abstract class StaticApplicationContextServiceFetcher<T> implements ServiceFetcher<T> {
- private T mCachedInstance;
-
- @Override
- public final T getService(ContextImpl ctx) {
- synchronized (StaticApplicationContextServiceFetcher.this) {
- if (mCachedInstance == null) {
- Context appContext = ctx.getApplicationContext();
- // If the application context is null, we're either in the system process or
- // it's the application context very early in app initialization. In both these
- // cases, the passed-in ContextImpl will not be freed, so it's safe to pass it
- // to the service. http://b/27532714 .
- try {
- mCachedInstance = createService(appContext != null ? appContext : ctx);
- } catch (ServiceNotFoundException e) {
- onServiceNotFound(e);
- }
- }
- return mCachedInstance;
- }
- }
-
- public abstract T createService(Context applicationContext) throws ServiceNotFoundException;
- }
-
/** @hide */
public static void onServiceNotFound(ServiceNotFoundException e) {
// We're mostly interested in tracking down long-lived core system