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

Commit 83e849ce authored by Rhed Jao's avatar Rhed Jao Committed by Automerger Merge Worker
Browse files

Merge "Fix a crash when starting a service in the isolated split" into sc-dev am: bf53e16e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14260709

Change-Id: Id424e33da4973f85348374a8c3c31d87beada40c
parents f01d6f2e bf53e16e
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -4416,11 +4416,20 @@ public final class ActivityThread extends ClientTransactionHandler
            if (localLOGV) Slog.v(TAG, "Creating service " + data.info.name);

            Application app = packageInfo.makeApplication(false, mInstrumentation);
            java.lang.ClassLoader cl = packageInfo.getClassLoader();

            final java.lang.ClassLoader cl;
            if (data.info.splitName != null) {
                cl = packageInfo.getSplitClassLoader(data.info.splitName);
            } else {
                cl = packageInfo.getClassLoader();
            }
            service = packageInfo.getAppFactory()
                    .instantiateService(cl, data.info.name, data.intent);
            final ContextImpl context = ContextImpl.getImpl(service
            ContextImpl context = ContextImpl.getImpl(service
                    .createServiceBaseContext(this, packageInfo));
            if (data.info.splitName != null) {
                context = (ContextImpl) context.createContextForSplit(data.info.splitName);
            }
            // Service resources must be initialized with the same loaders as the application
            // context.
            context.getResources().addLoaders(