Don't request ANSWER_PHONE_CALLS permission prior to Pie

Also invert the permission check condition
This commit is contained in:
xynngh 2020-01-24 13:24:05 +04:00
parent 88fba070b1
commit c190c9ec6f
1 changed files with 2 additions and 2 deletions

View File

@ -21,14 +21,14 @@ public class PermissionHelper {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
requiredPermissions.add(Manifest.permission.READ_CALL_LOG);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
requiredPermissions.add(Manifest.permission.ANSWER_PHONE_CALLS);
}
List<String> missingPermissions = new ArrayList<>();
for (String permission : requiredPermissions) {
if (ContextCompat.checkSelfPermission(activity, permission) == PackageManager.PERMISSION_DENIED) {
if (ContextCompat.checkSelfPermission(activity, permission) != PackageManager.PERMISSION_GRANTED) {
missingPermissions.add(permission);
}
}