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的更多相关文章

  1. Android Notification和权限机制探讨

    近期为了在部门内做一次小型的技术分享.深入了解了一下Notification的实现原理.以及android的权限机制.在此做个记录.文章可能比較长,没耐心的话就直接看题纲吧. 先看一下以下两张图 图一 ...

  2. Android安全机制(2) Android Permission权限控制机制

    http://blog.csdn.net/vshuang/article/details/44001661 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] 1.概述 Andro ...

  3. 谈一谈 Android 的安全机制?

    1.Android 是基于 Linux 内核的,因此 Linux 对文件权限的控制同样适用于 Android,在 Android 中每个应用都有自己的/data/data/包名 文件夹,该文件夹只能该 ...

  4. Android 开发 权限管理

    Android 开发 权限管理 https://sspai.com/post/42779 $ adb shell pm list permissions -d -g https://zhuanlan. ...

  5. Android权限管理之Permission权限机制及使用

    前言: 最近突然喜欢上一句诗:"宠辱不惊,看庭前花开花落:去留无意,望天空云卷云舒." 哈哈~,这个和今天的主题无关,最近只要不学习总觉得生活中少了点什么,所以想着围绕着最近面试过 ...

  6. Android权限机制

    Android系统是运行在Linux内核上的,Android与Linux分别有自己的一套严格的安全及权限机制, 很多像我这样的新手,尤其是习惯了windows低安全限制的用户,很容易在这方面弄混淆,下 ...

  7. 【原创】源码角度分析Android的消息机制系列(一)——Android消息机制概述

    ι 版权声明:本文为博主原创文章,未经博主允许不得转载. 1.为什么需要Android的消息机制 因为Android系统不允许在子线程中去访问UI,即Android系统不允许在子线程中更新UI. 为什 ...

  8. Android进阶之光-第1章-Android新特性-读书笔记

    第 1 章 Android 新特性 1.1 Android 5.0 新特性 1.1.1 Android 5.0 主要新特性 1. 全新的 Material Design 新风格 Material De ...

  9. 【朝花夕拾】Android性能篇之(六)Android进程管理机制

    前言        Android系统与其他操作系统有个很不一样的地方,就是其他操作系统尽可能移除不再活动的进程,从而尽可能保证多的内存空间,而Android系统却是反其道而行之,尽可能保留进程.An ...

随机推荐

  1. js 阻止事件冒泡

    function stopBubble(e) { //如果提供了事件对象,则这是一个非IE浏览器 if ( e && e.stopPropagation ) //因此它支持W3C的st ...

  2. Linux使用手册-时区和时间设置

    1. #vi /etc/sysconfig/clockZONE=”Asia/Shanghai”UTC=false2.#vi /usr/share/zoneinfo/Asia/Shanghai,如果结尾 ...

  3. js框架设计1.4类型判断

    这篇司徒大神介绍了很多js的 不靠谱类型判断.篇幅也是第一篇中最常的 ,经阅读后,以后一定要用框架的自带的类型判断,万万不可随便乱用js原生判断.

  4. MySQL5.6 PERFORMANCE_SCHEMA 说明

    背景: MySQL 5.5开始新增一个数据库:PERFORMANCE_SCHEMA,主要用于收集数据库服务器性能参数.并且库里表的存储引擎均为PERFORMANCE_SCHEMA,而用户是不能创建存储 ...

  5. OC编程之道-创建对象之生成器模式

    生成器模式也叫建造者模式,一般是用来构造复杂对象的一种模式.client(客户)-director(指导者)-builder(构造者)-product(产品). 生成器模式能帮助构建设计部件与表现的各 ...

  6. Effective Python2 读书笔记3

    Item 22: Prefer Helper Classes Over Bookkeeping with Dictionaries and Tuples For example, say you wa ...

  7. Python: zip函数

    zip函数接受任意多个(包括0个和1个)序列作为参数,返回一个tuple列表. 参考链接解释

  8. Spring 定时器Quartz的用法

    Spring定时器Quartz的用法也很简单,需要引入quartz-all-1.5.2.jar java代码如下: package com.coalmine.desktop; import java. ...

  9. MySql 连接字符串

    一.MySQL Connector/ODBC 2.50 (MyODBC 2.50)连接方式 1.本地数据库连接Driver={MySQL};Server=localhost;Option=16834; ...

  10. (转)nginx优化 实现10万并发访问量

    转自http://www.cnblogs.com/pricks/p/3837149.html 一般来说nginx配置文件中对优化比较有作用的为以下几项:worker_processes 8;1 ngi ...