How 5-tapping power launches Emergency Sos
as of Jan 2021
Note that the flow is a simplified version of the camera launch flow.
Sequence of events
- PhoneWindowManager.java is responsible for all power button presses (see
interceptPowerKeyDown
). - Even though PWMgr has a lot of logic to detect all manner of power button multipresses and gestures, it also checks with GestureLauncherService, which is also offered the chance to intercept the power key.
- GLS is responsible for the emergoncy sos timeout, and if it detects one, it forwards it to the StatusBarManagerService (which hands it off to SystemUI).
- Inside SystemUI, onEmergencyActionLaunchGestureDetected and determines
- If the gesture is enabled (else do nothing)
- If there is an app to handle the gesture (else do nothing)
- whether the screen is on; if not, we need to delay until that happens
- Assuming there is an app, and the setting is one launch Emergengy Flow immediately. Callsite
- Note that we cannot have an intent resolver, so we launch the default.
Which intent launches?
Due to the nature of the gesture, we need the flow to work behind the lockscreen, and without disambiguation. Thus, we always launch the same intent, and verify that there is only one matching intent-filter in the system image.
The emergengy sos intent action.