Skip to content

Commit

Permalink
新增支持权限设置页面跳转兜底机制
Browse files Browse the repository at this point in the history
优化后台定位权限和后台传感器权限被拒绝后的提示文案
优化 android 11 及以上的 miui 设备跳转到悬浮窗授权页面逻辑
兼容 android 6.0 以下的设备申请悬浮窗权限
兼容 android 6.0 以下的设备跳转悬浮窗权限申请页面
兼容 miui 13 以下的设备申请读取应用列表权限
修正通知栏权限在 Android 5.0 的设备跳转到应用详情页面的问题
修正 targetSdk >= 33 申请读取外部存储权限的向下兼容判断
修正 android 10 及以下设备申请所有文件管理权限会多弹出一个对话框的问题
修复权限检测机制中的清单文件权限检测逻辑的 Bug
修复通知栏监听权限对应 Service 类名被修改后仍然授权的 Bug
修复鸿蒙 2.0 及以上设备跳转到勿扰模式设置界面会出现崩溃的 Bug
修复 PermissionUtils 判断 Activity 意图是否存在在某些手机会出现误判的问题
  • Loading branch information
getActivity committed Apr 9, 2023
1 parent 25a9ce2 commit e79b1f3
Show file tree
Hide file tree
Showing 33 changed files with 1,609 additions and 408 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_en_template_bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ assignees: getActivity

* Whether the problem can be reproduced [Required]: Yes/No

* Android Project targetSdkVersion [Required]: Please fill in your project target sdk version

* Phone information in question [Required]: Please fill in the phone brand and model in question

* Android version in question [Required]: Please fill in the Android version in question
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_zh_template_bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ assignees: getActivity

* 是否必现【必填】:是/否

* 项目 targetSdkVersion【必填】:XX

* 出现问题的手机信息【必填】:请填写出现问题的品牌和机型

* 出现问题的安卓版本【必填】:请填写出现问题的 Android 版本
Expand Down
8 changes: 4 additions & 4 deletions README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

