From 8b2184e882128e05de361285e314a9ea1aab6690 Mon Sep 17 00:00:00 2001 From: Zhanty Date: Wed, 3 Jul 2019 15:09:07 +0800 Subject: [PATCH] optimize permission requester --- .../com/android/base/permission/PermissionCallerImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_base/src/main/java/com/android/base/permission/PermissionCallerImpl.java b/lib_base/src/main/java/com/android/base/permission/PermissionCallerImpl.java index bff3ffb..7b5ebad 100644 --- a/lib_base/src/main/java/com/android/base/permission/PermissionCallerImpl.java +++ b/lib_base/src/main/java/com/android/base/permission/PermissionCallerImpl.java @@ -71,8 +71,12 @@ class PermissionCallerImpl implements EasyPermissions.PermissionCaller { getPermissionUIProvider() .showAskAgainDialog(mContextWrapper.getContext(), perms.toArray(new String[0]), (dialog, which) -> { - Intent intentForPermission = EasyPermissions.getIntentForPermission(mContextWrapper.getContext()); - mContextWrapper.startActivityForResult(intentForPermission, REQUEST_PERMISSION_FOR_SETTING, null); + try { + Intent intentForPermission = EasyPermissions.getIntentForPermission(mContextWrapper.getContext()); + mContextWrapper.startActivityForResult(intentForPermission, REQUEST_PERMISSION_FOR_SETTING, null); + } catch (Exception e) { + notifyPermissionDenied(perms); + } }, (dialog, which) -> notifyPermissionDenied(perms)); } else {