diff options
| author | 2022-05-10 15:10:51 +0100 | |
|---|---|---|
| committer | 2022-05-13 19:53:43 +0100 | |
| commit | c558857fc7fda905b56fbc6c57b80c0336ad3dcf (patch) | |
| tree | b00bc8cded2f6628d21959747939feac1485e917 /libs/androidfw/StringPool.cpp | |
| parent | c9daa03269935ea5b36f7abf4b7bbda0a287afcf (diff) | |
Check sleep reason and time before cancelling vibrations
Add a method PowerManagerInternal.getLastGoToSleep(), similar to
existing method getLastWakeup(), to retrieve global values for last go
to sleep events, including system uptime and reason.
Retrieve this data in VibratorManagerService before cancelling ongoing
vibrations by the broadcast of ACTION_SCREEN_OFF intents to indicate
that the screen was turned of when the vibration was still playing. This
new logic allows vibrations to continue in the following cases:
- the broadcasted event was triggered before the vibration started;
- there is already a wakeup event triggered by the time the screen off
broadcast is being processed by the vibrator service;
- the screen off reason is in allowlist, indicating it's an
automatically triggered event (screen timeout or user inattentive);
This should handle the following scenarios:
- delayed broadcasts of screen off events, that should not cancel
vibrations that started when the screen was already off (e.g.
notification or ringtone that are allowed to vibrate in that state);
- race conditions when the screen automatically turns off right after a
ringtone/notification vibration starts, before the notification
acquires a screen lock;
Fix: 219849350
Test: VibrationSettingsTest
Change-Id: I358327192196989a7d4fc49a96b2ab92ec677302
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions