diff options
| author | Chalard Jean <jchalard@google.com> | 2021-10-27 05:19:00 +0000 |
|---|---|---|
| committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-10-27 05:19:00 +0000 |
| commit | ac2bc495f57c7dc7f624339641bf9a50cdacc4fa (patch) | |
| tree | 0c10bdc0309f944d106c0d013765292be5e2ff41 /core/java/android | |
| parent | 0eef459622f53a04c71af1af166c22002d44aded (diff) | |
| parent | 35cbd1d5ee4c345ab53f5db62232227514d73035 (diff) | |
Merge "Remove the static application context fetcher" am: 35cbd1d5ee
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1870453
Change-Id: I210e054c6380ee42ab6799e96d21177bd57a9343
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/SystemServiceRegistry.java | 33 |
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 |
