From 39fba431428e5d82d35f4999663461468fe3a728 Mon Sep 17 00:00:00 2001 From: Victor Sanni Date: Fri, 16 Aug 2024 03:10:14 -0700 Subject: [PATCH] Add TargetApi annotation in PermissionUtils.java for Android (#1122) * added iOS imports * added java code style suggestions to PermissionUtils.java * fix PermissionHandlerEnums.h import in Codec.h * Edited pubspec.yaml and CHANGELOG.md files * Edited pubspec.yaml and CHANGELOG.md for android * fixed formatting error in android CHANGELOG * Remove iOS changes * Update CHANGELOG.md * Remove fall through comment in PermissionUtils.java --------- Co-authored-by: Maurits van Beusekom --- permission_handler_android/CHANGELOG.md | 5 ++++- .../java/com/baseflow/permissionhandler/PermissionUtils.java | 2 ++ permission_handler_android/pubspec.yaml | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/permission_handler_android/CHANGELOG.md b/permission_handler_android/CHANGELOG.md index acef5e6c3..c968f555e 100644 --- a/permission_handler_android/CHANGELOG.md +++ b/permission_handler_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 12.0.11 + +* Adds `TargetApi` annotation to `getManifestNames` method in `PermissionUtils.java`. + ## 12.0.10 * Fixes a bug that causes a `NullPointerException` when the application is restarted after being killed by Android during the request of special permissions (like, `Permission.ignoreBatteryOptimizations`, `Permission.systemAlertWindow`, `Permission.accessNotificationPolicy`, `Permission.scheduleExactAlarm` and `Permission.manageExternalStorage`). @@ -18,7 +22,6 @@ * Removes deprecated support for Android V1 embedding as support will be removed from Flutter (see [flutter/flutter#144726](https://github.com/flutter/flutter/pull/144726)). - ## 12.0.5 * Upgrades Gradle and Android Gradle plugin. diff --git a/permission_handler_android/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java b/permission_handler_android/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java index 888a3893e..c56bcfdfb 100644 --- a/permission_handler_android/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java +++ b/permission_handler_android/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java @@ -1,6 +1,7 @@ package com.baseflow.permissionhandler; import android.Manifest; +import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; @@ -99,6 +100,7 @@ static int parseManifestName(String permission) { } } + @TargetApi(22) static List getManifestNames(Context context, @PermissionConstants.PermissionGroup int permission) { final ArrayList permissionNames = new ArrayList<>(); diff --git a/permission_handler_android/pubspec.yaml b/permission_handler_android/pubspec.yaml index 502483c66..af0b79ba1 100644 --- a/permission_handler_android/pubspec.yaml +++ b/permission_handler_android/pubspec.yaml @@ -1,7 +1,7 @@ name: permission_handler_android description: Permission plugin for Flutter. This plugin provides the Android API to request and check permissions. homepage: https://github.com/baseflow/flutter-permission-handler -version: 12.0.10 +version: 12.0.11 environment: sdk: ">=2.15.0 <4.0.0"