Loading core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -693,6 +693,7 @@ package android.content.pm { method @Nullable public String getSystemTextClassifierPackageName(); method @Nullable public String getWellbeingPackageName(); method public void holdLock(android.os.IBinder, int); method @RequiresPermission(android.Manifest.permission.KEEP_UNINSTALLED_PACKAGES) public void setKeepUninstalledPackages(@NonNull java.util.List<java.lang.String>); field public static final String FEATURE_ADOPTABLE_STORAGE = "android.software.adoptable_storage"; field public static final String FEATURE_FILE_BASED_ENCRYPTION = "android.software.file_based_encryption"; field public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec"; Loading core/java/android/content/pm/IPackageManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -808,4 +808,6 @@ interface IPackageManager { PackageManager.Property getProperty(String propertyName, String packageName, String className); ParceledListSlice queryProperty(String propertyName, int componentType); void setKeepUninstalledPackages(in List<String> packageList); } core/java/android/content/pm/PackageManager.java +17 −1 Original line number Diff line number Diff line Loading @@ -47,8 +47,8 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentSender; import android.content.pm.verify.domain.DomainVerificationManager; import android.content.pm.dex.ArtManager; import android.content.pm.verify.domain.DomainVerificationManager; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.XmlResourceParser; Loading Loading @@ -9282,4 +9282,20 @@ public abstract class PackageManager { throw e.rethrowFromSystemServer(); } } /** * Set a list of apps to keep around as APKs even if no user has currently installed it. * @param packageList List of package names to keep cached. * * @hide */ @RequiresPermission(android.Manifest.permission.KEEP_UNINSTALLED_PACKAGES) @TestApi public void setKeepUninstalledPackages(@NonNull List<String> packageList) { try { ActivityThread.getPackageManager().setKeepUninstalledPackages(packageList); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } } services/core/java/com/android/server/pm/PackageManagerService.java +38 −24 Original line number Diff line number Diff line Loading @@ -26211,30 +26211,7 @@ public class PackageManagerService extends IPackageManager.Stub @Override public void setKeepUninstalledPackages(final List<String> packageList) { Preconditions.checkNotNull(packageList); List<String> removedFromList = null; synchronized (mLock) { if (mKeepUninstalledPackages != null) { final int packagesCount = mKeepUninstalledPackages.size(); for (int i = 0; i < packagesCount; i++) { String oldPackage = mKeepUninstalledPackages.get(i); if (packageList != null && packageList.contains(oldPackage)) { continue; } if (removedFromList == null) { removedFromList = new ArrayList<>(); } removedFromList.add(oldPackage); } } mKeepUninstalledPackages = new ArrayList<>(packageList); if (removedFromList != null) { final int removedCount = removedFromList.size(); for (int i = 0; i < removedCount; i++) { deletePackageIfUnusedLPr(removedFromList.get(i)); } } } PackageManagerService.this.setKeepUninstalledPackagesInternal(packageList); } @Override Loading Loading @@ -27732,6 +27709,43 @@ public class PackageManagerService extends IPackageManager.Stub public DomainVerificationService.Connection getDomainVerificationConnection() { return mDomainVerificationConnection; } @Override public void setKeepUninstalledPackages(List<String> packageList) { mContext.enforceCallingPermission( Manifest.permission.KEEP_UNINSTALLED_PACKAGES, "setKeepUninstalledPackages requires KEEP_UNINSTALLED_PACKAGES permission"); Objects.requireNonNull(packageList); setKeepUninstalledPackagesInternal(packageList); } private void setKeepUninstalledPackagesInternal(List<String> packageList) { Preconditions.checkNotNull(packageList); List<String> removedFromList = null; synchronized (mLock) { if (mKeepUninstalledPackages != null) { final int packagesCount = mKeepUninstalledPackages.size(); for (int i = 0; i < packagesCount; i++) { String oldPackage = mKeepUninstalledPackages.get(i); if (packageList != null && packageList.contains(oldPackage)) { continue; } if (removedFromList == null) { removedFromList = new ArrayList<>(); } removedFromList.add(oldPackage); } } mKeepUninstalledPackages = new ArrayList<>(packageList); if (removedFromList != null) { final int removedCount = removedFromList.size(); for (int i = 0; i < removedCount; i++) { deletePackageIfUnusedLPr(removedFromList.get(i)); } } } } } interface PackageSender { Loading
core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -693,6 +693,7 @@ package android.content.pm { method @Nullable public String getSystemTextClassifierPackageName(); method @Nullable public String getWellbeingPackageName(); method public void holdLock(android.os.IBinder, int); method @RequiresPermission(android.Manifest.permission.KEEP_UNINSTALLED_PACKAGES) public void setKeepUninstalledPackages(@NonNull java.util.List<java.lang.String>); field public static final String FEATURE_ADOPTABLE_STORAGE = "android.software.adoptable_storage"; field public static final String FEATURE_FILE_BASED_ENCRYPTION = "android.software.file_based_encryption"; field public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec"; Loading
core/java/android/content/pm/IPackageManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -808,4 +808,6 @@ interface IPackageManager { PackageManager.Property getProperty(String propertyName, String packageName, String className); ParceledListSlice queryProperty(String propertyName, int componentType); void setKeepUninstalledPackages(in List<String> packageList); }
core/java/android/content/pm/PackageManager.java +17 −1 Original line number Diff line number Diff line Loading @@ -47,8 +47,8 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentSender; import android.content.pm.verify.domain.DomainVerificationManager; import android.content.pm.dex.ArtManager; import android.content.pm.verify.domain.DomainVerificationManager; import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.XmlResourceParser; Loading Loading @@ -9282,4 +9282,20 @@ public abstract class PackageManager { throw e.rethrowFromSystemServer(); } } /** * Set a list of apps to keep around as APKs even if no user has currently installed it. * @param packageList List of package names to keep cached. * * @hide */ @RequiresPermission(android.Manifest.permission.KEEP_UNINSTALLED_PACKAGES) @TestApi public void setKeepUninstalledPackages(@NonNull List<String> packageList) { try { ActivityThread.getPackageManager().setKeepUninstalledPackages(packageList); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } }
services/core/java/com/android/server/pm/PackageManagerService.java +38 −24 Original line number Diff line number Diff line Loading @@ -26211,30 +26211,7 @@ public class PackageManagerService extends IPackageManager.Stub @Override public void setKeepUninstalledPackages(final List<String> packageList) { Preconditions.checkNotNull(packageList); List<String> removedFromList = null; synchronized (mLock) { if (mKeepUninstalledPackages != null) { final int packagesCount = mKeepUninstalledPackages.size(); for (int i = 0; i < packagesCount; i++) { String oldPackage = mKeepUninstalledPackages.get(i); if (packageList != null && packageList.contains(oldPackage)) { continue; } if (removedFromList == null) { removedFromList = new ArrayList<>(); } removedFromList.add(oldPackage); } } mKeepUninstalledPackages = new ArrayList<>(packageList); if (removedFromList != null) { final int removedCount = removedFromList.size(); for (int i = 0; i < removedCount; i++) { deletePackageIfUnusedLPr(removedFromList.get(i)); } } } PackageManagerService.this.setKeepUninstalledPackagesInternal(packageList); } @Override Loading Loading @@ -27732,6 +27709,43 @@ public class PackageManagerService extends IPackageManager.Stub public DomainVerificationService.Connection getDomainVerificationConnection() { return mDomainVerificationConnection; } @Override public void setKeepUninstalledPackages(List<String> packageList) { mContext.enforceCallingPermission( Manifest.permission.KEEP_UNINSTALLED_PACKAGES, "setKeepUninstalledPackages requires KEEP_UNINSTALLED_PACKAGES permission"); Objects.requireNonNull(packageList); setKeepUninstalledPackagesInternal(packageList); } private void setKeepUninstalledPackagesInternal(List<String> packageList) { Preconditions.checkNotNull(packageList); List<String> removedFromList = null; synchronized (mLock) { if (mKeepUninstalledPackages != null) { final int packagesCount = mKeepUninstalledPackages.size(); for (int i = 0; i < packagesCount; i++) { String oldPackage = mKeepUninstalledPackages.get(i); if (packageList != null && packageList.contains(oldPackage)) { continue; } if (removedFromList == null) { removedFromList = new ArrayList<>(); } removedFromList.add(oldPackage); } } mKeepUninstalledPackages = new ArrayList<>(packageList); if (removedFromList != null) { final int removedCount = removedFromList.size(); for (int i = 0; i < removedCount; i++) { deletePackageIfUnusedLPr(removedFromList.get(i)); } } } } } interface PackageSender {