Commit ed5df6a5 by Maurits van Beusekom

Production version 4.2.0+hotfix.3

parents b195e3cd 6ee89511
## 4.2.0+hotfix.3
* Android: Fixes a bug which in some cases caused the permission `neverAskAgain` to be returned incorrectly.
## 4.2.0+hotfix.2 ## 4.2.0+hotfix.2
* Android: Fixes a bug where permissions are reported as `neverAskAgain` incorrectly after calling `requestPermissions` method. * Android: Fixes a bug where permissions are reported as `neverAskAgain` incorrectly after calling `requestPermissions` method.
......
...@@ -22,7 +22,7 @@ To use this plugin, add `permission_handler` as a [dependency in your pubspec.ya ...@@ -22,7 +22,7 @@ To use this plugin, add `permission_handler` as a [dependency in your pubspec.ya
```yaml ```yaml
dependencies: dependencies:
permission_handler: '^4.2.0+hotfix.2' permission_handler: '^4.2.0+hotfix.3'
``` ```
> **NOTE:** As of version 3.1.0 the permission_handler plugin switched to the AndroidX version of the Android Support Libraries. This means you need to make sure your Android project is also upgraded to support AndroidX. Detailed instructions can be found [here](https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility). > **NOTE:** As of version 3.1.0 the permission_handler plugin switched to the AndroidX version of the Android Support Libraries. This means you need to make sure your Android project is also upgraded to support AndroidX. Detailed instructions can be found [here](https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility).
......
...@@ -19,6 +19,7 @@ import android.telephony.TelephonyManager; ...@@ -19,6 +19,7 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationManagerCompat; import androidx.core.app.NotificationManagerCompat;
import io.flutter.plugin.common.PluginRegistry.ActivityResultListener; import io.flutter.plugin.common.PluginRegistry.ActivityResultListener;
...@@ -213,7 +214,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler { ...@@ -213,7 +214,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
private Map<Integer, Integer> mRequestResults = new HashMap<>(); private Map<Integer, Integer> mRequestResults = new HashMap<>();
@Override @Override
public void onMethodCall(MethodCall call, Result result) { public void onMethodCall(MethodCall call, @NonNull Result result) {
switch (call.method) { switch (call.method) {
case "checkPermissionStatus": { case "checkPermissionStatus": {
@PermissionGroup final int permission = (int) call.arguments; @PermissionGroup final int permission = (int) call.arguments;
...@@ -293,7 +294,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler { ...@@ -293,7 +294,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
// PowerManager.isIgnoringBatteryOptimizations has been included in Android M first. // PowerManager.isIgnoringBatteryOptimizations has been included in Android M first.
if (VERSION.SDK_INT >= VERSION_CODES.M) { if (VERSION.SDK_INT >= VERSION_CODES.M) {
if (pm.isIgnoringBatteryOptimizations(packageName)) { if (pm != null && pm.isIgnoringBatteryOptimizations(packageName)) {
return PERMISSION_STATUS_GRANTED; return PERMISSION_STATUS_GRANTED;
} else { } else {
return PERMISSION_STATUS_DENIED; return PERMISSION_STATUS_DENIED;
...@@ -344,7 +345,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler { ...@@ -344,7 +345,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
TelephonyManager telephonyManager = (TelephonyManager) context TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE); .getSystemService(Context.TELEPHONY_SERVICE);
if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) { if (telephonyManager == null || telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE) {
return SERVICE_STATUS_NOT_APPLICABLE; return SERVICE_STATUS_NOT_APPLICABLE;
} }
...@@ -426,7 +427,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler { ...@@ -426,7 +427,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
continue; continue;
} }
if (permission == PERMISSION_GROUP_IGNORE_BATTERY_OPTIMIZATIONS) { if (VERSION.SDK_INT >= VERSION_CODES.M && permission == PERMISSION_GROUP_IGNORE_BATTERY_OPTIMIZATIONS) {
String packageName = mRegistrar.context().getPackageName(); String packageName = mRegistrar.context().getPackageName();
Intent intent = new Intent(); Intent intent = new Intent();
intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
...@@ -461,7 +462,6 @@ public class PermissionHandlerPlugin implements MethodCallHandler { ...@@ -461,7 +462,6 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
continue; continue;
final int result = grantResults[i]; final int result = grantResults[i];
updatePermissionShouldShowStatus(permission);
if (permission == PERMISSION_GROUP_MICROPHONE) { if (permission == PERMISSION_GROUP_MICROPHONE) {
if (!mRequestResults.containsKey(PERMISSION_GROUP_MICROPHONE)) { if (!mRequestResults.containsKey(PERMISSION_GROUP_MICROPHONE)) {
...@@ -493,6 +493,8 @@ public class PermissionHandlerPlugin implements MethodCallHandler { ...@@ -493,6 +493,8 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
} else if (!mRequestResults.containsKey(permission)) { } else if (!mRequestResults.containsKey(permission)) {
mRequestResults.put(permission, toPermissionStatus(permission, result)); mRequestResults.put(permission, toPermissionStatus(permission, result));
} }
updatePermissionShouldShowStatus(permission);
} }
processResult(); processResult();
...@@ -637,7 +639,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler { ...@@ -637,7 +639,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
if (hasPermissionInManifest(Manifest.permission.USE_SIP)) if (hasPermissionInManifest(Manifest.permission.USE_SIP))
permissionNames.add(Manifest.permission.USE_SIP); permissionNames.add(Manifest.permission.USE_SIP);
if (hasPermissionInManifest(Manifest.permission.BIND_CALL_REDIRECTION_SERVICE)) if (VERSION.SDK_INT >= VERSION_CODES.Q && hasPermissionInManifest(Manifest.permission.BIND_CALL_REDIRECTION_SERVICE))
permissionNames.add(Manifest.permission.BIND_CALL_REDIRECTION_SERVICE); permissionNames.add(Manifest.permission.BIND_CALL_REDIRECTION_SERVICE);
if (VERSION.SDK_INT >= VERSION_CODES.O && hasPermissionInManifest(Manifest.permission.ANSWER_PHONE_CALLS)) if (VERSION.SDK_INT >= VERSION_CODES.O && hasPermissionInManifest(Manifest.permission.ANSWER_PHONE_CALLS))
...@@ -775,7 +777,6 @@ public class PermissionHandlerPlugin implements MethodCallHandler { ...@@ -775,7 +777,6 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
return isNeverAskAgainSelected; return isNeverAskAgainSelected;
} }
@SuppressWarnings("deprecation")
private boolean isLocationServiceEnabled(Context context) { private boolean isLocationServiceEnabled(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
final LocationManager locationManager = context.getSystemService(LocationManager.class); final LocationManager locationManager = context.getSystemService(LocationManager.class);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'permission_handler' s.name = 'permission_handler'
s.version = '4.2.0+hotfix.2' s.version = '4.2.0+hotfix.3'
s.summary = 'Permission plugin for Flutter.' s.summary = 'Permission plugin for Flutter.'
s.description = <<-DESC s.description = <<-DESC
Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions. Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
......
name: permission_handler name: permission_handler
description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions. description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
version: 4.2.0+hotfix.2 version: 4.2.0+hotfix.3
homepage: https://github.com/baseflowit/flutter-permission-handler homepage: https://github.com/baseflowit/flutter-permission-handler
environment: environment:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment