Loading core/java/android/app/ActivityThread.java +36 −2 Original line number Original line Diff line number Diff line Loading @@ -744,8 +744,42 @@ public final class ActivityThread { setCoreSettings(coreSettings); setCoreSettings(coreSettings); // Tell the VMRuntime about the application. /* VMRuntime.registerAppInfo(appInfo.dataDir, appInfo.processName); * Two possible indications that this package could be * sharing its runtime with other packages: * * 1.) the sharedUserId attribute is set in the manifest, * indicating a request to share a VM with other * packages with the same sharedUserId. * * 2.) the application element of the manifest has an * attribute specifying a non-default process name, * indicating the desire to run in another packages VM. * * If sharing is enabled we do not have a unique application * in a process and therefore cannot rely on the package * name inside the runtime. */ IPackageManager pm = getPackageManager(); android.content.pm.PackageInfo pi = null; try { pi = pm.getPackageInfo(appInfo.packageName, 0, UserHandle.myUserId()); } catch (RemoteException e) { } if (pi != null) { boolean sharedUserIdSet = (pi.sharedUserId != null); boolean processNameNotDefault = (pi.applicationInfo != null && !appInfo.packageName.equals(pi.applicationInfo.processName)); boolean sharable = (sharedUserIdSet || processNameNotDefault); // Tell the VMRuntime about the application, unless it is shared // inside a process. if (!sharable) { VMRuntime.registerAppInfo(appInfo.packageName, appInfo.dataDir, appInfo.processName); } } AppBindData data = new AppBindData(); AppBindData data = new AppBindData(); data.processName = processName; data.processName = processName; Loading core/jni/AndroidRuntime.cpp +43 −0 Original line number Original line Diff line number Diff line Loading @@ -780,6 +780,49 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) mOptions.add(opt); mOptions.add(opt); } } /* * Set profiler options */ { char period[sizeof("-Xprofile-period:") + PROPERTY_VALUE_MAX]; char duration[sizeof("-Xprofile-duration:") + PROPERTY_VALUE_MAX]; char interval[sizeof("-Xprofile-interval:") + PROPERTY_VALUE_MAX]; char backoff[sizeof("-Xprofile-backoff:") + PROPERTY_VALUE_MAX]; // Number of seconds during profile runs. strcpy(period, "-Xprofile-period:"); property_get("dalvik.vm.profile.period_secs", period+17, "10"); opt.optionString = period; mOptions.add(opt); // Length of each profile run (seconds). strcpy(duration, "-Xprofile-duration:"); property_get("dalvik.vm.profile.duration_secs", duration+19, "30"); opt.optionString = duration; mOptions.add(opt); // Polling interval during profile run (microseconds). strcpy(interval, "-Xprofile-interval:"); property_get("dalvik.vm.profile.interval_us", interval+19, "10000"); opt.optionString = interval; mOptions.add(opt); // Coefficient for period backoff. The the period is multiplied // by this value after each profile run. strcpy(backoff, "-Xprofile-backoff:"); property_get("dalvik.vm.profile.backoff_coeff", backoff+18, "2.0"); opt.optionString = backoff; mOptions.add(opt); } /* * We don't have /tmp on the device, but we often have an SD card. Apps * shouldn't use this, but some test suites might want to exercise it. */ opt.optionString = "-Djava.io.tmpdir=/sdcard"; mOptions.add(opt); initArgs.version = JNI_VERSION_1_4; initArgs.version = JNI_VERSION_1_4; initArgs.options = mOptions.editArray(); initArgs.options = mOptions.editArray(); initArgs.nOptions = mOptions.size(); initArgs.nOptions = mOptions.size(); Loading services/java/com/android/server/pm/Installer.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -208,6 +208,19 @@ public final class Installer { builder.append(' '); builder.append(' '); builder.append(uid); builder.append(uid); builder.append(isPublic ? " 1" : " 0"); builder.append(isPublic ? " 1" : " 0"); builder.append(" *"); // No pkgName arg present return execute(builder.toString()); } public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName) { StringBuilder builder = new StringBuilder("dexopt"); builder.append(' '); builder.append(apkPath); builder.append(' '); builder.append(uid); builder.append(isPublic ? " 1" : " 0"); builder.append(' '); builder.append(pkgName); return execute(builder.toString()); return execute(builder.toString()); } } Loading services/java/com/android/server/pm/PackageManagerService.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -1209,7 +1209,7 @@ public class PackageManagerService extends IPackageManager.Stub { continue; continue; } } try { try { if (dalvik.system.DexFile.isDexOptNeeded(lib)) { if (dalvik.system.DexFile.isDexOptNeededInternal(lib, null, false)) { alreadyDexOpted.add(lib); alreadyDexOpted.add(lib); mInstaller.dexopt(lib, Process.SYSTEM_UID, true); mInstaller.dexopt(lib, Process.SYSTEM_UID, true); didDexOpt = true; didDexOpt = true; Loading Loading @@ -1253,7 +1253,7 @@ public class PackageManagerService extends IPackageManager.Stub { continue; continue; } } try { try { if (dalvik.system.DexFile.isDexOptNeeded(path)) { if (dalvik.system.DexFile.isDexOptNeededInternal(path, null, false)) { mInstaller.dexopt(path, Process.SYSTEM_UID, true); mInstaller.dexopt(path, Process.SYSTEM_UID, true); didDexOpt = true; didDexOpt = true; } } Loading Loading @@ -3988,7 +3988,8 @@ public class PackageManagerService extends IPackageManager.Stub { String path = pkg.mScanPath; String path = pkg.mScanPath; int ret = 0; int ret = 0; try { try { if (forceDex || dalvik.system.DexFile.isDexOptNeeded(path)) { if (forceDex || dalvik.system.DexFile.isDexOptNeededInternal(path, pkg.packageName, defer)) { if (!forceDex && defer) { if (!forceDex && defer) { if (mDeferredDexOpt == null) { if (mDeferredDexOpt == null) { mDeferredDexOpt = new HashSet<PackageParser.Package>(); mDeferredDexOpt = new HashSet<PackageParser.Package>(); Loading @@ -3998,7 +3999,8 @@ public class PackageManagerService extends IPackageManager.Stub { } else { } else { Log.i(TAG, "Running dexopt on: " + pkg.applicationInfo.packageName); Log.i(TAG, "Running dexopt on: " + pkg.applicationInfo.packageName); final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid); final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid); ret = mInstaller.dexopt(path, sharedGid, !isForwardLocked(pkg)); ret = mInstaller.dexopt(path, sharedGid, !isForwardLocked(pkg), pkg.packageName); pkg.mDidDexOpt = true; pkg.mDidDexOpt = true; performed = true; performed = true; } } Loading Loading
core/java/android/app/ActivityThread.java +36 −2 Original line number Original line Diff line number Diff line Loading @@ -744,8 +744,42 @@ public final class ActivityThread { setCoreSettings(coreSettings); setCoreSettings(coreSettings); // Tell the VMRuntime about the application. /* VMRuntime.registerAppInfo(appInfo.dataDir, appInfo.processName); * Two possible indications that this package could be * sharing its runtime with other packages: * * 1.) the sharedUserId attribute is set in the manifest, * indicating a request to share a VM with other * packages with the same sharedUserId. * * 2.) the application element of the manifest has an * attribute specifying a non-default process name, * indicating the desire to run in another packages VM. * * If sharing is enabled we do not have a unique application * in a process and therefore cannot rely on the package * name inside the runtime. */ IPackageManager pm = getPackageManager(); android.content.pm.PackageInfo pi = null; try { pi = pm.getPackageInfo(appInfo.packageName, 0, UserHandle.myUserId()); } catch (RemoteException e) { } if (pi != null) { boolean sharedUserIdSet = (pi.sharedUserId != null); boolean processNameNotDefault = (pi.applicationInfo != null && !appInfo.packageName.equals(pi.applicationInfo.processName)); boolean sharable = (sharedUserIdSet || processNameNotDefault); // Tell the VMRuntime about the application, unless it is shared // inside a process. if (!sharable) { VMRuntime.registerAppInfo(appInfo.packageName, appInfo.dataDir, appInfo.processName); } } AppBindData data = new AppBindData(); AppBindData data = new AppBindData(); data.processName = processName; data.processName = processName; Loading
core/jni/AndroidRuntime.cpp +43 −0 Original line number Original line Diff line number Diff line Loading @@ -780,6 +780,49 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) mOptions.add(opt); mOptions.add(opt); } } /* * Set profiler options */ { char period[sizeof("-Xprofile-period:") + PROPERTY_VALUE_MAX]; char duration[sizeof("-Xprofile-duration:") + PROPERTY_VALUE_MAX]; char interval[sizeof("-Xprofile-interval:") + PROPERTY_VALUE_MAX]; char backoff[sizeof("-Xprofile-backoff:") + PROPERTY_VALUE_MAX]; // Number of seconds during profile runs. strcpy(period, "-Xprofile-period:"); property_get("dalvik.vm.profile.period_secs", period+17, "10"); opt.optionString = period; mOptions.add(opt); // Length of each profile run (seconds). strcpy(duration, "-Xprofile-duration:"); property_get("dalvik.vm.profile.duration_secs", duration+19, "30"); opt.optionString = duration; mOptions.add(opt); // Polling interval during profile run (microseconds). strcpy(interval, "-Xprofile-interval:"); property_get("dalvik.vm.profile.interval_us", interval+19, "10000"); opt.optionString = interval; mOptions.add(opt); // Coefficient for period backoff. The the period is multiplied // by this value after each profile run. strcpy(backoff, "-Xprofile-backoff:"); property_get("dalvik.vm.profile.backoff_coeff", backoff+18, "2.0"); opt.optionString = backoff; mOptions.add(opt); } /* * We don't have /tmp on the device, but we often have an SD card. Apps * shouldn't use this, but some test suites might want to exercise it. */ opt.optionString = "-Djava.io.tmpdir=/sdcard"; mOptions.add(opt); initArgs.version = JNI_VERSION_1_4; initArgs.version = JNI_VERSION_1_4; initArgs.options = mOptions.editArray(); initArgs.options = mOptions.editArray(); initArgs.nOptions = mOptions.size(); initArgs.nOptions = mOptions.size(); Loading
services/java/com/android/server/pm/Installer.java +13 −0 Original line number Original line Diff line number Diff line Loading @@ -208,6 +208,19 @@ public final class Installer { builder.append(' '); builder.append(' '); builder.append(uid); builder.append(uid); builder.append(isPublic ? " 1" : " 0"); builder.append(isPublic ? " 1" : " 0"); builder.append(" *"); // No pkgName arg present return execute(builder.toString()); } public int dexopt(String apkPath, int uid, boolean isPublic, String pkgName) { StringBuilder builder = new StringBuilder("dexopt"); builder.append(' '); builder.append(apkPath); builder.append(' '); builder.append(uid); builder.append(isPublic ? " 1" : " 0"); builder.append(' '); builder.append(pkgName); return execute(builder.toString()); return execute(builder.toString()); } } Loading
services/java/com/android/server/pm/PackageManagerService.java +6 −4 Original line number Original line Diff line number Diff line Loading @@ -1209,7 +1209,7 @@ public class PackageManagerService extends IPackageManager.Stub { continue; continue; } } try { try { if (dalvik.system.DexFile.isDexOptNeeded(lib)) { if (dalvik.system.DexFile.isDexOptNeededInternal(lib, null, false)) { alreadyDexOpted.add(lib); alreadyDexOpted.add(lib); mInstaller.dexopt(lib, Process.SYSTEM_UID, true); mInstaller.dexopt(lib, Process.SYSTEM_UID, true); didDexOpt = true; didDexOpt = true; Loading Loading @@ -1253,7 +1253,7 @@ public class PackageManagerService extends IPackageManager.Stub { continue; continue; } } try { try { if (dalvik.system.DexFile.isDexOptNeeded(path)) { if (dalvik.system.DexFile.isDexOptNeededInternal(path, null, false)) { mInstaller.dexopt(path, Process.SYSTEM_UID, true); mInstaller.dexopt(path, Process.SYSTEM_UID, true); didDexOpt = true; didDexOpt = true; } } Loading Loading @@ -3988,7 +3988,8 @@ public class PackageManagerService extends IPackageManager.Stub { String path = pkg.mScanPath; String path = pkg.mScanPath; int ret = 0; int ret = 0; try { try { if (forceDex || dalvik.system.DexFile.isDexOptNeeded(path)) { if (forceDex || dalvik.system.DexFile.isDexOptNeededInternal(path, pkg.packageName, defer)) { if (!forceDex && defer) { if (!forceDex && defer) { if (mDeferredDexOpt == null) { if (mDeferredDexOpt == null) { mDeferredDexOpt = new HashSet<PackageParser.Package>(); mDeferredDexOpt = new HashSet<PackageParser.Package>(); Loading @@ -3998,7 +3999,8 @@ public class PackageManagerService extends IPackageManager.Stub { } else { } else { Log.i(TAG, "Running dexopt on: " + pkg.applicationInfo.packageName); Log.i(TAG, "Running dexopt on: " + pkg.applicationInfo.packageName); final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid); final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid); ret = mInstaller.dexopt(path, sharedGid, !isForwardLocked(pkg)); ret = mInstaller.dexopt(path, sharedGid, !isForwardLocked(pkg), pkg.packageName); pkg.mDidDexOpt = true; pkg.mDidDexOpt = true; performed = true; performed = true; } } Loading