* project address: [Github](https://github.com/getActivity/XXPermissions)

* [Click here to download demo apk directly](https://github.com/getActivity/XXPermissions/releases/download/16.8/XXPermissions.apk)
* [Click here to download demo apk directly](https://github.com/getActivity/XXPermissions/releases/download/18.0/XXPermissions.apk)

![](picture/en/demo_request_permission_activity.jpg) ![](picture/en/demo_request_single_permission.jpg) ![](picture/en/demo_request_group_permission.jpg)

Expand Down Expand Up @@ -55,7 +55,7 @@ android {
dependencies {
// Permission request framework:https://github.com/getActivity/XXPermissions
implementation 'com.github.getActivity:XXPermissions:16.8'
implementation 'com.github.getActivity:XXPermissions:18.0'
}
```

Expand Down Expand Up @@ -209,9 +209,9 @@ XXPermissions.setInterceptor(new IPermissionInterceptor() {});

| Adaptation details | [XXPermissions](https://github.com/getActivity/XXPermissions) | [AndPermission](https://github.com/yanzhenjie/AndPermission) | [PermissionX](https://github.com/guolindev/PermissionX) | [AndroidUtilCode-PermissionUtils](https://github.com/Blankj/AndroidUtilCode) | [PermissionsDispatcher](https://github.com/permissions-dispatcher/PermissionsDispatcher) | [RxPermissions](https://github.com/tbruyelle/RxPermissions) | [EasyPermissions](https://github.com/googlesamples/easypermissions) |
| :-----------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------: |
| Corresponding version | 16.8 | 2.0.3 | 1.7.1 | 1.31.0 | 4.9.2 | 0.12 | 3.0.0 |
| Corresponding version | 18.0 | 2.0.3 | 1.7.1 | 1.31.0 | 4.9.2 | 0.12 | 3.0.0 |
| Number of issues | [![](https://img.shields.io/github/issues/getActivity/XXPermissions.svg)](https://github.com/getActivity/XXPermissions/issues) | [![](https://img.shields.io/github/issues/yanzhenjie/AndPermission.svg)](https://github.com/yanzhenjie/AndPermission/issues) | [![](https://img.shields.io/github/issues/guolindev/PermissionX.svg)](https://github.com/guolindev/PermissionX/issues) | [![](https://img.shields.io/github/issues/Blankj/AndroidUtilCode.svg)](https://github.com/Blankj/AndroidUtilCode/issues) | [![](https://img.shields.io/github/issues/permissions-dispatcher/PermissionsDispatcher.svg)](https://github.com/permissions-dispatcher/PermissionsDispatcher/issues) | [![](https://img.shields.io/github/issues/tbruyelle/RxPermissions.svg)](https://github.com/tbruyelle/RxPermissions/issues) | [![](https://img.shields.io/github/issues/googlesamples/easypermissions.svg)](https://github.com/googlesamples/easypermissions/issues) |
| Framework volume | 60 KB | 127 KB | 97 KB | 500 KB | 99 KB | 28 KB | 48 KB |
| Framework volume | 82 KB | 127 KB | 97 KB | 500 KB | 99 KB | 28 KB | 48 KB |
| Framework Maintenance Status | **In maintenance** | stop maintenance | **In maintenance** | stop maintenance | stop maintenance | stop maintenance | stop maintenance |
| Alarm reminder permission ||||||||
| All file management permissions ||||||||
Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

* 博文地址:[一句代码搞定权限请求,从未如此简单](https://www.jianshu.com/p/c69ff8a445ed)

* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/XXPermissions/releases/download/16.8/XXPermissions.apk)
* 可以扫码下载 Demo 进行演示或者测试,如果扫码下载不了的,[点击此处可直接下载](https://github.com/getActivity/XXPermissions/releases/download/18.0/XXPermissions.apk)

![](picture/zh/download_demo_apk_qr_code.png)

Expand Down Expand Up @@ -61,7 +61,7 @@ android {
dependencies {
// 权限请求框架:https://github.com/getActivity/XXPermissions
implementation 'com.github.getActivity:XXPermissions:16.8'
implementation 'com.github.getActivity:XXPermissions:18.0'
}
```

Expand Down Expand Up @@ -215,9 +215,9 @@ XXPermissions.setInterceptor(new IPermissionInterceptor() {});

| 适配细节 | [XXPermissions](https://github.com/getActivity/XXPermissions) | [AndPermission](https://github.com/yanzhenjie/AndPermission) | [PermissionX](https://github.com/guolindev/PermissionX) | [AndroidUtilCode-PermissionUtils](https://github.com/Blankj/AndroidUtilCode) | [PermissionsDispatcher](https://github.com/permissions-dispatcher/PermissionsDispatcher) | [RxPermissions](https://github.com/tbruyelle/RxPermissions) | [EasyPermissions](https://github.com/googlesamples/easypermissions) |
| :--------: | :------------: | :------------: | :------------: | :------------: | :------------: | :------------: | :------------: |
| 对应版本 | 16.8 | 2.0.3 | 1.7.1 | 1.31.0 | 4.9.2 | 0.12 | 3.0.0 |
| 对应版本 | 18.0 | 2.0.3 | 1.7.1 | 1.31.0 | 4.9.2 | 0.12 | 3.0.0 |
| issues 数 | [![](https://img.shields.io/github/issues/getActivity/XXPermissions.svg)](https://github.com/getActivity/XXPermissions/issues) | [![](https://img.shields.io/github/issues/yanzhenjie/AndPermission.svg)](https://github.com/yanzhenjie/AndPermission/issues) | [![](https://img.shields.io/github/issues/guolindev/PermissionX.svg)](https://github.com/guolindev/PermissionX/issues) | [![](https://img.shields.io/github/issues/Blankj/AndroidUtilCode.svg)](https://github.com/Blankj/AndroidUtilCode/issues) | [![](https://img.shields.io/github/issues/permissions-dispatcher/PermissionsDispatcher.svg)](https://github.com/permissions-dispatcher/PermissionsDispatcher/issues) | [![](https://img.shields.io/github/issues/tbruyelle/RxPermissions.svg)](https://github.com/tbruyelle/RxPermissions/issues) | [![](https://img.shields.io/github/issues/googlesamples/easypermissions.svg)](https://github.com/googlesamples/easypermissions/issues) |
| 框架体积 | 60 KB | 127 KB | 97 KB | 500 KB | 99 KB | 28 KB | 48 KB |
| 框架体积 | 82 KB | 127 KB | 97 KB | 500 KB | 99 KB | 28 KB | 48 KB |
| 框架维护状态 |**维护中**| 停止维护 | 停止维护 | 停止维护 | 停止维护 | 停止维护 | 停止维护 |
| 闹钟提醒权限 ||||||||
| 所有文件管理权限 ||||||||
Expand Down Expand Up @@ -269,7 +269,9 @@ XXPermissions.setInterceptor(new IPermissionInterceptor() {});
| 奇虎 | 360 手机 N7 Lite | 360 Os 3.0 && Android 8.1 ||
| 小辣椒 | 小辣椒S6 | 小辣椒 Os 3.0 && Android 7.1.1 ||

* 另外还有一些厂商没有列出来,不是我没有做测试,而是他们的系统本身就是直接用 Android 的,Android 原生目前不支持申请该权限
* 还有一些厂商没有列出来,并不是作者没有做测试,而是他们的系统本身就是直接用 Android 的,Android 原生目前不支持申请该权限

* 另外对于 miui 的设备,这套机制只支持 miui 13 及以上的版本,但是框架做了一些兼容手段,目前已经适配了所有 miui 版本读取应用列表权限的申请

#### 新权限自动兼容旧设备介绍

Expand Down Expand Up @@ -407,6 +409,8 @@ XXPermissions.setInterceptor(new IPermissionInterceptor() {});

* 表情包大集合:[EmojiPackage](https://github.com/getActivity/EmojiPackage) ![](https://img.shields.io/github/stars/getActivity/EmojiPackage.svg) ![](https://img.shields.io/github/forks/getActivity/EmojiPackage.svg)

* AI 资源大汇总:[AiIndex](https://github.com/getActivity/AiIndex) ![](https://img.shields.io/github/stars/getActivity/AiIndex.svg) ![](https://img.shields.io/github/forks/getActivity/AiIndex.svg)

* 省市区 Json 数据:[ProvinceJson](https://github.com/getActivity/ProvinceJson) ![](https://img.shields.io/github/stars/getActivity/ProvinceJson.svg) ![](https://img.shields.io/github/forks/getActivity/ProvinceJson.svg)

* Markdown 语法文档:[MarkdownDoc](https://github.com/getActivity/MarkdownDoc) ![](https://img.shields.io/github/stars/getActivity/MarkdownDoc.svg) ![](https://img.shields.io/github/forks/getActivity/MarkdownDoc.svg)
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.hjq.permissions.demo"
minSdkVersion 16
targetSdkVersion 33
versionCode 1680
versionName "16.8"
versionCode 1800
versionName "18.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -61,7 +61,7 @@ dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'

// 吐司框架:https://github.com/getActivity/Toaster
implementation 'com.github.getActivity:Toaster:12.0'
implementation 'com.github.getActivity:Toaster:12.2'

// 内存泄漏检测:https://github.com/square/leakcanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
<service
android:name=".NotificationMonitorService"
android:exported="false"
android:process=":test"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" >
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,20 @@ public final class NotificationMonitorService extends NotificationListenerServic
@Override
public void onNotificationPosted(StatusBarNotification sbn) {
super.onNotificationPosted(sbn);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Bundle extras = sbn.getNotification().extras;
if (extras != null) {
//获取通知消息标题
String title = extras.getString(Notification.EXTRA_TITLE);
// 获取通知消息内容
Object msgText = extras.getCharSequence(Notification.EXTRA_TEXT);
Toaster.show(String.format(getString(R.string.demo_notification_listener_toast), title, msgText));
}
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}

Bundle extras = sbn.getNotification().extras;
if (extras == null) {
return;
}

//获取通知消息标题
String title = extras.getString(Notification.EXTRA_TITLE);
// 获取通知消息内容
Object msgText = extras.getCharSequence(Notification.EXTRA_TEXT);
Toaster.show(String.format(getString(R.string.demo_notification_listener_toast), title, msgText));
}

/**
Expand Down
Loading

0 comments on commit e79b1f3

Please sign in to comment.