Merge changes I80504f43,Ifc372eef am: de7be840a7
am: 991da81069
Change-Id: I7adfdd87dc63d5ab3a34e152cf1066f4498036e8
This commit is contained in:
@@ -128,6 +128,10 @@ public class PackageDexOptimizer {
|
|||||||
int performDexOpt(PackageParser.Package pkg, String[] sharedLibraries,
|
int performDexOpt(PackageParser.Package pkg, String[] sharedLibraries,
|
||||||
String[] instructionSets, CompilerStats.PackageStats packageStats,
|
String[] instructionSets, CompilerStats.PackageStats packageStats,
|
||||||
PackageDexUsage.PackageUseInfo packageUseInfo, DexoptOptions options) {
|
PackageDexUsage.PackageUseInfo packageUseInfo, DexoptOptions options) {
|
||||||
|
if (pkg.applicationInfo.uid == -1) {
|
||||||
|
throw new IllegalArgumentException("Dexopt for " + pkg.packageName
|
||||||
|
+ " has invalid uid.");
|
||||||
|
}
|
||||||
if (!canOptimizePackage(pkg)) {
|
if (!canOptimizePackage(pkg)) {
|
||||||
return DEX_OPT_SKIPPED;
|
return DEX_OPT_SKIPPED;
|
||||||
}
|
}
|
||||||
@@ -299,6 +303,9 @@ public class PackageDexOptimizer {
|
|||||||
*/
|
*/
|
||||||
public int dexOptSecondaryDexPath(ApplicationInfo info, String path,
|
public int dexOptSecondaryDexPath(ApplicationInfo info, String path,
|
||||||
PackageDexUsage.DexUseInfo dexUseInfo, DexoptOptions options) {
|
PackageDexUsage.DexUseInfo dexUseInfo, DexoptOptions options) {
|
||||||
|
if (info.uid == -1) {
|
||||||
|
throw new IllegalArgumentException("Dexopt for path " + path + " has invalid uid.");
|
||||||
|
}
|
||||||
synchronized (mInstallLock) {
|
synchronized (mInstallLock) {
|
||||||
final long acquireTime = acquireWakeLockLI(info.uid);
|
final long acquireTime = acquireWakeLockLI(info.uid);
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -18788,10 +18788,45 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify if we need to dexopt the app.
|
if (!instantApp) {
|
||||||
|
startIntentFilterVerifications(args.user.getIdentifier(), replace, pkg);
|
||||||
|
} else {
|
||||||
|
if (DEBUG_DOMAIN_VERIFICATION) {
|
||||||
|
Slog.d(TAG, "Not verifying instant app install for app links: " + pkgName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try (PackageFreezer freezer = freezePackageForInstall(pkgName, installFlags,
|
||||||
|
"installPackageLI")) {
|
||||||
|
if (replace) {
|
||||||
|
if (pkg.applicationInfo.isStaticSharedLibrary()) {
|
||||||
|
// Static libs have a synthetic package name containing the version
|
||||||
|
// and cannot be updated as an update would get a new package name,
|
||||||
|
// unless this is the exact same version code which is useful for
|
||||||
|
// development.
|
||||||
|
PackageParser.Package existingPkg = mPackages.get(pkg.packageName);
|
||||||
|
if (existingPkg != null && existingPkg.mVersionCode != pkg.mVersionCode) {
|
||||||
|
res.setError(INSTALL_FAILED_DUPLICATE_PACKAGE, "Packages declaring "
|
||||||
|
+ "static-shared libs cannot be updated");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
replacePackageLIF(pkg, parseFlags, scanFlags | SCAN_REPLACING, args.user,
|
||||||
|
installerPackageName, res, args.installReason);
|
||||||
|
} else {
|
||||||
|
installNewPackageLIF(pkg, parseFlags, scanFlags | SCAN_DELETE_DATA_ON_FAILURES,
|
||||||
|
args.user, installerPackageName, volumeUuid, res, args.installReason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check whether we need to dexopt the app.
|
||||||
//
|
//
|
||||||
// NOTE: it is *important* to call dexopt after doRename which will sync the
|
// NOTE: it is IMPORTANT to call dexopt:
|
||||||
// package data from PackageParser.Package and its corresponding ApplicationInfo.
|
// - after doRename which will sync the package data from PackageParser.Package and its
|
||||||
|
// corresponding ApplicationInfo.
|
||||||
|
// - after installNewPackageLIF or replacePackageLIF which will update result with the
|
||||||
|
// uid of the application (pkg.applicationInfo.uid).
|
||||||
|
// This update happens in place!
|
||||||
//
|
//
|
||||||
// We only need to dexopt if the package meets ALL of the following conditions:
|
// We only need to dexopt if the package meets ALL of the following conditions:
|
||||||
// 1) it is not forward locked.
|
// 1) it is not forward locked.
|
||||||
@@ -18804,7 +18839,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
// continuous progress to the useur instead of mysteriously blocking somewhere in the
|
// continuous progress to the useur instead of mysteriously blocking somewhere in the
|
||||||
// middle of running an instant app. The default behaviour can be overridden
|
// middle of running an instant app. The default behaviour can be overridden
|
||||||
// via gservices.
|
// via gservices.
|
||||||
final boolean performDexopt = !forwardLocked
|
final boolean performDexopt = (res.returnCode == PackageManager.INSTALL_SUCCEEDED)
|
||||||
|
&& !forwardLocked
|
||||||
&& !pkg.applicationInfo.isExternalAsec()
|
&& !pkg.applicationInfo.isExternalAsec()
|
||||||
&& (!instantApp || Global.getInt(mContext.getContentResolver(),
|
&& (!instantApp || Global.getInt(mContext.getContentResolver(),
|
||||||
Global.INSTANT_APP_DEXOPT_ENABLED, 0) != 0);
|
Global.INSTANT_APP_DEXOPT_ENABLED, 0) != 0);
|
||||||
@@ -18832,31 +18868,6 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
// TODO: Layering violation
|
// TODO: Layering violation
|
||||||
BackgroundDexOptService.notifyPackageChanged(pkg.packageName);
|
BackgroundDexOptService.notifyPackageChanged(pkg.packageName);
|
||||||
|
|
||||||
startIntentFilterVerifications(args.user.getIdentifier(), replace, pkg);
|
|
||||||
|
|
||||||
try (PackageFreezer freezer = freezePackageForInstall(pkgName, installFlags,
|
|
||||||
"installPackageLI")) {
|
|
||||||
if (replace) {
|
|
||||||
if (pkg.applicationInfo.isStaticSharedLibrary()) {
|
|
||||||
// Static libs have a synthetic package name containing the version
|
|
||||||
// and cannot be updated as an update would get a new package name,
|
|
||||||
// unless this is the exact same version code which is useful for
|
|
||||||
// development.
|
|
||||||
PackageParser.Package existingPkg = mPackages.get(pkg.packageName);
|
|
||||||
if (existingPkg != null && existingPkg.mVersionCode != pkg.mVersionCode) {
|
|
||||||
res.setError(INSTALL_FAILED_DUPLICATE_PACKAGE, "Packages declaring "
|
|
||||||
+ "static-shared libs cannot be updated");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
replacePackageLIF(pkg, parseFlags, scanFlags | SCAN_REPLACING, args.user,
|
|
||||||
installerPackageName, res, args.installReason);
|
|
||||||
} else {
|
|
||||||
installNewPackageLIF(pkg, parseFlags, scanFlags | SCAN_DELETE_DATA_ON_FAILURES,
|
|
||||||
args.user, installerPackageName, volumeUuid, res, args.installReason);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
synchronized (mPackages) {
|
synchronized (mPackages) {
|
||||||
final PackageSetting ps = mSettings.mPackages.get(pkgName);
|
final PackageSetting ps = mSettings.mPackages.get(pkgName);
|
||||||
if (ps != null) {
|
if (ps != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user