Loading services/java/com/android/server/pm/PackageManagerService.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -5566,9 +5566,9 @@ public class PackageManagerService extends IPackageManager.Stub { // version of the one on the data partition, but which // version of the one on the data partition, but which // granted a new system permission that it didn't have // granted a new system permission that it didn't have // before. In this case we do want to allow the app to // before. In this case we do want to allow the app to // now get the new permission if the new system-partition // now get the new permission if the ancestral apk is // apk is privileged to get it. // privileged to get it. if (sysPs.pkg != null && isPrivilegedApp(pkg)) { if (sysPs.pkg != null && sysPs.isPrivileged()) { for (int j=0; for (int j=0; j<sysPs.pkg.requestedPermissions.size(); j++) { j<sysPs.pkg.requestedPermissions.size(); j++) { if (perm.equals( if (perm.equals( Loading Loading @@ -9370,7 +9370,7 @@ public class PackageManagerService extends IPackageManager.Stub { } } } } boolean locationIsPrivileged(File path) { static boolean locationIsPrivileged(File path) { try { try { final String privilegedAppDir = new File(Environment.getRootDirectory(), "priv-app") final String privilegedAppDir = new File(Environment.getRootDirectory(), "priv-app") .getCanonicalPath(); .getCanonicalPath(); Loading services/java/com/android/server/pm/PackageSetting.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.pm; package com.android.server.pm; import android.content.pm.ApplicationInfo; import android.content.pm.PackageParser; import android.content.pm.PackageParser; import java.io.File; import java.io.File; Loading Loading @@ -56,4 +57,8 @@ final class PackageSetting extends PackageSettingBase { public int[] getGids() { public int[] getGids() { return sharedUser != null ? sharedUser.gids : gids; return sharedUser != null ? sharedUser.gids : gids; } } public boolean isPrivileged() { return (pkgFlags & ApplicationInfo.FLAG_PRIVILEGED) != 0; } } } services/java/com/android/server/pm/Settings.java +6 −1 Original line number Original line Diff line number Diff line Loading @@ -2210,7 +2210,11 @@ final class Settings { int pkgFlags = 0; int pkgFlags = 0; pkgFlags |= ApplicationInfo.FLAG_SYSTEM; pkgFlags |= ApplicationInfo.FLAG_SYSTEM; PackageSetting ps = new PackageSetting(name, realName, new File(codePathStr), final File codePathFile = new File(codePathStr); if (PackageManagerService.locationIsPrivileged(codePathFile)) { pkgFlags |= ApplicationInfo.FLAG_PRIVILEGED; } PackageSetting ps = new PackageSetting(name, realName, codePathFile, new File(resourcePathStr), nativeLibraryPathStr, versionCode, pkgFlags); new File(resourcePathStr), nativeLibraryPathStr, versionCode, pkgFlags); String timeStampStr = parser.getAttributeValue(null, "ft"); String timeStampStr = parser.getAttributeValue(null, "ft"); if (timeStampStr != null) { if (timeStampStr != null) { Loading Loading @@ -2266,6 +2270,7 @@ final class Settings { XmlUtils.skipCurrentTag(parser); XmlUtils.skipCurrentTag(parser); } } } } mDisabledSysPackages.put(name, ps); mDisabledSysPackages.put(name, ps); } } Loading Loading
services/java/com/android/server/pm/PackageManagerService.java +4 −4 Original line number Original line Diff line number Diff line Loading @@ -5566,9 +5566,9 @@ public class PackageManagerService extends IPackageManager.Stub { // version of the one on the data partition, but which // version of the one on the data partition, but which // granted a new system permission that it didn't have // granted a new system permission that it didn't have // before. In this case we do want to allow the app to // before. In this case we do want to allow the app to // now get the new permission if the new system-partition // now get the new permission if the ancestral apk is // apk is privileged to get it. // privileged to get it. if (sysPs.pkg != null && isPrivilegedApp(pkg)) { if (sysPs.pkg != null && sysPs.isPrivileged()) { for (int j=0; for (int j=0; j<sysPs.pkg.requestedPermissions.size(); j++) { j<sysPs.pkg.requestedPermissions.size(); j++) { if (perm.equals( if (perm.equals( Loading Loading @@ -9370,7 +9370,7 @@ public class PackageManagerService extends IPackageManager.Stub { } } } } boolean locationIsPrivileged(File path) { static boolean locationIsPrivileged(File path) { try { try { final String privilegedAppDir = new File(Environment.getRootDirectory(), "priv-app") final String privilegedAppDir = new File(Environment.getRootDirectory(), "priv-app") .getCanonicalPath(); .getCanonicalPath(); Loading
services/java/com/android/server/pm/PackageSetting.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.pm; package com.android.server.pm; import android.content.pm.ApplicationInfo; import android.content.pm.PackageParser; import android.content.pm.PackageParser; import java.io.File; import java.io.File; Loading Loading @@ -56,4 +57,8 @@ final class PackageSetting extends PackageSettingBase { public int[] getGids() { public int[] getGids() { return sharedUser != null ? sharedUser.gids : gids; return sharedUser != null ? sharedUser.gids : gids; } } public boolean isPrivileged() { return (pkgFlags & ApplicationInfo.FLAG_PRIVILEGED) != 0; } } }
services/java/com/android/server/pm/Settings.java +6 −1 Original line number Original line Diff line number Diff line Loading @@ -2210,7 +2210,11 @@ final class Settings { int pkgFlags = 0; int pkgFlags = 0; pkgFlags |= ApplicationInfo.FLAG_SYSTEM; pkgFlags |= ApplicationInfo.FLAG_SYSTEM; PackageSetting ps = new PackageSetting(name, realName, new File(codePathStr), final File codePathFile = new File(codePathStr); if (PackageManagerService.locationIsPrivileged(codePathFile)) { pkgFlags |= ApplicationInfo.FLAG_PRIVILEGED; } PackageSetting ps = new PackageSetting(name, realName, codePathFile, new File(resourcePathStr), nativeLibraryPathStr, versionCode, pkgFlags); new File(resourcePathStr), nativeLibraryPathStr, versionCode, pkgFlags); String timeStampStr = parser.getAttributeValue(null, "ft"); String timeStampStr = parser.getAttributeValue(null, "ft"); if (timeStampStr != null) { if (timeStampStr != null) { Loading Loading @@ -2266,6 +2270,7 @@ final class Settings { XmlUtils.skipCurrentTag(parser); XmlUtils.skipCurrentTag(parser); } } } } mDisabledSysPackages.put(name, ps); mDisabledSysPackages.put(name, ps); } } Loading