Skip to content
Open
5 changes: 4 additions & 1 deletion permission_handler_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## 13.0.2

- Adds support for USE_FULL_SCREEN_INTENT permission check on Android 14+

## 13.0.1

* fix: Resolve `PermissionRequestInProgressException` when app is relaunched with non-standard launchMode.
- fix: Resolve `PermissionRequestInProgressException` when app is relaunched with non-standard launchMode.

## 13.0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ final class PermissionConstants {
static final int PERMISSION_CODE_REQUEST_INSTALL_PACKAGES = 212;
static final int PERMISSION_CODE_ACCESS_NOTIFICATION_POLICY = 213;
static final int PERMISSION_CODE_SCHEDULE_EXACT_ALARM = 214;
static final int PERMISSION_CODE_USE_FULL_SCREEN_INTENT = 215;


// PERMISSION_GROUP
Expand Down Expand Up @@ -62,6 +63,7 @@ final class PermissionConstants {
static final int PERMISSION_GROUP_CALENDAR_FULL_ACCESS = 37;
static final int PERMISSION_GROUP_ASSISTANT = 38;
static final int PERMISSION_GROUP_BACKGROUND_REFRESH = 39;
static final int PERMISSION_GROUP_USE_FULL_SCREEN_INTENT = 40;

@Retention(RetentionPolicy.SOURCE)
@IntDef({
Expand Down Expand Up @@ -101,6 +103,8 @@ final class PermissionConstants {
PERMISSION_GROUP_CALENDAR_WRITE_ONLY,
PERMISSION_GROUP_CALENDAR_FULL_ACCESS,
PERMISSION_GROUP_ASSISTANT,
PERMISSION_GROUP_BACKGROUND_REFRESH,
PERMISSION_GROUP_USE_FULL_SCREEN_INTENT,
})
@interface PermissionGroup {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,16 @@ public boolean onRequestPermissionsResult(
requestResults.put(
permission,
determinePermissionStatus(permission));
} else if (permission == PermissionConstants.PERMISSION_GROUP_USE_FULL_SCREEN_INTENT) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
int status = notificationManager.canUseFullScreenIntent()
? PermissionConstants.PERMISSION_STATUS_GRANTED
: PermissionConstants.PERMISSION_STATUS_DENIED;
requestResults.put(permission, status);
} else {
requestResults.put(permission, PermissionConstants.PERMISSION_STATUS_GRANTED);
}
} else if (!requestResults.containsKey(permission)) {
requestResults.put(
permission,
Expand Down Expand Up @@ -422,6 +432,10 @@ void requestPermissions(
} else {
requestResults.put(permission, PermissionConstants.PERMISSION_STATUS_DENIED);
}
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && permission == PermissionConstants.PERMISSION_GROUP_USE_FULL_SCREEN_INTENT) {
launchSpecialPermission(
Settings.ACTION_MANAGE_APP_USE_FULL_SCREEN_INTENT,
PermissionConstants.PERMISSION_CODE_USE_FULL_SCREEN_INTENT);
} else {
permissionsToRequest.addAll(names);
pendingRequestCount += names.size();
Expand Down Expand Up @@ -566,7 +580,17 @@ private int determinePermissionStatus(final @PermissionConstants.PermissionGroup
}else {
permissionStatuses.add(PermissionUtils.determineDeniedVariant(activity, name));
}
}else {
} else if (permission == PermissionConstants.PERMISSION_GROUP_USE_FULL_SCREEN_INTENT) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
int status = notificationManager.canUseFullScreenIntent()
? PermissionConstants.PERMISSION_STATUS_GRANTED
: PermissionConstants.PERMISSION_STATUS_DENIED;
permissionStatuses.add(status);
} else {
permissionStatuses.add(PermissionConstants.PERMISSION_STATUS_GRANTED);
}
} else {
final int permissionStatus = ContextCompat.checkSelfPermission(context, name);
if (permissionStatus != PackageManager.PERMISSION_GRANTED) {
permissionStatuses.add(PermissionUtils.determineDeniedVariant(activity, name));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ static int parseManifestName(String permission) {
return PermissionConstants.PERMISSION_GROUP_AUDIO;
case Manifest.permission.SCHEDULE_EXACT_ALARM:
return PermissionConstants.PERMISSION_GROUP_SCHEDULE_EXACT_ALARM;
case Manifest.permission.USE_FULL_SCREEN_INTENT:
return PermissionConstants.PERMISSION_GROUP_USE_FULL_SCREEN_INTENT;
default:
return PermissionConstants.PERMISSION_GROUP_UNKNOWN;
}
Expand Down Expand Up @@ -354,6 +356,11 @@ static List<String> getManifestNames(Context context, @PermissionConstants.Permi
if (hasPermissionInManifest(context, permissionNames, Manifest.permission.SCHEDULE_EXACT_ALARM))
permissionNames.add(Manifest.permission.SCHEDULE_EXACT_ALARM);
break;
case PermissionConstants.PERMISSION_GROUP_USE_FULL_SCREEN_INTENT:
// The USE_FULL_SCREEN_INTENT permission is introduced in Android UPSIDE_DOWN_CAKE, before Android 34 it should alway return Granted
if (hasPermissionInManifest(context, permissionNames, Manifest.permission.USE_FULL_SCREEN_INTENT))
permissionNames.add(Manifest.permission.USE_FULL_SCREEN_INTENT);
break;
case PermissionConstants.PERMISSION_GROUP_MEDIA_LIBRARY:
case PermissionConstants.PERMISSION_GROUP_REMINDERS:
case PermissionConstants.PERMISSION_GROUP_UNKNOWN:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@
<!-- Permissions options for the `alarm` group -->
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

<!-- Permissions options for the `use full screen intent` group -->
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />

<application
android:name="${applicationName}"
Expand Down
2 changes: 1 addition & 1 deletion permission_handler_android/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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: 13.0.1
version: 13.0.2

environment:
sdk: ^3.5.0
Expand Down
4 changes: 4 additions & 0 deletions permission_handler_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.3.1

- Adds support for USE_FULL_SCREEN_INTENT permission check on Android 14+

## 4.3.0

- Updates project dependencies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ class Permission {
/// Permission for reading the current background refresh status. (iOS only)
static const backgroundRefresh = Permission._(39);

/// Permission for allowing full screen on the device for alarms and calls
///
/// Android 14+ (API 34+)
static const fullScreen = Permission._(40);

/// Returns a list of all possible [PermissionGroup] values.
static const List<Permission> values = <Permission>[
// ignore: deprecated_member_use_from_same_package
Expand Down Expand Up @@ -369,6 +374,7 @@ class Permission {
calendarFullAccess,
assistant,
backgroundRefresh,
fullScreen,
];

static const List<String> _names = <String>[
Expand Down Expand Up @@ -412,6 +418,7 @@ class Permission {
'calendarFullAccess',
'assistant',
'backgroundRefresh',
'fullScreen',
];

@override
Expand Down
2 changes: 1 addition & 1 deletion permission_handler_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A common platform interface for the permission_handler plugin.
homepage: https://github.com/baseflow/flutter-permission-handler/tree/master/permission_handler_platform_interface
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 4.3.0
version: 4.3.1

environment:
sdk: ^3.5.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ void main() {
test('Permission has the right amount of possible Permission values', () {
const values = Permission.values;

expect(values.length, 40);
expect(values.length, 41);
});

test('check if byValue returns corresponding Permission value', () {
Expand Down
Loading