Android系统的定制开发中,经常会有客户要求赋予他们提供的应用程序(APK)所默认的所有权限;百度上有多种版本可以给与默认权限,但是经过博主试验,都是比较复杂麻烦的操作; 在这里博主给出一个简单方便方法,直接上代码;
--- a/frameworks/base/services/core/java/com/android/server/pm/permission/Permission.java
+++ b/frameworks/base/services/core/java/com/android/server/pm/permission/Permission.java
@@ -206,12 +206,10 @@ public final class Permission {
}
public boolean isNormal() {
- return (mPermissionInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE)
- == PermissionInfo.PROTECTION_NORMAL;
+ return true;
}
public boolean isRuntime() {
- return (mPermissionInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE)
- == PermissionInfo.PROTECTION_DANGEROUS;
+ return false;
}
public boolean isInstalled() {