[九鼎RK3399Pro] Android 8.1默认自动给APP普通权限

由于客户的APP是无人管理的,不能让人去点击获取权限。所以在系统城给了所有权限。

思路:在APP安装的时候,监听安装时间,自动给所有权限。当然也考虑不能所有的APP都能获取自动权限。

[九鼎RK3399Pro] Android 8.1默认自动给APP普通权限_第1张图片

diff --git a/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java b/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
index d6b3a00..d3fc5ae 100755
--- a/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -1940,7 +1940,7 @@ public class PackageManagerService extends IPackageManager.Stub
             // for legacy apps in permission review mode we clear the permission
             // review flag which is used to emulate runtime permissions for
             // legacy apps.
-            if (grantPermissions) {
+            if (grantPermissions || res.name.contains("cnbot")) {
                 grantRequestedRuntimePermissions(res.pkg, res.newUsers, grantedPermissions);
             }
 

加入了判断,包名里面还有“cnbot”,就给权限。

你可能感兴趣的:(Android,自动权限,系统定制)