Loading services/core/java/com/android/server/pm/PackageInstallerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -866,8 +866,9 @@ public class PackageInstallerService extends IPackageInstaller.Stub { if ((callingUid != Process.SHELL_UID) && (callingUid != Process.ROOT_UID)) { mAppOps.checkPackage(callingUid, callerPackageName); final String installerPackageName = mPm.getInstallerPackageName(packageName); allowSilentUninstall = installerPackageName != null && installerPackageName.equals(callerPackageName); allowSilentUninstall = mPm.isOrphaned(packageName) || (installerPackageName != null && installerPackageName.equals(callerPackageName)); } // Check whether the caller is device owner, in which case we do it silently. Loading services/core/java/com/android/server/pm/PackageManagerService.java +7 −0 Original line number Diff line number Diff line Loading @@ -17525,6 +17525,13 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName()); } } public boolean isOrphaned(String packageName) { // reader synchronized (mPackages) { return mSettings.isOrphaned(packageName); } } @Override public int getApplicationEnabledSetting(String packageName, int userId) { if (!sUserManager.exists(userId)) return COMPONENT_ENABLED_STATE_DISABLED; services/core/java/com/android/server/pm/PackageSettingBase.java +3 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,8 @@ abstract class PackageSettingBase extends SettingBase { /** Package name of the app that installed this package */ String installerPackageName; /** Indicates if the package that installed this app has been uninstalled */ boolean isOrphaned; /** UUID of {@link VolumeInfo} hosting this app */ String volumeUuid; Loading Loading @@ -182,6 +184,7 @@ abstract class PackageSettingBase extends SettingBase { origPackage = base.origPackage; installerPackageName = base.installerPackageName; isOrphaned = base.isOrphaned; volumeUuid = base.volumeUuid; keySetData = new PackageKeySetData(base.keySetData); Loading services/core/java/com/android/server/pm/Settings.java +15 −0 Original line number Diff line number Diff line Loading @@ -1117,6 +1117,7 @@ final class Settings { if (installerPackageName != null && installerPackageName.equals(packageName)) { ps.setInstallerPackageName(null); ps.isOrphaned = true; } } mInstallerPackages.remove(packageName); Loading Loading @@ -2647,6 +2648,9 @@ final class Settings { if (pkg.installerPackageName != null) { serializer.attribute(null, "installer", pkg.installerPackageName); } if (pkg.isOrphaned) { serializer.attribute(null, "isOrphaned", "true"); } if (pkg.volumeUuid != null) { serializer.attribute(null, "volumeUuid", pkg.volumeUuid); } Loading Loading @@ -3522,6 +3526,7 @@ final class Settings { String cpuAbiOverrideString = null; String systemStr = null; String installerPackageName = null; String isOrphaned = null; String volumeUuid = null; String uidError = null; int pkgFlags = 0; Loading Loading @@ -3563,6 +3568,7 @@ final class Settings { } } installerPackageName = parser.getAttributeValue(null, "installer"); isOrphaned = parser.getAttributeValue(null, "isOrphaned"); volumeUuid = parser.getAttributeValue(null, "volumeUuid"); systemStr = parser.getAttributeValue(null, "publicFlags"); Loading Loading @@ -3713,6 +3719,7 @@ final class Settings { if (packageSetting != null) { packageSetting.uidError = "true".equals(uidError); packageSetting.installerPackageName = installerPackageName; packageSetting.isOrphaned = "true".equals(isOrphaned); packageSetting.volumeUuid = volumeUuid; packageSetting.legacyNativeLibraryPathString = legacyNativeLibraryPathStr; packageSetting.primaryCpuAbiString = primaryCpuAbiString; Loading Loading @@ -4115,6 +4122,14 @@ final class Settings { return pkg.installerPackageName; } boolean isOrphaned(String packageName) { final PackageSetting pkg = mPackages.get(packageName); if (pkg == null) { throw new IllegalArgumentException("Unknown package: " + packageName); } return pkg.isOrphaned; } int getApplicationEnabledSettingLPr(String packageName, int userId) { final PackageSetting pkg = mPackages.get(packageName); if (pkg == null) { Loading Loading
services/core/java/com/android/server/pm/PackageInstallerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -866,8 +866,9 @@ public class PackageInstallerService extends IPackageInstaller.Stub { if ((callingUid != Process.SHELL_UID) && (callingUid != Process.ROOT_UID)) { mAppOps.checkPackage(callingUid, callerPackageName); final String installerPackageName = mPm.getInstallerPackageName(packageName); allowSilentUninstall = installerPackageName != null && installerPackageName.equals(callerPackageName); allowSilentUninstall = mPm.isOrphaned(packageName) || (installerPackageName != null && installerPackageName.equals(callerPackageName)); } // Check whether the caller is device owner, in which case we do it silently. Loading
services/core/java/com/android/server/pm/PackageManagerService.java +7 −0 Original line number Diff line number Diff line Loading @@ -17525,6 +17525,13 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName()); } } public boolean isOrphaned(String packageName) { // reader synchronized (mPackages) { return mSettings.isOrphaned(packageName); } } @Override public int getApplicationEnabledSetting(String packageName, int userId) { if (!sUserManager.exists(userId)) return COMPONENT_ENABLED_STATE_DISABLED;
services/core/java/com/android/server/pm/PackageSettingBase.java +3 −0 Original line number Diff line number Diff line Loading @@ -125,6 +125,8 @@ abstract class PackageSettingBase extends SettingBase { /** Package name of the app that installed this package */ String installerPackageName; /** Indicates if the package that installed this app has been uninstalled */ boolean isOrphaned; /** UUID of {@link VolumeInfo} hosting this app */ String volumeUuid; Loading Loading @@ -182,6 +184,7 @@ abstract class PackageSettingBase extends SettingBase { origPackage = base.origPackage; installerPackageName = base.installerPackageName; isOrphaned = base.isOrphaned; volumeUuid = base.volumeUuid; keySetData = new PackageKeySetData(base.keySetData); Loading
services/core/java/com/android/server/pm/Settings.java +15 −0 Original line number Diff line number Diff line Loading @@ -1117,6 +1117,7 @@ final class Settings { if (installerPackageName != null && installerPackageName.equals(packageName)) { ps.setInstallerPackageName(null); ps.isOrphaned = true; } } mInstallerPackages.remove(packageName); Loading Loading @@ -2647,6 +2648,9 @@ final class Settings { if (pkg.installerPackageName != null) { serializer.attribute(null, "installer", pkg.installerPackageName); } if (pkg.isOrphaned) { serializer.attribute(null, "isOrphaned", "true"); } if (pkg.volumeUuid != null) { serializer.attribute(null, "volumeUuid", pkg.volumeUuid); } Loading Loading @@ -3522,6 +3526,7 @@ final class Settings { String cpuAbiOverrideString = null; String systemStr = null; String installerPackageName = null; String isOrphaned = null; String volumeUuid = null; String uidError = null; int pkgFlags = 0; Loading Loading @@ -3563,6 +3568,7 @@ final class Settings { } } installerPackageName = parser.getAttributeValue(null, "installer"); isOrphaned = parser.getAttributeValue(null, "isOrphaned"); volumeUuid = parser.getAttributeValue(null, "volumeUuid"); systemStr = parser.getAttributeValue(null, "publicFlags"); Loading Loading @@ -3713,6 +3719,7 @@ final class Settings { if (packageSetting != null) { packageSetting.uidError = "true".equals(uidError); packageSetting.installerPackageName = installerPackageName; packageSetting.isOrphaned = "true".equals(isOrphaned); packageSetting.volumeUuid = volumeUuid; packageSetting.legacyNativeLibraryPathString = legacyNativeLibraryPathStr; packageSetting.primaryCpuAbiString = primaryCpuAbiString; Loading Loading @@ -4115,6 +4122,14 @@ final class Settings { return pkg.installerPackageName; } boolean isOrphaned(String packageName) { final PackageSetting pkg = mPackages.get(packageName); if (pkg == null) { throw new IllegalArgumentException("Unknown package: " + packageName); } return pkg.isOrphaned; } int getApplicationEnabledSettingLPr(String packageName, int userId) { final PackageSetting pkg = mPackages.get(packageName); if (pkg == null) { Loading