Loading services/core/java/com/android/server/pm/AppDataHelper.java +17 −18 Original line number Diff line number Diff line Loading @@ -520,14 +520,13 @@ final class AppDataHelper { int count = 0; final Installer.Batch batch = new Installer.Batch(); for (String pkgName : deferPackages) { AndroidPackage pkg = null; synchronized (mPm.mLock) { PackageSetting ps = mPm.mSettings.getPackageLPr(pkgName); if (ps != null && ps.getInstalled(UserHandle.USER_SYSTEM)) { pkg = ps.getPkg(); } } if (pkg != null) { final Computer snapshot = mPm.snapshotComputer(); final PackageStateInternal packageStateInternal = snapshot.getPackageStateInternal( pkgName); if (packageStateInternal != null && packageStateInternal.getUserStateOrDefault( UserHandle.USER_SYSTEM).isInstalled()) { AndroidPackage pkg = packageStateInternal.getPkg(); prepareAppDataAndMigrate(batch, pkg, UserHandle.USER_SYSTEM, storageFlags, true /* maybeMigrateAppData */); count++; Loading @@ -554,12 +553,12 @@ final class AppDataHelper { } private void clearAppDataLeafLIF(AndroidPackage pkg, int userId, int flags) { final PackageSetting ps; synchronized (mPm.mLock) { ps = mPm.mSettings.getPackageLPr(pkg.getPackageName()); } final Computer snapshot = mPm.snapshotComputer(); final PackageStateInternal packageStateInternal = snapshot.getPackageStateInternal(pkg.getPackageName()); for (int realUserId : mPm.resolveUserIds(userId)) { final long ceDataInode = (ps != null) ? ps.getCeDataInode(realUserId) : 0; final long ceDataInode = (packageStateInternal != null) ? packageStateInternal.getUserStateOrDefault(realUserId).getCeDataInode() : 0; try { mInstaller.clearAppData(pkg.getVolumeUuid(), pkg.getPackageName(), realUserId, flags, ceDataInode); Loading @@ -586,12 +585,12 @@ final class AppDataHelper { } public void destroyAppDataLeafLIF(AndroidPackage pkg, int userId, int flags) { final PackageSetting ps; synchronized (mPm.mLock) { ps = mPm.mSettings.getPackageLPr(pkg.getPackageName()); } final Computer snapshot = mPm.snapshotComputer(); final PackageStateInternal packageStateInternal = snapshot.getPackageStateInternal(pkg.getPackageName()); for (int realUserId : mPm.resolveUserIds(userId)) { final long ceDataInode = (ps != null) ? ps.getCeDataInode(realUserId) : 0; final long ceDataInode = (packageStateInternal != null) ? packageStateInternal.getUserStateOrDefault(realUserId).getCeDataInode() : 0; try { mInstaller.destroyAppData(pkg.getVolumeUuid(), pkg.getPackageName(), realUserId, flags, ceDataInode); Loading services/core/java/com/android/server/pm/DexOptHelper.java +6 −8 Original line number Diff line number Diff line Loading @@ -469,15 +469,13 @@ final class DexOptHelper { options.getSplitName(), options.getFlags() | DexoptOptions.DEXOPT_AS_SHARED_LIBRARY); for (SharedLibraryInfo info : deps) { AndroidPackage depPackage = null; PackageSetting depPackageSetting = null; synchronized (mPm.mLock) { depPackage = mPm.mPackages.get(info.getPackageName()); depPackageSetting = mPm.mSettings.getPackageLPr(info.getPackageName()); } if (depPackage != null && depPackageSetting != null) { Computer snapshot = mPm.snapshotComputer(); AndroidPackage depPackage = snapshot.getPackage(info.getPackageName()); PackageStateInternal depPackageStateInternal = snapshot.getPackageStateInternal(info.getPackageName()); if (depPackage != null && depPackageStateInternal != null) { // TODO: Analyze and investigate if we (should) profile libraries. pdo.performDexOpt(depPackage, depPackageSetting, instructionSets, pdo.performDexOpt(depPackage, depPackageStateInternal, instructionSets, mPm.getOrCreateCompilerPackageStats(depPackage), mPm.getDexManager().getPackageUseInfoOrDefault( depPackage.getPackageName()), libraryOptions); Loading services/core/java/com/android/server/pm/InstallParams.java +7 −9 Original line number Diff line number Diff line Loading @@ -158,16 +158,14 @@ final class InstallParams extends HandlerParams { return InstallLocationUtils.getInstallationErrorCode(recommendedInstallLocation); } // Override with defaults if needed. synchronized (mPm.mLock) { // reader AndroidPackage installedPkg = mPm.mPackages.get(packageName); Computer snapshot = mPm.snapshotComputer(); AndroidPackage installedPkg = snapshot.getPackage(packageName); if (installedPkg != null) { // Currently installed package which the new package is attempting to replace recommendedInstallLocation = InstallLocationUtils.installLocationPolicy( installLocation, recommendedInstallLocation, mInstallFlags, installedPkg.isSystem(), installedPkg.isExternalStorage()); } } final boolean onInt = (mInstallFlags & PackageManager.INSTALL_INTERNAL) != 0; Loading services/core/java/com/android/server/pm/MovePackageHelper.java +15 −17 Original line number Diff line number Diff line Loading @@ -303,10 +303,8 @@ public final class MovePackageHelper { * @param packageName The package that was moved. */ private void logAppMovedStorage(String packageName, boolean isPreviousLocationExternal) { final AndroidPackage pkg; synchronized (mPm.mLock) { pkg = mPm.mPackages.get(packageName); } final Computer snapshot = mPm.snapshotComputer(); final AndroidPackage pkg = snapshot.getPackage(packageName); if (pkg == null) { return; } Loading Loading @@ -334,26 +332,26 @@ public final class MovePackageHelper { @GuardedBy("mPm.mInstallLock") private boolean getPackageSizeInfoLI(String packageName, int userId, PackageStats stats) { final PackageSetting ps; synchronized (mPm.mLock) { ps = mPm.mSettings.getPackageLPr(packageName); if (ps == null) { final Computer snapshot = mPm.snapshotComputer(); final PackageStateInternal packageStateInternal = snapshot.getPackageStateInternal(packageName); if (packageStateInternal == null) { Slog.w(TAG, "Failed to find settings for " + packageName); return false; } } final String[] packageNames = { packageName }; final long[] ceDataInodes = { ps.getCeDataInode(userId) }; final String[] codePaths = { ps.getPathString() }; final long[] ceDataInodes = { packageStateInternal.getUserStateOrDefault(userId).getCeDataInode() }; final String[] codePaths = { packageStateInternal.getPathString() }; try { mPm.mInstaller.getAppSize(ps.getVolumeUuid(), packageNames, userId, 0, ps.getAppId(), ceDataInodes, codePaths, stats); mPm.mInstaller.getAppSize(packageStateInternal.getVolumeUuid(), packageNames, userId, 0, packageStateInternal.getAppId(), ceDataInodes, codePaths, stats); // For now, ignore code size of packages on system partition if (PackageManagerServiceUtils.isSystemApp(ps) && !PackageManagerServiceUtils.isUpdatedSystemApp(ps)) { if (PackageManagerServiceUtils.isSystemApp(packageStateInternal) && !PackageManagerServiceUtils.isUpdatedSystemApp(packageStateInternal)) { stats.codeSize = 0; } Loading services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +2 −2 Original line number Diff line number Diff line Loading @@ -1076,11 +1076,11 @@ public class PackageManagerServiceUtils { return null; } public static boolean isSystemApp(PackageSetting ps) { public static boolean isSystemApp(PackageStateInternal ps) { return (ps.getFlags() & ApplicationInfo.FLAG_SYSTEM) != 0; } public static boolean isUpdatedSystemApp(PackageSetting ps) { public static boolean isUpdatedSystemApp(PackageStateInternal ps) { return (ps.getFlags() & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0; } Loading Loading
services/core/java/com/android/server/pm/AppDataHelper.java +17 −18 Original line number Diff line number Diff line Loading @@ -520,14 +520,13 @@ final class AppDataHelper { int count = 0; final Installer.Batch batch = new Installer.Batch(); for (String pkgName : deferPackages) { AndroidPackage pkg = null; synchronized (mPm.mLock) { PackageSetting ps = mPm.mSettings.getPackageLPr(pkgName); if (ps != null && ps.getInstalled(UserHandle.USER_SYSTEM)) { pkg = ps.getPkg(); } } if (pkg != null) { final Computer snapshot = mPm.snapshotComputer(); final PackageStateInternal packageStateInternal = snapshot.getPackageStateInternal( pkgName); if (packageStateInternal != null && packageStateInternal.getUserStateOrDefault( UserHandle.USER_SYSTEM).isInstalled()) { AndroidPackage pkg = packageStateInternal.getPkg(); prepareAppDataAndMigrate(batch, pkg, UserHandle.USER_SYSTEM, storageFlags, true /* maybeMigrateAppData */); count++; Loading @@ -554,12 +553,12 @@ final class AppDataHelper { } private void clearAppDataLeafLIF(AndroidPackage pkg, int userId, int flags) { final PackageSetting ps; synchronized (mPm.mLock) { ps = mPm.mSettings.getPackageLPr(pkg.getPackageName()); } final Computer snapshot = mPm.snapshotComputer(); final PackageStateInternal packageStateInternal = snapshot.getPackageStateInternal(pkg.getPackageName()); for (int realUserId : mPm.resolveUserIds(userId)) { final long ceDataInode = (ps != null) ? ps.getCeDataInode(realUserId) : 0; final long ceDataInode = (packageStateInternal != null) ? packageStateInternal.getUserStateOrDefault(realUserId).getCeDataInode() : 0; try { mInstaller.clearAppData(pkg.getVolumeUuid(), pkg.getPackageName(), realUserId, flags, ceDataInode); Loading @@ -586,12 +585,12 @@ final class AppDataHelper { } public void destroyAppDataLeafLIF(AndroidPackage pkg, int userId, int flags) { final PackageSetting ps; synchronized (mPm.mLock) { ps = mPm.mSettings.getPackageLPr(pkg.getPackageName()); } final Computer snapshot = mPm.snapshotComputer(); final PackageStateInternal packageStateInternal = snapshot.getPackageStateInternal(pkg.getPackageName()); for (int realUserId : mPm.resolveUserIds(userId)) { final long ceDataInode = (ps != null) ? ps.getCeDataInode(realUserId) : 0; final long ceDataInode = (packageStateInternal != null) ? packageStateInternal.getUserStateOrDefault(realUserId).getCeDataInode() : 0; try { mInstaller.destroyAppData(pkg.getVolumeUuid(), pkg.getPackageName(), realUserId, flags, ceDataInode); Loading
services/core/java/com/android/server/pm/DexOptHelper.java +6 −8 Original line number Diff line number Diff line Loading @@ -469,15 +469,13 @@ final class DexOptHelper { options.getSplitName(), options.getFlags() | DexoptOptions.DEXOPT_AS_SHARED_LIBRARY); for (SharedLibraryInfo info : deps) { AndroidPackage depPackage = null; PackageSetting depPackageSetting = null; synchronized (mPm.mLock) { depPackage = mPm.mPackages.get(info.getPackageName()); depPackageSetting = mPm.mSettings.getPackageLPr(info.getPackageName()); } if (depPackage != null && depPackageSetting != null) { Computer snapshot = mPm.snapshotComputer(); AndroidPackage depPackage = snapshot.getPackage(info.getPackageName()); PackageStateInternal depPackageStateInternal = snapshot.getPackageStateInternal(info.getPackageName()); if (depPackage != null && depPackageStateInternal != null) { // TODO: Analyze and investigate if we (should) profile libraries. pdo.performDexOpt(depPackage, depPackageSetting, instructionSets, pdo.performDexOpt(depPackage, depPackageStateInternal, instructionSets, mPm.getOrCreateCompilerPackageStats(depPackage), mPm.getDexManager().getPackageUseInfoOrDefault( depPackage.getPackageName()), libraryOptions); Loading
services/core/java/com/android/server/pm/InstallParams.java +7 −9 Original line number Diff line number Diff line Loading @@ -158,16 +158,14 @@ final class InstallParams extends HandlerParams { return InstallLocationUtils.getInstallationErrorCode(recommendedInstallLocation); } // Override with defaults if needed. synchronized (mPm.mLock) { // reader AndroidPackage installedPkg = mPm.mPackages.get(packageName); Computer snapshot = mPm.snapshotComputer(); AndroidPackage installedPkg = snapshot.getPackage(packageName); if (installedPkg != null) { // Currently installed package which the new package is attempting to replace recommendedInstallLocation = InstallLocationUtils.installLocationPolicy( installLocation, recommendedInstallLocation, mInstallFlags, installedPkg.isSystem(), installedPkg.isExternalStorage()); } } final boolean onInt = (mInstallFlags & PackageManager.INSTALL_INTERNAL) != 0; Loading
services/core/java/com/android/server/pm/MovePackageHelper.java +15 −17 Original line number Diff line number Diff line Loading @@ -303,10 +303,8 @@ public final class MovePackageHelper { * @param packageName The package that was moved. */ private void logAppMovedStorage(String packageName, boolean isPreviousLocationExternal) { final AndroidPackage pkg; synchronized (mPm.mLock) { pkg = mPm.mPackages.get(packageName); } final Computer snapshot = mPm.snapshotComputer(); final AndroidPackage pkg = snapshot.getPackage(packageName); if (pkg == null) { return; } Loading Loading @@ -334,26 +332,26 @@ public final class MovePackageHelper { @GuardedBy("mPm.mInstallLock") private boolean getPackageSizeInfoLI(String packageName, int userId, PackageStats stats) { final PackageSetting ps; synchronized (mPm.mLock) { ps = mPm.mSettings.getPackageLPr(packageName); if (ps == null) { final Computer snapshot = mPm.snapshotComputer(); final PackageStateInternal packageStateInternal = snapshot.getPackageStateInternal(packageName); if (packageStateInternal == null) { Slog.w(TAG, "Failed to find settings for " + packageName); return false; } } final String[] packageNames = { packageName }; final long[] ceDataInodes = { ps.getCeDataInode(userId) }; final String[] codePaths = { ps.getPathString() }; final long[] ceDataInodes = { packageStateInternal.getUserStateOrDefault(userId).getCeDataInode() }; final String[] codePaths = { packageStateInternal.getPathString() }; try { mPm.mInstaller.getAppSize(ps.getVolumeUuid(), packageNames, userId, 0, ps.getAppId(), ceDataInodes, codePaths, stats); mPm.mInstaller.getAppSize(packageStateInternal.getVolumeUuid(), packageNames, userId, 0, packageStateInternal.getAppId(), ceDataInodes, codePaths, stats); // For now, ignore code size of packages on system partition if (PackageManagerServiceUtils.isSystemApp(ps) && !PackageManagerServiceUtils.isUpdatedSystemApp(ps)) { if (PackageManagerServiceUtils.isSystemApp(packageStateInternal) && !PackageManagerServiceUtils.isUpdatedSystemApp(packageStateInternal)) { stats.codeSize = 0; } Loading
services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +2 −2 Original line number Diff line number Diff line Loading @@ -1076,11 +1076,11 @@ public class PackageManagerServiceUtils { return null; } public static boolean isSystemApp(PackageSetting ps) { public static boolean isSystemApp(PackageStateInternal ps) { return (ps.getFlags() & ApplicationInfo.FLAG_SYSTEM) != 0; } public static boolean isUpdatedSystemApp(PackageSetting ps) { public static boolean isUpdatedSystemApp(PackageStateInternal ps) { return (ps.getFlags() & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0; } Loading