Loading core/java/android/os/Trace.java +10 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.os; import com.android.internal.os.Zygote; import dalvik.annotation.optimization.FastNative; /** Loading Loading @@ -94,6 +96,8 @@ public final class Trace { // Must be volatile to avoid word tearing. private static volatile long sEnabledTags = TRACE_TAG_NOT_READY; private static int sZygoteDebugFlags = 0; private static native long nativeGetEnabledTags(); private static native void nativeSetAppTracingAllowed(boolean allowed); private static native void nativeSetTracingEnabled(boolean allowed); Loading @@ -118,9 +122,10 @@ public final class Trace { // The system provides ordering through a priority level. Callbacks made through // SystemProperties.addChangeCallback currently have a negative priority, while // our native code is using a priority of zero. SystemProperties.addChangeCallback(new Runnable() { @Override public void run() { SystemProperties.addChangeCallback(() -> { cacheEnabledTags(); if ((sZygoteDebugFlags & Zygote.DEBUG_JAVA_DEBUGGABLE) != 0) { traceCounter(TRACE_TAG_ALWAYS, "java_debuggable", 1); } }); } Loading Loading @@ -201,8 +206,9 @@ public final class Trace { * * @hide */ public static void setTracingEnabled(boolean enabled) { public static void setTracingEnabled(boolean enabled, int debugFlags) { nativeSetTracingEnabled(enabled); sZygoteDebugFlags = debugFlags; // Setting whether tracing is enabled may change the tags, so we update the cached tags // here. Loading core/java/com/android/internal/os/Zygote.java +2 −2 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ public final class Zygote { fdsToIgnore, instructionSet, appDataDir); // Enable tracing as soon as possible for the child process. if (pid == 0) { Trace.setTracingEnabled(true); Trace.setTracingEnabled(true, debugFlags); // Note that this event ends at the end of handleChildProc, Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); Loading Loading @@ -152,7 +152,7 @@ public final class Zygote { uid, gid, gids, debugFlags, rlimits, permittedCapabilities, effectiveCapabilities); // Enable tracing as soon as we enter the system_server. if (pid == 0) { Trace.setTracingEnabled(true); Trace.setTracingEnabled(true, debugFlags); } VM_HOOKS.postForkCommon(); return pid; Loading core/java/com/android/internal/os/ZygoteInit.java +1 −1 Original line number Diff line number Diff line Loading @@ -745,7 +745,7 @@ public class ZygoteInit { bootTimingsTraceLog.traceEnd(); // ZygoteInit // Disable tracing so that forked processes do not inherit stale tracing tags from // Zygote. Trace.setTracingEnabled(false); Trace.setTracingEnabled(false, 0); // Zygote process unmounts root storage spaces. Zygote.nativeUnmountStorageOnInit(); Loading Loading
core/java/android/os/Trace.java +10 −4 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.os; import com.android.internal.os.Zygote; import dalvik.annotation.optimization.FastNative; /** Loading Loading @@ -94,6 +96,8 @@ public final class Trace { // Must be volatile to avoid word tearing. private static volatile long sEnabledTags = TRACE_TAG_NOT_READY; private static int sZygoteDebugFlags = 0; private static native long nativeGetEnabledTags(); private static native void nativeSetAppTracingAllowed(boolean allowed); private static native void nativeSetTracingEnabled(boolean allowed); Loading @@ -118,9 +122,10 @@ public final class Trace { // The system provides ordering through a priority level. Callbacks made through // SystemProperties.addChangeCallback currently have a negative priority, while // our native code is using a priority of zero. SystemProperties.addChangeCallback(new Runnable() { @Override public void run() { SystemProperties.addChangeCallback(() -> { cacheEnabledTags(); if ((sZygoteDebugFlags & Zygote.DEBUG_JAVA_DEBUGGABLE) != 0) { traceCounter(TRACE_TAG_ALWAYS, "java_debuggable", 1); } }); } Loading Loading @@ -201,8 +206,9 @@ public final class Trace { * * @hide */ public static void setTracingEnabled(boolean enabled) { public static void setTracingEnabled(boolean enabled, int debugFlags) { nativeSetTracingEnabled(enabled); sZygoteDebugFlags = debugFlags; // Setting whether tracing is enabled may change the tags, so we update the cached tags // here. Loading
core/java/com/android/internal/os/Zygote.java +2 −2 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ public final class Zygote { fdsToIgnore, instructionSet, appDataDir); // Enable tracing as soon as possible for the child process. if (pid == 0) { Trace.setTracingEnabled(true); Trace.setTracingEnabled(true, debugFlags); // Note that this event ends at the end of handleChildProc, Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork"); Loading Loading @@ -152,7 +152,7 @@ public final class Zygote { uid, gid, gids, debugFlags, rlimits, permittedCapabilities, effectiveCapabilities); // Enable tracing as soon as we enter the system_server. if (pid == 0) { Trace.setTracingEnabled(true); Trace.setTracingEnabled(true, debugFlags); } VM_HOOKS.postForkCommon(); return pid; Loading
core/java/com/android/internal/os/ZygoteInit.java +1 −1 Original line number Diff line number Diff line Loading @@ -745,7 +745,7 @@ public class ZygoteInit { bootTimingsTraceLog.traceEnd(); // ZygoteInit // Disable tracing so that forked processes do not inherit stale tracing tags from // Zygote. Trace.setTracingEnabled(false); Trace.setTracingEnabled(false, 0); // Zygote process unmounts root storage spaces. Zygote.nativeUnmountStorageOnInit(); Loading