Skip to content

Commit

Permalink
fix: Null object on getOpsForPackage()
Browse files Browse the repository at this point in the history
Change-Id: Ib620cecff4e1dc6bf6783041b514633b375eac80
  • Loading branch information
XayahSuSuSu committed Nov 3, 2024
1 parent 31c1a78 commit 08b31d2
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,11 @@ internal class RemoteRootServiceImpl : IRemoteRootService.Stub() {
val packageName = packageInfo.packageName
val requestedPermissions = packageInfo.requestedPermissions?.toList() ?: listOf()
val requestedPermissionsFlags = packageInfo.requestedPermissionsFlags?.toList() ?: listOf()
val ops = appOpsManager.getOpsForPackage(uid, packageName, null).getOrNull(0)?.ops?.associate {
it.op to it.mode
}
val ops = runCatching {
appOpsManager.getOpsForPackage(uid, packageName, null).getOrNull(0)?.ops?.associate {
it.op to it.mode
}
}.getOrNull()
requestedPermissions.forEachIndexed { i, name ->
runCatching {
val permissionInfo = packageManager.getPermissionInfo(name, 0)
Expand Down

0 comments on commit 08b31d2

Please sign in to comment.