31 次浏览
path: <source>/frameworks/base/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
(1)private void grantPermissions函数else if (bp.isRuntime())条件下的grant值全部改为GRANT_INSTALL
if (bp.isNormal()) {
// For all apps normal permissions are install time ones.
grant = GRANT_INSTALL;
} else if (bp.isRuntime()) {
// If a permission review is required for legacy apps we represent
// their permissions as always granted runtime ones since we need
// to keep the review required permission flag per user while an
// install permission's state is shared across all users.
if (!appSupportsRuntimePermissions && !mSettings.mPermissionReviewRequired) {
// For legacy apps dangerous permissions are install time ones.
grant = GRANT_INSTALL;
} else if (origPermissions.hasInstallPermission(bp.getName())) {
// For legacy apps that became modern, install becomes runtime.
// edited by peng
//grant = GRANT_UPGRADE;
grant = GRANT_INSTALL;
} else if (isLegacySystemApp) {
// For legacy system apps, install becomes runtime.
// We cannot check hasInstallPermission() for system apps since those
// permissions were granted implicitly and not persisted pre-M.
// edited by peng
//grant = GRANT_UPGRADE;
grant = GRANT_INSTALL;
} else {
// For modern apps keep runtime permissions unchanged.
//edited by peng
//grant = GRANT_RUNTIME;
grant = GRANT_INSTALL;
}
} else if (bp.isSignature()) {
// For all apps signature permissions are install time ones.
allowedSig = grantSignaturePermission(perm, pkg, bp, origPermissions);
if (allowedSig) {
grant = GRANT_INSTALL;
}
}