OSDN Git Service

Add basic inversion lock detection to DPMS.
authorMakoto Onuki <omakoto@google.com>
Tue, 13 Mar 2018 21:22:23 +0000 (14:22 -0700)
committerMakoto Onuki <omakoto@google.com>
Wed, 4 Apr 2018 19:18:54 +0000 (12:18 -0700)
commiteed5b5a31c21811feda3fb621572efba642455be
tree8a9cae332965d11c838627fc193efcecfa1ade79
parenta926126a8bc89c1a6bd7fa8a76332476eba0d954
Add basic inversion lock detection to DPMS.

For now enable it on ENG builds only.
(I'll change the condition in master so I'll get WTFs from qt-release devices
too.)

This will detect calling into DPMS with the following locks held:

APP_OPS
POWER
USER
PACKAGES
STORAGE
WINDOW
ACTIVITY
DPMS

On marlin-eng pi-dev, each guard() takes ~25us.
    LockGuard.guard(): count=7246, total=175.1ms, avg=0.024ms

Used the following command to ensure all locks are replaced.
$ grep synchronized /android/pi-dev/frameworks/base/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | sed -e 's/  *//' | uniq

Bug: 74553426
Test: Manual test with an intentional lock inversion.
Change-Id: Id59d562d7c275b6ea127a211284496f5d64f9f93
services/core/java/com/android/server/LockGuard.java
services/core/java/com/android/server/ThreadPriorityBooster.java
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java