From 2d4a222de157c693b16ca2b35a264dd92ae6abee Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Mon, 25 Apr 2016 19:16:56 +0100 Subject: [PATCH] LoadedApk: Don't set up JIT profile support inside the system_server. We shouldn't profile *any* packages loaded by the system_server, not just the system_servers own ("android") package. bug: 28241500 Change-Id: I5f3f477b40c758030a5bdc8e97d17cab6e68e204 --- core/java/android/app/LoadedApk.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index 2be55317c7805..3050ac8a5a15d 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -510,11 +510,15 @@ public final class LoadedApk { } // Setup jit profile support. + // // It is ok to call this multiple times if the application gets updated with new splits. // The runtime only keeps track of unique code paths and can handle re-registration of // the same code path. There's no need to pass `addedPaths` since any new code paths // are already in `mApplicationInfo`. - if (needToSetupJitProfiles) { + // + // It is NOT ok to call this function from the system_server (for any of the packages it + // loads code from) so we explicitly disallow it there. + if (needToSetupJitProfiles && !ActivityThread.isSystem()) { // Temporarily disable logging of disk reads/writes on the Looper thread // as this is early and necessary. Write is only needed to create the // profile file if it's not already there.