Merge "Don't check apex when granting priv permission unless needed" into rvc-dev am: 19f8283a01 am: c6dfff9043 am: f5a0a6a0ea
Change-Id: I3d4e7f461efba4f50f261d8b6f6872190ba4c2a5
This commit is contained in:
committed by
Automerger Merge Worker
commit
1592ff0631
@@ -3319,47 +3319,51 @@ public class PermissionManagerService extends IPermissionManager.Stub {
|
|||||||
if (!privappPermissionsDisable && privilegedPermission && pkg.isPrivileged()
|
if (!privappPermissionsDisable && privilegedPermission && pkg.isPrivileged()
|
||||||
&& !platformPackage && platformPermission) {
|
&& !platformPackage && platformPermission) {
|
||||||
if (!hasPrivappWhitelistEntry(perm, pkg)) {
|
if (!hasPrivappWhitelistEntry(perm, pkg)) {
|
||||||
ApexManager apexMgr = ApexManager.getInstance();
|
|
||||||
String apexContainingPkg = apexMgr.getActiveApexPackageNameContainingPackage(pkg);
|
|
||||||
|
|
||||||
// Only enforce whitelist this on boot
|
// Only enforce whitelist this on boot
|
||||||
if (!mSystemReady
|
if (!mSystemReady
|
||||||
// Updated system apps do not need to be whitelisted
|
// Updated system apps do not need to be whitelisted
|
||||||
&& !pkgSetting.getPkgState().isUpdatedSystemApp()
|
&& !pkgSetting.getPkgState().isUpdatedSystemApp()) {
|
||||||
// Apps that are in updated apexs' do not need to be whitelisted
|
ApexManager apexMgr = ApexManager.getInstance();
|
||||||
&& (apexContainingPkg == null || apexMgr.isFactory(
|
String apexContainingPkg = apexMgr.getActiveApexPackageNameContainingPackage(
|
||||||
apexMgr.getPackageInfo(apexContainingPkg, MATCH_ACTIVE_PACKAGE)))) {
|
pkg);
|
||||||
// it's only a reportable violation if the permission isn't explicitly denied
|
|
||||||
ArraySet<String> deniedPermissions = null;
|
|
||||||
if (pkg.isVendor()) {
|
|
||||||
deniedPermissions = SystemConfig.getInstance()
|
|
||||||
.getVendorPrivAppDenyPermissions(pkg.getPackageName());
|
|
||||||
} else if (pkg.isProduct()) {
|
|
||||||
deniedPermissions = SystemConfig.getInstance()
|
|
||||||
.getProductPrivAppDenyPermissions(pkg.getPackageName());
|
|
||||||
} else if (pkg.isSystemExt()) {
|
|
||||||
deniedPermissions = SystemConfig.getInstance()
|
|
||||||
.getSystemExtPrivAppDenyPermissions(pkg.getPackageName());
|
|
||||||
} else {
|
|
||||||
deniedPermissions = SystemConfig.getInstance()
|
|
||||||
.getPrivAppDenyPermissions(pkg.getPackageName());
|
|
||||||
}
|
|
||||||
final boolean permissionViolation =
|
|
||||||
deniedPermissions == null || !deniedPermissions.contains(perm);
|
|
||||||
if (permissionViolation) {
|
|
||||||
Slog.w(TAG, "Privileged permission " + perm + " for package "
|
|
||||||
+ pkg.getPackageName() + " (" + pkg.getCodePath()
|
|
||||||
+ ") not in privapp-permissions whitelist");
|
|
||||||
|
|
||||||
if (RoSystemProperties.CONTROL_PRIVAPP_PERMISSIONS_ENFORCE) {
|
// Apps that are in updated apexs' do not need to be whitelisted
|
||||||
if (mPrivappPermissionsViolations == null) {
|
if (apexContainingPkg == null || apexMgr.isFactory(
|
||||||
mPrivappPermissionsViolations = new ArraySet<>();
|
apexMgr.getPackageInfo(apexContainingPkg, MATCH_ACTIVE_PACKAGE))) {
|
||||||
}
|
// it's only a reportable violation if the permission isn't explicitly
|
||||||
mPrivappPermissionsViolations.add(
|
// denied
|
||||||
pkg.getPackageName() + " (" + pkg.getCodePath() + "): " + perm);
|
ArraySet<String> deniedPermissions = null;
|
||||||
|
if (pkg.isVendor()) {
|
||||||
|
deniedPermissions = SystemConfig.getInstance()
|
||||||
|
.getVendorPrivAppDenyPermissions(pkg.getPackageName());
|
||||||
|
} else if (pkg.isProduct()) {
|
||||||
|
deniedPermissions = SystemConfig.getInstance()
|
||||||
|
.getProductPrivAppDenyPermissions(pkg.getPackageName());
|
||||||
|
} else if (pkg.isSystemExt()) {
|
||||||
|
deniedPermissions = SystemConfig.getInstance()
|
||||||
|
.getSystemExtPrivAppDenyPermissions(pkg.getPackageName());
|
||||||
|
} else {
|
||||||
|
deniedPermissions = SystemConfig.getInstance()
|
||||||
|
.getPrivAppDenyPermissions(pkg.getPackageName());
|
||||||
|
}
|
||||||
|
final boolean permissionViolation =
|
||||||
|
deniedPermissions == null || !deniedPermissions.contains(perm);
|
||||||
|
if (permissionViolation) {
|
||||||
|
Slog.w(TAG, "Privileged permission " + perm + " for package "
|
||||||
|
+ pkg.getPackageName() + " (" + pkg.getCodePath()
|
||||||
|
+ ") not in privapp-permissions whitelist");
|
||||||
|
|
||||||
|
if (RoSystemProperties.CONTROL_PRIVAPP_PERMISSIONS_ENFORCE) {
|
||||||
|
if (mPrivappPermissionsViolations == null) {
|
||||||
|
mPrivappPermissionsViolations = new ArraySet<>();
|
||||||
|
}
|
||||||
|
mPrivappPermissionsViolations.add(
|
||||||
|
pkg.getPackageName() + " (" + pkg.getCodePath() + "): "
|
||||||
|
+ perm);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (RoSystemProperties.CONTROL_PRIVAPP_PERMISSIONS_ENFORCE) {
|
if (RoSystemProperties.CONTROL_PRIVAPP_PERMISSIONS_ENFORCE) {
|
||||||
|
|||||||
Reference in New Issue
Block a user