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 ...
随机推荐
- mysqldump
$ mysqldump -uroot -p ott_cibn_cms2_staging > /opt/app/ruby/ott-cibn-cms-2.0/current/public/db.sq ...
- php函数parse_url
1.需求 了解parse_url的使用方法 2.实例 $uri = parse_url('http://dummy'.$_SERVER['REQUEST_URI']); var_dump($uri); ...
- Gossip算法
Gossip算法因为Cassandra而名声大噪,Gossip看似简单,但要真正弄清楚其本质远没看起来那么容易.为了寻求Gossip的本质,下面的内容主要参考Gossip的原始论文:<<E ...
- 【krpano】高德地图导航插件(源码+介绍+预览)
简介 krpano可以利用js调用第三方网页版地图,因此可以实现导航效果,用来帮助用户导航到我们全景所在的位置. 效果截图如下,在手机端点击左侧按钮,便会对用户进行定位,跳转至高德地图进行导航 ...
- webstormkey
webStorm : UserName:William ===== LICENSE BEGIN ===== 45550-12042010 00001SzFN0n1bPII7FnAxnt0DDOPJA ...
- Javascript 执行环境及作用域
执行环境是javascript中最为重要的一个概念. 执行环境定义了变量或函数有权访问的其他数据,决定了他们各自的行为. 每个执行环境都有一个与之关联的变量对象(variable object),环境 ...
- UIPickerView选择器的使用方法
UIPickerView是选择列表内容的控件 使用方法与UITableView类似 都需要用array传入数据 用Delegate DataSource中的代理方法实现各种显示功能 @interfac ...
- Quartz资源收藏
项目中使用Quartz集群分享 : http://hot66hot.iteye.com/blog/1726143 发布 Quartz Job Scheduling Framework 中文 PDF 版 ...
- 统一配置管理-百度disconf
之前一直采用properties文件管理配置信息,若是集群则每个机器上都要拷贝一份,每次修改也需要依次修改.一直在寻找统一修改,实时生效,方便修改,分环境分系统的配置管理,自己也在整理设计,若找不到合 ...
- Linux设备模型(3)_Uevent
转自:http://www.wowotech.net/linux_kenrel/uevent.html 1. Uevent的功能 Uevent是Kobject的一部分,用于在Kobject状态发生改变 ...