From bf07e2a1da19cb020092ab00386febc2b180f130 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Wed, 15 Mar 2017 11:37:32 +0000 Subject: [PATCH] LoadedApk: Notify cross-package use only when code is requested. Cross-package use is quite common when only resources are being considered. A common example is that any application that declares itself will see cross package resource only use from the system_server. Test: manual instrumentation. Change-Id: Ic7ad166c71a23c6026f4e12bb52309a50210aaaf --- core/java/android/app/LoadedApk.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java index be38f42490e55..77c4c7eea8113 100644 --- a/core/java/android/app/LoadedApk.java +++ b/core/java/android/app/LoadedApk.java @@ -597,8 +597,7 @@ public final class LoadedApk { // Avoid the binder call when the package is the current application package. // The activity manager will perform ensure that dexopt is performed before // spinning up the process. - if (!Objects.equals(mPackageName, ActivityThread.currentPackageName())) { - VMRuntime.getRuntime().vmInstructionSet(); + if (!Objects.equals(mPackageName, ActivityThread.currentPackageName()) && mIncludeCode) { try { ActivityThread.getPackageManager().notifyPackageUse(mPackageName, PackageManager.NOTIFY_PACKAGE_USE_CROSS_PACKAGE);