Fix nullability for UserManager in AOSP build (#646)

This commit is contained in:
Torsten Grote 2024-04-16 15:42:29 -03:00 committed by GitHub
parent c8d21fcf34
commit 11fbd450da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -312,7 +312,7 @@ internal class MetadataManager(
private fun getUserName(): String? {
val perm = "android.permission.QUERY_USERS"
return if (context.checkSelfPermission(perm) == PERMISSION_GRANTED) {
val userManager = context.getSystemService(UserManager::class.java)
val userManager = context.getSystemService(UserManager::class.java) ?: return null
userManager.userName
} else null
}