-
public class PermissionManager.Companion
-
-
Field Summary
Fields Modifier and Type Field Description public final static PermissionManager.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final BooleanisSupported(String type)Whether type is a supported permission type at all. final StringandroidPermission(String type, Integer sdkInt)The Android runtime permission string that MUST be granted for type, given sdkInt. final BooleannotificationGrantedWithoutPrompt(Integer sdkInt)Notification auth is granted without a prompt below API 33 (no runtime permission existed). final PermissionStatusmanifestGuardStatus(String type, Integer sdkInt, Function1<String, Boolean> permissionDeclared)Pure guard decision. final PermissionRouteDecisionroute(PermissionStatus status)Pure status → route mapping used by the pipeline. final BooleanisBlockedAfterDenial(Boolean granted, Boolean shouldShowRationale)Sticky-denied detection is post-request only: checkSelfPermission == DENIEDis identical for never-asked vs permanently-denied.-
-
Method Detail
-
isSupported
final Boolean isSupported(String type)
Whether type is a supported permission type at all.
-
androidPermission
final String androidPermission(String type, Integer sdkInt)
The Android runtime permission string that MUST be granted for type, given sdkInt. Returns
nullfor types that need no runtime permission on this API level:att— no Android equivalent (auto-granted no-op).notificationbelow API 33 — auto-granted (POST_NOTIFICATIONS didn't exist).unknown/unsupported types.
-
notificationGrantedWithoutPrompt
final Boolean notificationGrantedWithoutPrompt(Integer sdkInt)
Notification auth is granted without a prompt below API 33 (no runtime permission existed).
-
manifestGuardStatus
final PermissionStatus manifestGuardStatus(String type, Integer sdkInt, Function1<String, Boolean> permissionDeclared)
Pure guard decision. Returns PermissionStatus.UNAVAILABLE when the type is unsupported, or when it requires a runtime permission that is NOT declared in the host manifest. Returns
nullto mean "safe to proceed". Injectable permissionDeclared keeps this unit-testable.
-
route
final PermissionRouteDecision route(PermissionStatus status)
Pure status → route mapping used by the pipeline. Extracted for OS-free unit testing.
-
isBlockedAfterDenial
final Boolean isBlockedAfterDenial(Boolean granted, Boolean shouldShowRationale)
Sticky-denied detection is post-request only:
checkSelfPermission == DENIEDis identical for never-asked vs permanently-denied. After a launch returns denied,!shouldShowRationalemeans the OS won't prompt again → blocked (present the settings fallback). Pure + testable.
-
-
-
-