Merge "Disable StrictMode policy when setting up profile support" into nyc-dev am: 096e2dc
am: 3a61c96
* commit '3a61c96d29b5fed0fbb4d234c46589c4763b0e11':
Disable StrictMode policy when setting up profile support
Change-Id: Ia35d5a8e5d4b86f1524c9dd69216123772ee761d
This commit is contained in:
@@ -412,6 +412,8 @@ public final class LoadedApk {
|
|||||||
|
|
||||||
private void createOrUpdateClassLoaderLocked(List<String> addedPaths) {
|
private void createOrUpdateClassLoaderLocked(List<String> addedPaths) {
|
||||||
if (mPackageName.equals("android")) {
|
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) {
|
if (mClassLoader != null) {
|
||||||
// nothing to update
|
// nothing to update
|
||||||
return;
|
return;
|
||||||
@@ -480,6 +482,7 @@ public final class LoadedApk {
|
|||||||
Slog.v(ActivityThread.TAG, "Class path: " + zip +
|
Slog.v(ActivityThread.TAG, "Class path: " + zip +
|
||||||
", JNI path: " + librarySearchPath);
|
", JNI path: " + librarySearchPath);
|
||||||
|
|
||||||
|
boolean needToSetupJitProfiles = false;
|
||||||
if (mClassLoader == null) {
|
if (mClassLoader == null) {
|
||||||
// Temporarily disable logging of disk reads on the Looper thread
|
// Temporarily disable logging of disk reads on the Looper thread
|
||||||
// as this is early and necessary.
|
// as this is early and necessary.
|
||||||
@@ -490,11 +493,15 @@ public final class LoadedApk {
|
|||||||
libraryPermittedPath, mBaseClassLoader);
|
libraryPermittedPath, mBaseClassLoader);
|
||||||
|
|
||||||
StrictMode.setThreadPolicy(oldPolicy);
|
StrictMode.setThreadPolicy(oldPolicy);
|
||||||
|
// Setup the class loader paths for profiling.
|
||||||
|
needToSetupJitProfiles = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addedPaths != null && addedPaths.size() > 0) {
|
if (addedPaths != null && addedPaths.size() > 0) {
|
||||||
final String add = TextUtils.join(File.pathSeparator, addedPaths);
|
final String add = TextUtils.join(File.pathSeparator, addedPaths);
|
||||||
ApplicationLoaders.getDefault().addPath(mClassLoader, add);
|
ApplicationLoaders.getDefault().addPath(mClassLoader, add);
|
||||||
|
// Setup the new code paths for profiling.
|
||||||
|
needToSetupJitProfiles = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup jit profile support.
|
// 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 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
|
// the same code path. There's no need to pass `addedPaths` since any new code paths
|
||||||
// are already in `mApplicationInfo`.
|
// 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() {
|
public ClassLoader getClassLoader() {
|
||||||
|
|||||||
Reference in New Issue
Block a user