Open luxiaogang1993 opened 4 years ago
由 'com.yanzhenjie:permission:2.0.3'androidx版本回退到support:2.0.1'版本无此问题出现,流程正常
+1 测试环境:Android10 三星s9+ targetSDK28 在手动关闭应用程序发送通知的权限后,调用该库去申请发送通知的权限,跳转时崩溃!
调用样式
AndPermission.with(this)
.notification()
.permission()
.rationale(new Rationale<Void>()
{
@Override
public void showRationale(Context context, Void data, RequestExecutor executor)
{
executor.execute();
}
})
.onGranted(new Action<Void>()
{
@Override
public void onAction(Void data)
{
showShortToast("已授权");
}
})
.onDenied(new Action<Void>()
{
@Override
public void onAction(Void data)
{
ToastUtils.showShort("已拒绝");
}
})
.start();
日志如下
2020-03-12 10:25:44.085 8871-8871/com.lwkandroid.app.dev E/ActivityThread: Activity com.sources.javacode.project.splash.SplashActivity has leaked IntentReceiver com.yanzhenjie.permission.bridge.Messenger@ea9b7e3 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Activity com.sources.javacode.project.splash.SplashActivity has leaked IntentReceiver com.yanzhenjie.permission.bridge.Messenger@ea9b7e3 that was originally registered here. Are you missing a call to unregisterReceiver()?
at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1707)
at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1438)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1577)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1550)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1538)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:641)
at com.yanzhenjie.permission.bridge.Messenger.register(Messenger.java:45)
at com.yanzhenjie.permission.bridge.RequestExecutor.run(RequestExecutor.java:47)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
2020-03-12 10:25:44.087 8871-8871/com.lwkandroid.app.dev E/ActivityThread: Activity com.sources.javacode.project.splash.SplashActivity has leaked ServiceConnection com.yanzhenjie.permission.bridge.RequestExecutor$1@e96400c that was originally bound here
android.app.ServiceConnectionLeaked: Activity com.sources.javacode.project.splash.SplashActivity has leaked ServiceConnection com.yanzhenjie.permission.bridge.RequestExecutor$1@e96400c that was originally bound here
at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1924)
at android.app.LoadedApk.getServiceDispatcherCommon(LoadedApk.java:1796)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1775)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1793)
at android.app.ContextImpl.bindService(ContextImpl.java:1722)
at android.content.ContextWrapper.bindService(ContextWrapper.java:719)
at com.yanzhenjie.permission.bridge.RequestExecutor.run(RequestExecutor.java:52)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
+1android10直接崩溃了
+1 测试环境:Android10 三星s9+ targetSDK28 在手动关闭应用程序发送通知的权限后,调用该库去申请发送通知的权限,跳转时崩溃!
调用样式
AndPermission.with(this) .notification() .permission() .rationale(new Rationale<Void>() { @Override public void showRationale(Context context, Void data, RequestExecutor executor) { executor.execute(); } }) .onGranted(new Action<Void>() { @Override public void onAction(Void data) { showShortToast("已授权"); } }) .onDenied(new Action<Void>() { @Override public void onAction(Void data) { ToastUtils.showShort("已拒绝"); } }) .start();
日志如下
2020-03-12 10:25:44.085 8871-8871/com.lwkandroid.app.dev E/ActivityThread: Activity com.sources.javacode.project.splash.SplashActivity has leaked IntentReceiver com.yanzhenjie.permission.bridge.Messenger@ea9b7e3 that was originally registered here. Are you missing a call to unregisterReceiver()? android.app.IntentReceiverLeaked: Activity com.sources.javacode.project.splash.SplashActivity has leaked IntentReceiver com.yanzhenjie.permission.bridge.Messenger@ea9b7e3 that was originally registered here. Are you missing a call to unregisterReceiver()? at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:1707) at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:1438) at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1577) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1550) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1538) at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:641) at com.yanzhenjie.permission.bridge.Messenger.register(Messenger.java:45) at com.yanzhenjie.permission.bridge.RequestExecutor.run(RequestExecutor.java:47) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919) 2020-03-12 10:25:44.087 8871-8871/com.lwkandroid.app.dev E/ActivityThread: Activity com.sources.javacode.project.splash.SplashActivity has leaked ServiceConnection com.yanzhenjie.permission.bridge.RequestExecutor$1@e96400c that was originally bound here android.app.ServiceConnectionLeaked: Activity com.sources.javacode.project.splash.SplashActivity has leaked ServiceConnection com.yanzhenjie.permission.bridge.RequestExecutor$1@e96400c that was originally bound here at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1924) at android.app.LoadedApk.getServiceDispatcherCommon(LoadedApk.java:1796) at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1775) at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1793) at android.app.ContextImpl.bindService(ContextImpl.java:1722) at android.content.ContextWrapper.bindService(ContextWrapper.java:719) at com.yanzhenjie.permission.bridge.RequestExecutor.run(RequestExecutor.java:52) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)
楼主的问题没遇到过,层主的通知权限跳转闪退的问题倒是遇到了,根据楼主的思路比对了下 2.0.1 版本,发现把 BridgeActivity 的 case BridgeRequest.TYPE_NOTIFY: { 代码块里的 settingIntent.setData(Uri.fromParts("package", getPackageName(), null)); 注释掉即可以。
Activity ShareActivity has leaked ServiceConnection com.yanzhenjie.permission.bridge.RequestExecutor$1@f280b8d that was originally bound here android.app.ServiceConnectionLeaked: Activity ShareActivity has leaked ServiceConnection com.yanzhenjie.permission.bridge.RequestExecutor$1@f280b8d that was originally bound here at android.app.LoadedApk$ServiceDispatcher.(LoadedApk.java:1653)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1545)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1639)
at android.app.ContextImpl.bindService(ContextImpl.java:1591)
at android.content.ContextWrapper.bindService(ContextWrapper.java:695)
at com.yanzhenjie.permission.bridge.RequestExecutor.run(RequestExecutor.java:52)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
手机型号:OPPO PBCM30 | 华为荣耀 Android系统版本: Android8 targetSdkVersion:28 权限:Permissions.WRITE_EXTERNAL_STORAGE 点击某按钮,申请【WRITE_EXTERNAL_STORAGE】权限,执行相关分享file uri的操作时,未弹出申请权限框