在启动的过程中系统读入revoke_permissions文件,在现有apk的权限,去掉在revoke_permissions。如果要更改revoke_permissions,要重启系统,才能生效。
frameworks/base/services/java/com/android/server/pm/PackageManagerService.java
HashSet<String> revokedPerms = mRevokePermissionPolicy.get(pkg.packageName);
gp.effectivePermissions = (HashSet<String>) gp.grantedPermissions.clone();
gp.revokedGids = null;
if (revokedPerms != null) {
for (String grantedPerm : gp.grantedPermissions) {
if (revokedPerms.contains(grantedPerm)) {
if (DEBUG_POLICY_REVOKE) {
Slog.d(TAG, "Revoking effective permission " + grantedPerm
+ " from " + pkg.packageName);
}
gp.effectivePermissions.remove(grantedPerm);
final BasePermission bp = mSettings.mPermissions.get(grantedPerm);
gp.revokedGids = appendInts(gp.revokedGids, bp.gids);
}
}
}