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

  1. PhoneWindowManager.java is responsible for all power button presses (see interceptPowerKeyDown).
  2. 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.
  3. 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).
  4. Inside SystemUI, onEmergencyActionLaunchGestureDetected and determines
    1. If the gesture is enabled (else do nothing)
    2. If there is an app to handle the gesture (else do nothing)
    3. whether the screen is on; if not, we need to delay until that happens
  5. Assuming there is an app, and the setting is one launch Emergengy Flow immediately. Callsite
    1. 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.