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. PHP 变量声明的意义

    有人说,PHP是没有类型的语言,个人比较倾向于,PHP是弱类型的计算机脚本语言的说法. 计算机存储都是二进制的数据,要么是0,要么是1. 在抽象数据的过程中,是要有各种各样的标志位来识别数据. 虽然, ...

  2. start WampServer如何关闭浏览目录

    打开Httpd.conf IncludesNOEXEC Indexes 去掉这个代码就可以了

  3. Linux高并发机制——epoll模型

    epoll是一个特别重要的概念,常常用于处理服务端的并发问题.当服务端的在线人数越来越多,会导致系统资源吃紧,I/O效率越来越慢,这时候就应该考虑epoll了.epoll是Linux内核为处理大批句柄 ...

  4. jstl fortokens 分割字符串

    forTokens标签: forTokens标签用来截取字符串: 属性: * var :定义变量 * items :切分字符串 * begin :从哪开始 * end :到哪结束 * step :步长 ...

  5. ACM/ICPC 之 网络流-拆点构图(POJ2391)

    需要直接到达,因此源点经过三条边后必须要达到汇点,但为了保证网络流的正确性(路径可反悔),因此不可限制层次网络的最高层次为3,最好的方法既是让所有点拆分成两个点,一个点从汇点进入,一个点通向汇点,任意 ...

  6. OC编程之道-创建对象之工厂方法

    一 何为工厂方法模式?(what) 定义创建对象的接口,让子类决定实例化哪一个类,工厂方法是的一个类的实例化延迟到其子类. 工厂方法创建的对象拥有一组共同的行为,所以往类层次结构中引入新的具体产品并不 ...

  7. C#学习笔记---Dispose(),Finalize(),SuppressFinalize

    http://www.cnblogs.com/eddyshn/archive/2009/08/19/1549961.html 在.NET的对象中实际上有两个用于释放资源的函数:Dispose和Fina ...

  8. Google之Chromium浏览器源码学习——base公共通用库(三)

    本节将介绍base公共通用库中的containers,其包含堆栈.列表.集合.以及Most Recently Used cache(最近使用缓存模板). linked_list.h:一个简单的列表类型 ...

  9. PCA数据降维

    Principal Component Analysis 算法优缺点: 优点:降低数据复杂性,识别最重要的多个特征 缺点:不一定需要,且可能损失有用的信息 适用数据类型:数值型数据 算法思想: 降维的 ...

  10. ppt - 常规策划

    1 比较图2 progress3 目标 proposal4 market leadership5 分析 - 设计 - 开发 - 实施 - 评估6 innovation7 时间区间表述8 阶梯式9 主 ...