Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 882f62dd authored by Lorenzo Colitti's avatar Lorenzo Colitti Committed by android-build-merger
Browse files

Merge "Avoid null app context in StaticApplicationContextServiceFetcher." into nyc-dev

am: 7d4ed2f5

* commit '7d4ed2f5':
  Avoid null app context in StaticApplicationContextServiceFetcher.

Change-Id: I86ee864b37109cac50dacbd34685c9c000fb763b
parents 985a7670 7d4ed2f5
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -882,7 +882,12 @@ final class SystemServiceRegistry {
        public final T getService(ContextImpl ctx) {
            synchronized (StaticApplicationContextServiceFetcher.this) {
                if (mCachedInstance == null) {
                    mCachedInstance = createService(ctx.getApplicationContext());
                    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 .
                    mCachedInstance = createService(appContext != null ? appContext : ctx);
                }
                return mCachedInstance;
            }