Loading services/core/java/android/content/pm/PackageManagerInternal.java +1 −1 Original line number Diff line number Diff line Loading @@ -845,7 +845,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP /** * Perform the given action for each installed package for a user. * Note that packages lock will be held while performin the actions. * Note that packages lock will be held while performing the actions. */ public abstract void forEachInstalledPackage( @NonNull Consumer<AndroidPackage> actionLocked, @UserIdInt int userId); Loading services/core/java/com/android/server/pm/InstantAppRegistry.java +12 −7 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.InstantAppInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.pm.PermissionInfo; import android.content.pm.SigningDetails; import android.graphics.Bitmap; Loading Loading @@ -123,6 +124,7 @@ class InstantAppRegistry implements Watchable, Snappable { private final PackageManagerService mService; private final PermissionManagerServiceInternal mPermissionManager; private final CookiePersistence mCookiePersistence; private final PackageManagerInternal mPmInternal; /** State for uninstalled instant apps */ @Watched Loading Loading @@ -191,9 +193,11 @@ class InstantAppRegistry implements Watchable, Snappable { } public InstantAppRegistry(PackageManagerService service, PermissionManagerServiceInternal permissionManager) { PermissionManagerServiceInternal permissionManager, PackageManagerInternal pmInternal) { mService = service; mPermissionManager = permissionManager; mPmInternal = pmInternal; mCookiePersistence = new CookiePersistence(BackgroundThread.getHandler().getLooper()); mUninstalledInstantApps = new WatchedSparseArray<List<UninstalledInstantAppState>>(); Loading @@ -214,6 +218,7 @@ class InstantAppRegistry implements Watchable, Snappable { private InstantAppRegistry(InstantAppRegistry r) { mService = r.mService; mPermissionManager = r.mPermissionManager; mPmInternal = r.mPmInternal; mCookiePersistence = null; mUninstalledInstantApps = new WatchedSparseArray<List<UninstalledInstantAppState>>( Loading Loading @@ -366,7 +371,7 @@ class InstantAppRegistry implements Watchable, Snappable { @GuardedBy("mService.mLock") public void onPackageInstalledLPw(@NonNull AndroidPackage pkg, @NonNull int[] userIds) { PackageSetting ps = mService.getPackageSetting(pkg.getPackageName()); PackageSetting ps = mPmInternal.getPackageSetting(pkg.getPackageName()); if (ps == null) { return; } Loading Loading @@ -784,7 +789,7 @@ class InstantAppRegistry implements Watchable, Snappable { final int packageCount = mService.mPackages.size(); for (int i = 0; i < packageCount; i++) { final AndroidPackage pkg = mService.mPackages.valueAt(i); final PackageSetting ps = mService.getPackageSetting(pkg.getPackageName()); final PackageSetting ps = mPmInternal.getPackageSetting(pkg.getPackageName()); if (ps == null) { continue; } Loading Loading @@ -824,13 +829,13 @@ class InstantAppRegistry implements Watchable, Snappable { } else if (rhsPkg == null) { return 1; } else { final PackageSetting lhsPs = mService.getPackageSetting( final PackageSetting lhsPs = mPmInternal.getPackageSetting( lhsPkg.getPackageName()); if (lhsPs == null) { return 0; } final PackageSetting rhsPs = mService.getPackageSetting( final PackageSetting rhsPs = mPmInternal.getPackageSetting( rhsPkg.getPackageName()); if (rhsPs == null) { return 0; Loading Loading @@ -918,7 +923,7 @@ class InstantAppRegistry implements Watchable, Snappable { final int packageCount = mService.mPackages.size(); for (int i = 0; i < packageCount; i++) { final AndroidPackage pkg = mService.mPackages.valueAt(i); final PackageSetting ps = mService.getPackageSetting(pkg.getPackageName()); final PackageSetting ps = mPmInternal.getPackageSetting(pkg.getPackageName()); if (ps == null || !ps.getInstantApp(userId)) { continue; } Loading @@ -940,7 +945,7 @@ class InstantAppRegistry implements Watchable, Snappable { InstantAppInfo createInstantAppInfoForPackage( @NonNull AndroidPackage pkg, @UserIdInt int userId, boolean addApplicationInfo) { PackageSetting ps = mService.getPackageSetting(pkg.getPackageName()); PackageSetting ps = mPmInternal.getPackageSetting(pkg.getPackageName()); if (ps == null) { return null; } Loading services/core/java/com/android/server/pm/OtaDexoptService.java +7 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME; import android.annotation.Nullable; import android.content.Context; import android.content.pm.IOtaDexopt; import android.content.pm.PackageManagerInternal; import android.os.Environment; import android.os.RemoteException; import android.os.ResultReceiver; Loading @@ -33,6 +34,7 @@ import android.util.Log; import android.util.Slog; import com.android.internal.logging.MetricsLogger; import com.android.server.LocalServices; import com.android.server.pm.Installer.InstallerException; import com.android.server.pm.dex.DexoptOptions; import com.android.server.pm.parsing.pkg.AndroidPackage; Loading @@ -41,7 +43,6 @@ import com.android.server.pm.parsing.pkg.AndroidPackageUtils; import java.io.File; import java.io.FileDescriptor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; Loading Loading @@ -371,8 +372,10 @@ public class OtaDexoptService extends IOtaDexopt.Stub { return; } // Look into all packages. Collection<AndroidPackage> pkgs = mPackageManagerService.getPackages(); // Make a copy of all packages and look into each package. final PackageManagerInternal pmInt = LocalServices.getService(PackageManagerInternal.class); final ArrayList<AndroidPackage> pkgs = new ArrayList<>(); pmInt.forEachPackage(pkgs::add); int packagePaths = 0; int pathsSuccessful = 0; for (AndroidPackage pkg : pkgs) { Loading @@ -398,7 +401,7 @@ public class OtaDexoptService extends IOtaDexopt.Stub { continue; } PackageSetting pkgSetting = mPackageManagerService.getPackageSetting(pkg.getPackageName()); PackageSetting pkgSetting = pmInt.getPackageSetting(pkg.getPackageName()); final String[] instructionSets = getAppDexInstructionSets( AndroidPackageUtils.getPrimaryCpuAbi(pkg, pkgSetting), AndroidPackageUtils.getSecondaryCpuAbi(pkg, pkgSetting)); Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +2 −2 Original line number Diff line number Diff line Loading @@ -2212,7 +2212,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { @Override public void transfer(String packageName) { Preconditions.checkArgument(!TextUtils.isEmpty(packageName)); ApplicationInfo newOwnerAppInfo = mPm.getApplicationInfo(packageName, 0, userId); if (newOwnerAppInfo == null) { throw new ParcelableException(new PackageManager.NameNotFoundException(packageName)); Loading Loading @@ -2779,7 +2778,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } private long getApksSize(String packageName) { final PackageSetting ps = mPm.getPackageSetting(packageName); final PackageManagerInternal pmi = LocalServices.getService(PackageManagerInternal.class); final PackageSetting ps = pmi.getPackageSetting(packageName); if (ps == null) { return 0; } Loading services/core/java/com/android/server/pm/PackageManagerService.java +3 −12 Original line number Diff line number Diff line Loading @@ -7184,7 +7184,7 @@ public class PackageManagerService extends IPackageManager.Stub } } mInstantAppRegistry = new InstantAppRegistry(this, mPermissionManager); mInstantAppRegistry = new InstantAppRegistry(this, mPermissionManager, mPmInternal); mDirsToScanAsSystem = new ArrayList<>(); mDirsToScanAsSystem.addAll(injector.getSystemPartitions()); Loading Loading @@ -28439,7 +28439,8 @@ public class PackageManagerService extends IPackageManager.Stub } @Nullable public PackageSetting getPackageSetting(String packageName) { @VisibleForTesting(visibility = Visibility.PRIVATE) PackageSetting getPackageSetting(String packageName) { return mComputer.getPackageSetting(packageName); } Loading Loading @@ -28477,16 +28478,6 @@ public class PackageManagerService extends IPackageManager.Stub } } /** * Return a <b>copy</b> of the collection of packages known to the package manager. * @return A copy of the values of mPackages. */ Collection<AndroidPackage> getPackages() { synchronized (mLock) { return new ArrayList<>(mPackages.values()); } } /** * Logs process start information (including base APK hash) to the security log. * @hide Loading
services/core/java/android/content/pm/PackageManagerInternal.java +1 −1 Original line number Diff line number Diff line Loading @@ -845,7 +845,7 @@ public abstract class PackageManagerInternal implements PackageSettingsSnapshotP /** * Perform the given action for each installed package for a user. * Note that packages lock will be held while performin the actions. * Note that packages lock will be held while performing the actions. */ public abstract void forEachInstalledPackage( @NonNull Consumer<AndroidPackage> actionLocked, @UserIdInt int userId); Loading
services/core/java/com/android/server/pm/InstantAppRegistry.java +12 −7 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.InstantAppInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal; import android.content.pm.PermissionInfo; import android.content.pm.SigningDetails; import android.graphics.Bitmap; Loading Loading @@ -123,6 +124,7 @@ class InstantAppRegistry implements Watchable, Snappable { private final PackageManagerService mService; private final PermissionManagerServiceInternal mPermissionManager; private final CookiePersistence mCookiePersistence; private final PackageManagerInternal mPmInternal; /** State for uninstalled instant apps */ @Watched Loading Loading @@ -191,9 +193,11 @@ class InstantAppRegistry implements Watchable, Snappable { } public InstantAppRegistry(PackageManagerService service, PermissionManagerServiceInternal permissionManager) { PermissionManagerServiceInternal permissionManager, PackageManagerInternal pmInternal) { mService = service; mPermissionManager = permissionManager; mPmInternal = pmInternal; mCookiePersistence = new CookiePersistence(BackgroundThread.getHandler().getLooper()); mUninstalledInstantApps = new WatchedSparseArray<List<UninstalledInstantAppState>>(); Loading @@ -214,6 +218,7 @@ class InstantAppRegistry implements Watchable, Snappable { private InstantAppRegistry(InstantAppRegistry r) { mService = r.mService; mPermissionManager = r.mPermissionManager; mPmInternal = r.mPmInternal; mCookiePersistence = null; mUninstalledInstantApps = new WatchedSparseArray<List<UninstalledInstantAppState>>( Loading Loading @@ -366,7 +371,7 @@ class InstantAppRegistry implements Watchable, Snappable { @GuardedBy("mService.mLock") public void onPackageInstalledLPw(@NonNull AndroidPackage pkg, @NonNull int[] userIds) { PackageSetting ps = mService.getPackageSetting(pkg.getPackageName()); PackageSetting ps = mPmInternal.getPackageSetting(pkg.getPackageName()); if (ps == null) { return; } Loading Loading @@ -784,7 +789,7 @@ class InstantAppRegistry implements Watchable, Snappable { final int packageCount = mService.mPackages.size(); for (int i = 0; i < packageCount; i++) { final AndroidPackage pkg = mService.mPackages.valueAt(i); final PackageSetting ps = mService.getPackageSetting(pkg.getPackageName()); final PackageSetting ps = mPmInternal.getPackageSetting(pkg.getPackageName()); if (ps == null) { continue; } Loading Loading @@ -824,13 +829,13 @@ class InstantAppRegistry implements Watchable, Snappable { } else if (rhsPkg == null) { return 1; } else { final PackageSetting lhsPs = mService.getPackageSetting( final PackageSetting lhsPs = mPmInternal.getPackageSetting( lhsPkg.getPackageName()); if (lhsPs == null) { return 0; } final PackageSetting rhsPs = mService.getPackageSetting( final PackageSetting rhsPs = mPmInternal.getPackageSetting( rhsPkg.getPackageName()); if (rhsPs == null) { return 0; Loading Loading @@ -918,7 +923,7 @@ class InstantAppRegistry implements Watchable, Snappable { final int packageCount = mService.mPackages.size(); for (int i = 0; i < packageCount; i++) { final AndroidPackage pkg = mService.mPackages.valueAt(i); final PackageSetting ps = mService.getPackageSetting(pkg.getPackageName()); final PackageSetting ps = mPmInternal.getPackageSetting(pkg.getPackageName()); if (ps == null || !ps.getInstantApp(userId)) { continue; } Loading @@ -940,7 +945,7 @@ class InstantAppRegistry implements Watchable, Snappable { InstantAppInfo createInstantAppInfoForPackage( @NonNull AndroidPackage pkg, @UserIdInt int userId, boolean addApplicationInfo) { PackageSetting ps = mService.getPackageSetting(pkg.getPackageName()); PackageSetting ps = mPmInternal.getPackageSetting(pkg.getPackageName()); if (ps == null) { return null; } Loading
services/core/java/com/android/server/pm/OtaDexoptService.java +7 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static com.android.server.pm.PackageManagerService.PLATFORM_PACKAGE_NAME; import android.annotation.Nullable; import android.content.Context; import android.content.pm.IOtaDexopt; import android.content.pm.PackageManagerInternal; import android.os.Environment; import android.os.RemoteException; import android.os.ResultReceiver; Loading @@ -33,6 +34,7 @@ import android.util.Log; import android.util.Slog; import com.android.internal.logging.MetricsLogger; import com.android.server.LocalServices; import com.android.server.pm.Installer.InstallerException; import com.android.server.pm.dex.DexoptOptions; import com.android.server.pm.parsing.pkg.AndroidPackage; Loading @@ -41,7 +43,6 @@ import com.android.server.pm.parsing.pkg.AndroidPackageUtils; import java.io.File; import java.io.FileDescriptor; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; Loading Loading @@ -371,8 +372,10 @@ public class OtaDexoptService extends IOtaDexopt.Stub { return; } // Look into all packages. Collection<AndroidPackage> pkgs = mPackageManagerService.getPackages(); // Make a copy of all packages and look into each package. final PackageManagerInternal pmInt = LocalServices.getService(PackageManagerInternal.class); final ArrayList<AndroidPackage> pkgs = new ArrayList<>(); pmInt.forEachPackage(pkgs::add); int packagePaths = 0; int pathsSuccessful = 0; for (AndroidPackage pkg : pkgs) { Loading @@ -398,7 +401,7 @@ public class OtaDexoptService extends IOtaDexopt.Stub { continue; } PackageSetting pkgSetting = mPackageManagerService.getPackageSetting(pkg.getPackageName()); PackageSetting pkgSetting = pmInt.getPackageSetting(pkg.getPackageName()); final String[] instructionSets = getAppDexInstructionSets( AndroidPackageUtils.getPrimaryCpuAbi(pkg, pkgSetting), AndroidPackageUtils.getSecondaryCpuAbi(pkg, pkgSetting)); Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +2 −2 Original line number Diff line number Diff line Loading @@ -2212,7 +2212,6 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { @Override public void transfer(String packageName) { Preconditions.checkArgument(!TextUtils.isEmpty(packageName)); ApplicationInfo newOwnerAppInfo = mPm.getApplicationInfo(packageName, 0, userId); if (newOwnerAppInfo == null) { throw new ParcelableException(new PackageManager.NameNotFoundException(packageName)); Loading Loading @@ -2779,7 +2778,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { } private long getApksSize(String packageName) { final PackageSetting ps = mPm.getPackageSetting(packageName); final PackageManagerInternal pmi = LocalServices.getService(PackageManagerInternal.class); final PackageSetting ps = pmi.getPackageSetting(packageName); if (ps == null) { return 0; } Loading
services/core/java/com/android/server/pm/PackageManagerService.java +3 −12 Original line number Diff line number Diff line Loading @@ -7184,7 +7184,7 @@ public class PackageManagerService extends IPackageManager.Stub } } mInstantAppRegistry = new InstantAppRegistry(this, mPermissionManager); mInstantAppRegistry = new InstantAppRegistry(this, mPermissionManager, mPmInternal); mDirsToScanAsSystem = new ArrayList<>(); mDirsToScanAsSystem.addAll(injector.getSystemPartitions()); Loading Loading @@ -28439,7 +28439,8 @@ public class PackageManagerService extends IPackageManager.Stub } @Nullable public PackageSetting getPackageSetting(String packageName) { @VisibleForTesting(visibility = Visibility.PRIVATE) PackageSetting getPackageSetting(String packageName) { return mComputer.getPackageSetting(packageName); } Loading Loading @@ -28477,16 +28478,6 @@ public class PackageManagerService extends IPackageManager.Stub } } /** * Return a <b>copy</b> of the collection of packages known to the package manager. * @return A copy of the values of mPackages. */ Collection<AndroidPackage> getPackages() { synchronized (mLock) { return new ArrayList<>(mPackages.values()); } } /** * Logs process start information (including base APK hash) to the security log. * @hide