天天看点

sprd安卓11 动态设置apk的默认权限

需求:后台接口将apk包名列表保存在对应的数据库中,系统通过此列表设置apk默认权限

(apk列表必须在对应apk安装之前发送给设备,否则无效)

--- a/sprd/frameworks/base/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/sprd/frameworks/base/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -171,7 +171,8 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.function.Consumer;
-
+import android.provider.Settings;
+import android.os.SystemProperties;
 /**
  * Manages all permissions and handles permissions related tasks.
  */
@@ -2782,6 +2783,14 @@ public class PermissionManagerService extends IPermissionManager.Stub {
                         // For modern apps keep runtime permissions unchanged.
                         grant = GRANT_RUNTIME;
                     }
+