Fix AndroidDeviceOwnerApi.getDelegations

This commit is contained in:
Jonas Lochmann 2023-02-13 01:00:00 +01:00
parent 178cb75795
commit 896cd6592d
No known key found for this signature in database
GPG key ID: 8B8C9AEE10FA5B36

View file

@ -87,9 +87,9 @@ class AndroidDeviceOwnerApi(
if (VERSION.SDK_INT <= VERSION_CODES.O) throw IllegalStateException() if (VERSION.SDK_INT <= VERSION_CODES.O) throw IllegalStateException()
return delegationList.map { (scope, delegation) -> return delegationList.map { (scope, delegation) ->
devicePolicyManager.getDelegatedScopes(componentName, scope).map { packageName -> devicePolicyManager.getDelegatePackages(componentName, scope)?.map { packageName ->
Pair(packageName, delegation) Pair(packageName, delegation)
} } ?: emptyList()
}.flatten().groupBy { it.first }.mapValues { entry -> }.flatten().groupBy { it.first }.mapValues { entry ->
entry.value.map { it.second } entry.value.map { it.second }
} }