Require calendar read permission when testing write permission

This commit is contained in:
M66B 2022-11-04 11:07:20 +01:00
parent ed0680089e
commit 86af30a1d6
1 changed files with 6 additions and 1 deletions

View File

@ -414,7 +414,12 @@ public class Helper {
// Features
static boolean hasPermission(Context context, String name) {
return (ContextCompat.checkSelfPermission(context, name) == PackageManager.PERMISSION_GRANTED);
if (Manifest.permission.WRITE_CALENDAR.equals(name))
if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_CALENDAR) !=
PackageManager.PERMISSION_GRANTED)
return false;
return (ContextCompat.checkSelfPermission(context, name) ==
PackageManager.PERMISSION_GRANTED);
}
static boolean hasPermissions(Context context, String[] permissions) {