computePermissionStatus
fun computePermissionStatus(granted: Boolean, hasRequested: Boolean, shouldShowRationale: Boolean): PermissionStatus(source)
Pure classifier for a runtime permission's UX state. Kept platform-agnostic and side-effect-free so it can be unit-tested in commonTest without an Android Activity.
Invariant: hasRequested MUST reflect a completed request — it should be persisted from the launcher's result callback, never merely when launch() is invoked. On Android, launch() does not show a dialog once a permission is permanently denied, and a user can background the app before a dialog resolves; setting the flag pre-emptively would misclassify a first-run user as PERMANENTLY_DENIED.
Note that shouldShowRationale is false both before the first prompt and after a permanent denial — which is exactly why hasRequested is required to disambiguate the two cases.