Frameworks/base: Add no-thread marking to zygote
Use ZygoteHooks code to mark zygote initialization to not be allowed to create threads. This is helpful when new classes are found to be used by apps but cannot be preloaded as they spawn threads. Bug: 27248115 Change-Id: I1dc3620d9e7d0054c672b993d89459fc4b353dfc
This commit is contained in:
@@ -43,6 +43,7 @@ import com.android.internal.os.InstallerConnection.InstallerException;
|
|||||||
import dalvik.system.DexFile;
|
import dalvik.system.DexFile;
|
||||||
import dalvik.system.PathClassLoader;
|
import dalvik.system.PathClassLoader;
|
||||||
import dalvik.system.VMRuntime;
|
import dalvik.system.VMRuntime;
|
||||||
|
import dalvik.system.ZygoteHooks;
|
||||||
|
|
||||||
import libcore.io.IoUtils;
|
import libcore.io.IoUtils;
|
||||||
|
|
||||||
@@ -597,6 +598,10 @@ public class ZygoteInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String argv[]) {
|
public static void main(String argv[]) {
|
||||||
|
// Mark zygote start. This ensures that thread creation will throw
|
||||||
|
// an error.
|
||||||
|
ZygoteHooks.startZygoteNoThreadCreation();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "ZygoteInit");
|
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "ZygoteInit");
|
||||||
RuntimeInit.enableDdms();
|
RuntimeInit.enableDdms();
|
||||||
@@ -648,6 +653,8 @@ public class ZygoteInit {
|
|||||||
// Zygote process unmounts root storage spaces.
|
// Zygote process unmounts root storage spaces.
|
||||||
Zygote.nativeUnmountStorageOnInit();
|
Zygote.nativeUnmountStorageOnInit();
|
||||||
|
|
||||||
|
ZygoteHooks.stopZygoteNoThreadCreation();
|
||||||
|
|
||||||
if (startSystemServer) {
|
if (startSystemServer) {
|
||||||
startSystemServer(abiList, socketName);
|
startSystemServer(abiList, socketName);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user