-
-
Notifications
You must be signed in to change notification settings - Fork 881
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
你觉得框架有什么不足之处?【必答】
首先感谢大佬辛苦维护此框架
private boolean isSupportRequestPermissionBySystem(Context context) {
try {
PermissionInfo permissionInfo = context.getPackageManager().getPermissionInfo(getPermissionName(), 0);
if (permissionInfo != null) {
final int protectionLevel;
if (PermissionVersion.isAndroid9()) {
protectionLevel = permissionInfo.getProtection();
} else {
protectionLevel = (permissionInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE);
}
return protectionLevel == PermissionInfo.PROTECTION_DANGEROUS;
}
} catch (PackageManager.NameNotFoundException e) {
// 没有这个权限时会抛出:android.content.pm.PackageManager$NameNotFoundException: com.android.permission.GET_INSTALLED_APPS
e.printStackTrace();
}
try {
// 移动终端应用软件列表权限实施指南:http://www.taf.org.cn/upload/AssociationStandard/TTAF%20108-2022%20%E7%A7%BB%E5%8A%A8%E7%BB%88%E7%AB%AF%E5%BA%94%E7%94%A8%E8%BD%AF%E4%BB%B6%E5%88%97%E8%A1%A8%E6%9D%83%E9%99%90%E5%AE%9E%E6%96%BD%E6%8C%87%E5%8D%97.pdf
// 这是兜底方案,因为测试了大量的机型,除了荣耀的 Magic UI 有按照这个规范去做,其他厂商(包括华为的 HarmonyOS)都没有按照这个规范去做
// 虽然可以只用上面那种判断权限是不是危险权限的方式,但是避免不了有的手机厂商用下面的这种,所以两种都写比较好,小孩子才做选择,大人我全都要
return Settings.Secure.getInt(context.getContentResolver(), "oem_installed_apps_runtime_permission_enable") == 1;
} catch (Settings.SettingNotFoundException e) {
// 没有这个系统属性时会抛出:android.provider.Settings$SettingNotFoundException: oem_installed_apps_runtime_permission_enable
e.printStackTrace();
}
return false;
}
在我的应用中,用户只要从后台切换回来,就会刷新一遍所有权限,这样可以及时同步权限状态
而框架的源码中含有 printStackTrace 导致每次获取状态都会输出大量的文本污染日志控制台
可否直接注释这两个 printStackTrace ,或缓存值别每次检测就导致控制台一堆日志就行
issue 是否有人曾提过类似的建议?【必答】
否
框架文档是否提及了该问题【必答】
否
是否已经查阅框架文档但还未能解决的【必答】
是
你觉得该怎么去完善会比较好?【非必答】
No response
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed