From 3e0683ab7c85bc8d641687e41ffe01741032edb7 Mon Sep 17 00:00:00 2001 From: Matthew Fritze Date: Fri, 29 Jan 2021 11:07:17 -0800 Subject: [PATCH] Add SysUI docs for the emergengy gesture The docs are based off of camera.md. Test: Just regular reading Fixes: 169249551 Change-Id: I1c8d2b4aef50b11abba53277d8202444ddb05502 --- packages/SystemUI/docs/sos_gesture.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 packages/SystemUI/docs/sos_gesture.md diff --git a/packages/SystemUI/docs/sos_gesture.md b/packages/SystemUI/docs/sos_gesture.md new file mode 100644 index 0000000000000..1a9144bd7efb1 --- /dev/null +++ b/packages/SystemUI/docs/sos_gesture.md @@ -0,0 +1,26 @@ +# 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](/services/core/java/com/android/server/policy/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](/services/core/java/com/android/server/policy/PhoneWindowManager.java#943) to [intercept](/services/core/java/com/android/server/GestureLauncherService.java#358) the power key. +3. GLS is responsible for the emergoncy sos timeout, and if it detects one, it [forwards it to the StatusBarManagerService](/services/core/java/com/android/server/GestureLauncherService.java#475) (which hands it off to SystemUI). +4. Inside SystemUI, [onEmergencyActionLaunchGestureDetected](/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java#4039) and determines + 1. If the gesture is enabled (else do nothing) + 2. If there is an app to handle the gesture (else do nothing) + 2. 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](/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java#4077) + 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](packages/SystemUI/src/com/android/systemui/emergency/EmergencyGesture.java#36).