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
3 files changed