Skip to content
Commit 51802b36 authored by Kweku Adams's avatar Kweku Adams
Browse files

Avoid lock inversion.

The PowerManager lock (which is used in the Battery Saver code) sits
low in the lock hierarchy. NotificationManagerService is higher, so
nothing should call into NotificationManagerService with the
PowerManager lock held. This change calls into NMS on a background
thread so that the call occurs without the PM lock held.

Also fixing the cancel notification bug. We create the notifications
using notifyAsUser(... UserHandle.ALL). The cancel() call wasn't
properly dismissing the notification. Switching to
cancelAsUser(UserHandle.ALL) fixes the issue.

Bug: 145886051
Test: atest BatterySaverStateMachineTest
Test: Manually ensure notification disappears when BS turns on
Change-Id: I3315357e810d92938e4a34929235d233b07deebb
(cherry picked from commit 79a0faf8)
parent cb0b5e20
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment