Support per-process Application class (AM and client side)

Now the <process> tag supports `android:name`, which takes a custom
Application class name. If omitted, the system defaults to the
class set in the <application> tag, or the default class which is
`android.app.Application`.

Bug: 197264681
Test: atest CtsProcessTest
Change-Id: I0650a4a7c75dc37c00875e4f0ac53656f1cbeac9
This commit is contained in:
Makoto Onuki
2021-12-10 09:44:16 -08:00
parent 236abad797
commit 19f22d590d

View File

@@ -1352,7 +1352,9 @@ public final class LoadedApk {
Application app = null;
String appClass = mApplicationInfo.className;
final String myProcessName = Process.myProcessName();
String appClass = mApplicationInfo.getCustomApplicationClassNameForProcess(
myProcessName);
if (forceDefaultAppClass || (appClass == null)) {
appClass = "android.app.Application";
}