当前位置: 首页 > news >正文

Android T(13) The app is granted permissions by default

我的博客
对比Android11,frameworks\base\services\core\java\com\android\server\pm\permission文件夹下,多了个PermissionManagerServiceImpl.java.
有一部分关于权限的处理,移到了这个文件中.比如:restorePermissionState(…)

all app granted permissions by default
+++ b/frameworks/base/services/core/java/com/android/server/pm/permission/Permission.java
@@ -206,12 +206,18 @@ public final class Permission {}public boolean isNormal() {
-        return (mPermissionInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE)
-                == PermissionInfo.PROTECTION_NORMAL;
+        //add text
+        /*return (mPermissionInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE)
+                == PermissionInfo.PROTECTION_NORMAL;*/
+        return true;
+        //add text}public boolean isRuntime() {
-        return (mPermissionInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE)
-                == PermissionInfo.PROTECTION_DANGEROUS;
+        //add text
+        /*return (mPermissionInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE)
+                == PermissionInfo.PROTECTION_DANGEROUS;*/
+        return false;
+        //add text}
customer’s app granted permissions by default
 /*** Restore the permission state for a package.** <ul>*     <li>During boot the state gets restored from the disk</li>*     <li>During app update the state gets restored from the last version of the app</li>* </ul>** @param pkg the package the permissions belong to* @param replace if the package is getting replaced (this might change the requested*                permissions of this package)* @param packageOfInterest If this is the name of {@code pkg} add extra logging* @param callback Result call back* @param filterUserId If not {@link UserHandle.USER_ALL}, only restore the permission state for*                     this particular user*/private void restorePermissionState(@NonNull AndroidPackage pkg, boolean replace,@Nullable String packageOfInterest, @Nullable PermissionCallback callback,@UserIdInt int filterUserId) {...else if (bp.isRuntime()) {boolean hardRestricted = bp.isHardRestricted();boolean softRestricted = bp.isSoftRestricted();...if (wasChanged) {updatedUserIds = ArrayUtils.appendInt(updatedUserIds, userId);}uidState.updatePermissionFlags(bp, MASK_PERMISSION_FLAGS_ALL, flags);
+                        //add text
+                        String packageName_t = pkg.getPackageName();
+                        if(packageName_t.equals("android.xx.xxxxx")){
+                            uidState.revokePermission(bp);//先撤销
+                            uidState.updatePermissionFlags(bp, MASK_PERMISSION_FLAGS_ALL, 0);//在更新
+                            updatedUserIds = ArrayUtils.appendInt(updatedUserIds, userId);
+                            if(uidState.grantPermission(bp)){
+                                changedInstallPermission = true;//让RunTime Permission 走 Install Permission 的路
+                            }
+                        }
+                        //add text} else {Slog.wtf(LOG_TAG, "Unknown permission protection " + bp.getProtection()+ " for permission " + bp.getName());...}    
http://www.lryc.cn/news/428248.html

相关文章:

  • 4 - Linux远程访问及控制
  • 如何使用AWS EC2资源?
  • Linux高编-进程的概念(1)
  • go语言中new和make的区别
  • SpringBoot响应式编程(3)R2DBC
  • 什么是私有继承
  • Scratch编程:开启智能硬件控制的大门
  • 机器学习第十二章-计算学习理论
  • Java-自定义注解操作日志记录处理(@Pointcut注解不是必须的)
  • 【c++】深入理解别名机制--引用
  • 简便的qemu img扩容方法
  • EPERM: operation not permitted,
  • 将Centos 8 Linux内核版本升级或降级到指定版本
  • 小程序商城被盗刷,使用SCDN安全加速有用吗?
  • nginx的基本使用与其日志
  • linux | 苹果OpenCL(提高应用软件如游戏、娱乐以及科研和医疗软件的运行速度和响应)
  • 算法-UKF中Sigma点生成
  • 精选五款热门骨传导耳机分享,让你避免踩坑的陷阱
  • 「字符串」前缀函数|KMP匹配:规范化next数组 / LeetCode 28(C++)
  • python人工智能002:jupyter基本使用
  • Linux使用 firewalld管理防火墙命令
  • 二叉树(三)
  • 05--kubernetes组件与安装
  • EmguCV学习笔记 VB.Net和C# 下的OpenCv开发 C# 目录
  • 探索TensorFlow:深度学习的未来
  • 探索地理空间分析的新世界:Geopandas的魔力
  • 如何为网站申请免费SSL证书?
  • Java项目集成RocketMQ
  • 如何将 Bamboo agent 能力迁移到极狐GitLab tag 上?
  • 正则表达式入门:Python ‘ re ‘ 模块详解