小米权限测试

##AndPermission+AppOpsManager

AppOpsCode

API25:
 /**
   * Result from {@link #checkOp}, {@link #noteOp}, {@link #startOp}: the given caller is
   * allowed to perform the given operation.
   */
  public static final int MODE_ALLOWED = 0;

  /**
   * Result from {@link #checkOp}, {@link #noteOp}, {@link #startOp}: the given caller is
   * not allowed to perform the given operation, and this attempt should
   * <em>silently fail</em> (it should not cause the app to crash).
   */
  public static final int MODE_IGNORED = 1;

  /**
   * Result from {@link #checkOpNoThrow}, {@link #noteOpNoThrow}, {@link #startOpNoThrow}: the
   * given caller is not allowed to perform the given operation, and this attempt should
   * cause it to have a fatal error, typically a {@link SecurityException}.
   */
  public static final int MODE_ERRORED = 2;

  /**
   * Result from {@link #checkOp}, {@link #noteOp}, {@link #startOp}: the given caller should
   * use its default security check.  This mode is not normally used; it should only be used
   * with appop permissions, and callers must explicitly check for it and deal with it.
   */
  public static final int MODE_DEFAULT = 3;

小米MAX2 7.1.1 25

储存权限

禁止时
AndPermission返回false 
op->android:read_external_storage
AppOpsCode->0 
AndPermission申请权限弹不出来,没有失败或者成功回调

允许时
AndPermission返回true
op->android:read_external_storage
AppOpsCode->0
流程正确

询问时
AndPermission返回false 
op->android:read_external_storage
AppOpsCode->0 
AndPermission申请权限可以弹出来,拒绝时走onfailed方法
拒绝一次后,
AndPermission返回false 
op->android:read_external_storage
AppOpsCode->0 
AndPermission申请权限可以弹出来,带有不再提示的选项,拒绝时走onfailed方法
拒绝2次后,这次选中了不再提示,权限管理中心直接变为禁止状态,和禁止状态一样。
AndPermission返回false 
op->android:read_external_storage
AppOpsCode->0 
AndPermission申请权限弹不出来,没有失败或者成功回调

位置权限

禁止时
AndPermission返回false 
op->android:read_external_storage
AppOpsCode->0 
AndPermission申请权限弹不出来,没有失败或者成功回调

允许时
AndPermission返回true
op->android:read_external_storage
AppOpsCode->0
流程正确

询问时
AndPermission返回false 
op->android:read_external_storage
AppOpsCode->0 
AndPermission申请权限可以弹出来,拒绝时走onfailed方法
拒绝一次后,
AndPermission返回false 
op->android:read_external_storage
AppOpsCode->0 
AndPermission申请权限可以弹出来,带有不再提示的选项,拒绝时走onfailed方法
拒绝2次后,这次选中了不再提示,权限管理中心直接变为禁止状态,和禁止状态一样。
AndPermission返回false 
op->android:read_external_storage
AppOpsCode->0 
AndPermission申请权限弹不出来,没有失败或者成功回调    

小米2 5.0.2 21

储存权限

不需要申请

位置权限

允许时
AndPermission返回true
AppOpsCode->0
流程正确

禁止时
AndPermission返回true
AppOpsCode->1
此时请求权限,返回请求成功,实际没有

询问时
 AndPermission返回true
 AppOpsCode->4
 此时请求权限,返回请求成功,实际没有