diff options
| author | 2019-08-19 13:08:14 -0700 | |
|---|---|---|
| committer | 2019-09-09 16:25:35 +0000 | |
| commit | 77aca50b6fcb2b68dc4bfd2bd47355f76efe9692 (patch) | |
| tree | 75c43428cbdd832c947687fbd63ea4cd4d456fe6 | |
| parent | 036ea39d96babb6c8a20464319903aea130e1a5f (diff) | |
Add phenotype property for profiling system server
Added the property profilesystemserver in the RUNTIME_NATIVE_BOOT
namespace. This property is overrides the system one if it is
present.
Bug: 139883463
Test: set the property manually and verify that system server is started
Test: with profiling
(cherry picked from commit 7b31c74ddb844e2f0af79be6c87b9fd02a627987)
Merged-In: Ifd69530e52a717a381b3f91b15a74329614906f2
Change-Id: I00594949b845a75152c7ab3c94aa84a55b072776
| -rw-r--r-- | core/java/com/android/internal/os/ZygoteInit.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 2d7ce1a1c49c..432c130f316c 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -37,6 +37,7 @@ import android.os.Trace; import android.os.UserHandle; import android.os.ZygoteProcess; import android.os.storage.StorageManager; +import android.provider.DeviceConfig; import android.security.keystore.AndroidKeyStoreProvider; import android.system.ErrnoException; import android.system.Os; @@ -459,6 +460,16 @@ public class ZygoteInit { ZygoteHooks.gcAndFinalize(); } + private static boolean profileSystemServer() { + boolean defaultValue = SystemProperties.getBoolean("dalvik.vm.profilesystemserver", + /*default=*/ false); + // Can't use DeviceConfig since it's not initialized at this point. + return SystemProperties.getBoolean( + "persist.device_config." + DeviceConfig.NAMESPACE_RUNTIME_NATIVE_BOOT + + ".profilesystemserver", + defaultValue); + } + /** * Finish remaining work for the newly forked system server process. */ @@ -481,10 +492,9 @@ public class ZygoteInit { } // Capturing profiles is only supported for debug or eng builds since selinux normally // prevents it. - boolean profileSystemServer = SystemProperties.getBoolean( - "dalvik.vm.profilesystemserver", false); - if (profileSystemServer && (Build.IS_USERDEBUG || Build.IS_ENG)) { + if (profileSystemServer() && (Build.IS_USERDEBUG || Build.IS_ENG)) { try { + Log.d(TAG, "Preparing system server profile"); prepareSystemServerProfile(systemServerClasspath); } catch (Exception e) { Log.wtf(TAG, "Failed to set up system server profile", e); @@ -755,9 +765,8 @@ public class ZygoteInit { Zygote.applyDebuggerSystemProperty(parsedArgs); Zygote.applyInvokeWithSystemProperty(parsedArgs); - boolean profileSystemServer = SystemProperties.getBoolean( - "dalvik.vm.profilesystemserver", false); - if (profileSystemServer) { + if (profileSystemServer()) { + parsedArgs.mRuntimeFlags |= Zygote.PROFILE_SYSTEM_SERVER; } |