Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 73b6e120 authored by Hai Zhang's avatar Hai Zhang
Browse files

Reduce duplicate kill UID calls when granting multiple permissions with GIDs

Bug: 422318069
Flag: EXEMPT bug fix
Test: presubmit
Change-Id: I659c806f681893fe7f755ff88e4b4b37616077af
parent 48ea9ec9
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -2722,7 +2722,16 @@ class PermissionService(private val service: AccessCheckingService) :
            runtimePermissionRevokedUids.clear()

            gidsChangedUids.forEachIndexed { _, uid ->
                handler.post { killUid(uid, PermissionManager.KILL_APP_REASON_GIDS_CHANGED) }
                // We must pass a non-null object to avoid matching the true/false being used by
                // the code for runtimePermissionRevokedUids above.
                if (!handler.hasMessages(uid, 0)) {
                    handler
                        .obtainMessage(uid, 0)
                        .setCallback {
                            killUid(uid, PermissionManager.KILL_APP_REASON_GIDS_CHANGED)
                        }
                        .sendToTarget()
                }
            }
            gidsChangedUids.clear()