Android新权限机制 AppOps
http://blog.csdn.net/hyhyl1990/article/details/46842915
http://m.blog.csdn.net/article/details?id=51693586
这两篇文章说的比较好了,但是并没有对void setMode ( int code,int uid,String packageName,int mode)的
参数有具体的说明
code代表具体的操作权限,mode代表要更改成的类型(允许/禁止/提示)
具体权限对应的code,可以查看AppOpsManager.java源码里的描述。
好吧,又找源码,如下
http://tools.oesf.biz/android-4.3.0_r2.1/xref/frameworks/base/core/java/android/app/AppOpsManager.java
public static final int MODE_ALLOWED = 0;
59 public static final int MODE_IGNORED = 1;
60 public static final int MODE_ERRORED = 2;
61
62 // when adding one of these:
63 // - increment _NUM_OP
64 // - add rows to sOpToSwitch, sOpNames, sOpPerms
65 // - add descriptive strings to Settings/res/values/arrays.xml
66 public static final int OP_NONE = -1;
67 public static final int OP_COARSE_LOCATION = 0;
68 public static final int OP_FINE_LOCATION = 1;
69 public static final int OP_GPS = 2;
70 public static final int OP_VIBRATE = 3;
71 public static final int OP_READ_CONTACTS = 4;
72 public static final int OP_WRITE_CONTACTS = 5;
73 public static final int OP_READ_CALL_LOG = 6;
74 public static final int OP_WRITE_CALL_LOG = 7;
75 public static final int OP_READ_CALENDAR = 8;
76 public static final int OP_WRITE_CALENDAR = 9;
77 public static final int OP_WIFI_SCAN = 10;
78 public static final int OP_POST_NOTIFICATION = 11;
79 public static final int OP_NEIGHBORING_CELLS = 12;
80 public static final int OP_CALL_PHONE = 13;
81 public static final int OP_READ_SMS = 14;
82 public static final int OP_WRITE_SMS = 15;
83 public static final int OP_RECEIVE_SMS = 16;
84 public static final int OP_RECEIVE_EMERGECY_SMS = 17;
85 public static final int OP_RECEIVE_MMS = 18;
86 public static final int OP_RECEIVE_WAP_PUSH = 19;
87 public static final int OP_SEND_SMS = 20;
88 public static final int OP_READ_ICC_SMS = 21;
89 public static final int OP_WRITE_ICC_SMS = 22;
90 public static final int OP_WRITE_SETTINGS = 23;
91 public static final int OP_SYSTEM_ALERT_WINDOW = 24;
92 public static final int OP_ACCESS_NOTIFICATIONS = 25;
93 public static final int OP_CAMERA = 26;
94 public static final int OP_RECORD_AUDIO = 27;
95 public static final int OP_PLAY_AUDIO = 28;
96 public static final int OP_READ_CLIPBOARD = 29;
97 public static final int OP_WRITE_CLIPBOARD = 30;
98 /** @hide */
99 public static final int _NUM_OP = 31;
100
101 /**
102 * This maps each operation to the operation that serves as the
103 * switch to determine whether it is allowed. Generally this is
104 * a 1:1 mapping, but for some things (like location) that have
105 * multiple low-level operations being tracked that should be
106 * presented to hte user as one switch then this can be used to
107 * make them all controlled by the same single operation.
108 */
109 private static int[] sOpToSwitch = new int[] {
110 OP_COARSE_LOCATION,
111 OP_COARSE_LOCATION,
112 OP_COARSE_LOCATION,
113 OP_VIBRATE,
114 OP_READ_CONTACTS,
115 OP_WRITE_CONTACTS,
116 OP_READ_CALL_LOG,
117 OP_WRITE_CALL_LOG,
118 OP_READ_CALENDAR,
119 OP_WRITE_CALENDAR,
120 OP_COARSE_LOCATION,
121 OP_POST_NOTIFICATION,
122 OP_COARSE_LOCATION,
123 OP_CALL_PHONE,
124 OP_READ_SMS,
125 OP_WRITE_SMS,
126 OP_READ_SMS,
127 OP_READ_SMS,
128 OP_READ_SMS,
129 OP_READ_SMS,
130 OP_WRITE_SMS,
131 OP_READ_SMS,
132 OP_WRITE_SMS,
133 OP_WRITE_SETTINGS,
134 OP_SYSTEM_ALERT_WINDOW,
135 OP_ACCESS_NOTIFICATIONS,
136 OP_CAMERA,
137 OP_RECORD_AUDIO,
138 OP_PLAY_AUDIO,
139 OP_READ_CLIPBOARD,
140 OP_WRITE_CLIPBOARD,
141 };
Android新权限机制 AppOps的更多相关文章
- Android Notification和权限机制探讨
近期为了在部门内做一次小型的技术分享.深入了解了一下Notification的实现原理.以及android的权限机制.在此做个记录.文章可能比較长,没耐心的话就直接看题纲吧. 先看一下以下两张图 图一 ...
- Android安全机制(2) Android Permission权限控制机制
http://blog.csdn.net/vshuang/article/details/44001661 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] 1.概述 Andro ...
- 谈一谈 Android 的安全机制?
1.Android 是基于 Linux 内核的,因此 Linux 对文件权限的控制同样适用于 Android,在 Android 中每个应用都有自己的/data/data/包名 文件夹,该文件夹只能该 ...
- Android 开发 权限管理
Android 开发 权限管理 https://sspai.com/post/42779 $ adb shell pm list permissions -d -g https://zhuanlan. ...
- Android权限管理之Permission权限机制及使用
前言: 最近突然喜欢上一句诗:"宠辱不惊,看庭前花开花落:去留无意,望天空云卷云舒." 哈哈~,这个和今天的主题无关,最近只要不学习总觉得生活中少了点什么,所以想着围绕着最近面试过 ...
- Android权限机制
Android系统是运行在Linux内核上的,Android与Linux分别有自己的一套严格的安全及权限机制, 很多像我这样的新手,尤其是习惯了windows低安全限制的用户,很容易在这方面弄混淆,下 ...
- 【原创】源码角度分析Android的消息机制系列(一)——Android消息机制概述
ι 版权声明:本文为博主原创文章,未经博主允许不得转载. 1.为什么需要Android的消息机制 因为Android系统不允许在子线程中去访问UI,即Android系统不允许在子线程中更新UI. 为什 ...
- Android进阶之光-第1章-Android新特性-读书笔记
第 1 章 Android 新特性 1.1 Android 5.0 新特性 1.1.1 Android 5.0 主要新特性 1. 全新的 Material Design 新风格 Material De ...
- 【朝花夕拾】Android性能篇之(六)Android进程管理机制
前言 Android系统与其他操作系统有个很不一样的地方,就是其他操作系统尽可能移除不再活动的进程,从而尽可能保证多的内存空间,而Android系统却是反其道而行之,尽可能保留进程.An ...
随机推荐
- C#高级编程笔记 Delegate 的粗浅理解 2016年9月 13日
Delegate [重中之重] 委托 定义一:(参考)http://www.cnblogs.com/zhangchenliang/archive/2012/09/19/2694430.html 完全可 ...
- 深入Nginx
Nginx功能模块汇总 --with-http_core_module #包括一些核心的http参数配置,对应nginx的配置为http区块部分 --with-http_access_module # ...
- c#接口
//接口中方法 属性 事件等默认都是public 不允许用修饰符修饰 public interface IEventInterFace { string this[int index] { get; ...
- jquery ajax 请求参数详细说明 及 实例
url: 要求为String类型的参数,(默认为当前页地址)发送请求的地址. type: 要求为String类型的参数,请求方式(post或get)默认为get.注意其他http请求方法,例如put和 ...
- ABAP 分货日报表
*&---------------------------------------------------------------------* *& Report ZSDR031 ...
- 根据字体计算CGRect
UILabel *label = [[UILabel alloc]init]; label.numberOfLines = ;//多行显示 label.backgroundColor = [UICol ...
- execl表格VLOOKUP函数的使用
使用场景:最近在处理一个表格数据的时候出现了一点麻烦.想把另外表2里面对应的的数据放到表1里面,本来表2的ID是乱序的(这里为好看,就顺序排了.),一个个查找复制粘贴比较麻烦,后经大师指点VLOOKU ...
- 【Java EE 学习 16 上】【dbcp数据库连接池】【c3p0数据库连接池】
一.回顾之前使用的动态代理的方式实现的数据库连接池: 代码: package day16.utils; import java.io.IOException; import java.lang.ref ...
- Andriod学习笔记1:代码优化总结1
多行变一行 比如说开发一个简单的计算器应用程序,需要定义0-9的数字按钮,第一次就习惯性地写出了如下代码: Button btn0; Button btn1; Button btn2; Button ...
- 【淘淘】Quartz作业存储与管理
一.Quartz作业管理和存储方式简介: 作业一旦被调度,调度器需要记住并且跟踪作业和它们的执行次数.如果你的作业是30分钟后或每30秒调用,这不是很有用.事实上,作业执行需要非常准确和即时调用在被调 ...