diff options
| author | 2016-04-25 15:54:36 +0000 | |
|---|---|---|
| committer | 2016-04-25 15:54:37 +0000 | |
| commit | 096e2dcf855714577bb86eaa4869ff46b5980a07 (patch) | |
| tree | 5e80a3b76bb8c54a55a78f356edbf6ef1c7cfc21 | |
| parent | 4316b8a09d591b64f5cb944417573fef47fc453c (diff) | |
| parent | 430ef455d626eb0f9d845ef6a283056da4883503 (diff) | |
Merge "Disable StrictMode policy when setting up profile support" into nyc-dev
| -rw-r--r-- | core/java/android/app/LoadedApk.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index 0cfa00916326..fb70c71c2c3b 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -412,6 +412,8 @@ public final class LoadedApk { private void createOrUpdateClassLoaderLocked(List<String> addedPaths) { if (mPackageName.equals("android")) { + // Note: This branch is taken for system server and we don't need to setup + // jit profiling support. if (mClassLoader != null) { // nothing to update return; @@ -480,6 +482,7 @@ public final class LoadedApk { Slog.v(ActivityThread.TAG, "Class path: " + zip + ", JNI path: " + librarySearchPath); + boolean needToSetupJitProfiles = false; if (mClassLoader == null) { // Temporarily disable logging of disk reads on the Looper thread // as this is early and necessary. @@ -490,11 +493,15 @@ public final class LoadedApk { libraryPermittedPath, mBaseClassLoader); StrictMode.setThreadPolicy(oldPolicy); + // Setup the class loader paths for profiling. + needToSetupJitProfiles = true; } if (addedPaths != null && addedPaths.size() > 0) { final String add = TextUtils.join(File.pathSeparator, addedPaths); ApplicationLoaders.getDefault().addPath(mClassLoader, add); + // Setup the new code paths for profiling. + needToSetupJitProfiles = true; } // Setup jit profile support. @@ -502,7 +509,14 @@ public final class LoadedApk { // 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`. - setupJitProfileSupport(); + if (needToSetupJitProfiles) { + // 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. + StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites(); + setupJitProfileSupport(); + StrictMode.setThreadPolicy(oldPolicy); + } } public ClassLoader getClassLoader() { |