문제

I'm looking for the implementation in the Android source on how the power button is mapped to turning the screen off. I am working on a custom ROM and am trying to find the relationship between the two events (short key press and screen turning off). I am finding that the screen state changes in frameworks/base/services/java/com/android/server/PowerManagerService.java, but I don't see anything related to the power button itself.

Thank you for your help.

도움이 되었습니까?

해결책

Look in com.android.internal.policy.impl.WindowManagerPolicy.java. This handles dispatching of key events to the appropriate place and also provides custom handling of the power button.

In particular, you might be interested in interceptKeyBeforeQueueing(), or just search for KEYCODE_POWER.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top