{"action":"opened","issue":{"url":"https://api.github.com/repos/yanzhenjie/AndPermission/issues/254","repository_url":"https://api.github.com/repos/yanzhenjie/AndPermission","labels_url":"https://api.github.com/repos/yanzhenjie/AndPermission/issues/254/labels{/name}","comments_url":"https://api.github.com/repos/yanzhenjie/AndPermission/issues/254/comments","events_url":"https://api.github.com/repos/yanzhenjie/AndPermission/issues/254/events","html_url":"https://github.com/yanzhenjie/AndPermission/issues/254","id":319516085,"number":254,"title":"target版本 22,Android系统8.0.0权限判断问题","user":{"login":"xiuxiuing","id":8773887,"avatar_url":"https://avatars3.githubusercontent.com/u/8773887?v=4","gravatar_id":"","url":"https://api.github.com/users/xiuxiuing","html_url":"https://github.com/xiuxiuing","followers_url":"https://api.github.com/users/xiuxiuing/followers","following_url":"https://api.github.com/users/xiuxiuing/following{/other_user}","gists_url":"https://api.github.com/users/xiuxiuing/gists{/gist_id}","starred_url":"https://api.github.com/users/xiuxiuing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiuxiuing/subscriptions","organizations_url":"https://api.github.com/users/xiuxiuing/orgs","repos_url":"https://api.github.com/users/xiuxiuing/repos","events_url":"https://api.github.com/users/xiuxiuing/events{/privacy}","received_events_url":"https://api.github.com/users/xiuxiuing/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-02T11:34:24Z","updated_at":"2018-05-02T11:34:24Z","closed_at":null,"author_association":"NONE","body":"target 22的APP，系统会默认授予Manifest中的权限，但是用户可以手动关闭权限，手动关闭权限后，判断权限错误。\r\npublic final boolean isShowRationalePermission(String permission) {\r\n        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return false;\r\n\r\n        PackageManager packageManager = getContext().getPackageManager();\r\n        Class<?> pkManagerClass = packageManager.getClass();\r\n        try {\r\n            Method method = pkManagerClass.getMethod(\"shouldShowRequestPermissionRationale\", String.class);\r\n            if (!method.isAccessible()) method.setAccessible(true);\r\n            return (boolean) method.invoke(packageManager, permission);\r\n        } catch (Exception ignored) {\r\n            return false;\r\n        }\r\n    }\r\n\r\n这个判断缺少了target版本的判断，如果target版本为22，系统版本大于23，是不会触发动态请求权限的，所以方法shouldShowRequestPermissionRationale 一直返回false，导致权限判断错误。"}}
{"actor":{"display_login":"xiuxiuing"}}