Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d88a2b33 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB][Chips] Allow timer chips to count down to a time in the future.

The current timer chip implementation only counts up from a time in the
past, and it shows 00:00 if the time is in the future. But apps could
also set their notification time to be in the future and  set
`isCountDown=true`, meaning that they want the notification UI to count
down to that future time.

This CL implements that behavior for both non-Compose chips and Compose
chips. I don't expect a lot of apps to use this feature, but we should
have it in case. The Compose implementation is slightly better (if the
duration would be negative, we hide it), but the non-Compose
implementation works just like normal notifications so I think it's okay
since we plan to launch the Compose chips at the same time as the
notification chips.

Fixes: 400786236
Fixes: 401464026
Bug: 364653005
Flag: com.android.systemui.status_bar_notification_chips

Test: Post notif with `when` 15 seconds in the future,
showsChronomter=true, isCountDown=true ->
  - ChipMod on:  chip counts down from 00:15, 00:14, ... 00:00,
                 then hides the text.
  - ChipMod off: chip counts down from 00:15, 00:14, ... 00:00 ->
                 -00:01, -00:02, ...
Test: Post notif with `when` 15 seconds in the future,
showsChronometer=true, isCountDown=false ->
  - ChipMod on:  chip shows nothing for 15 seconds, then starts showing
                 00:00, 00:01, etc.
  - ChipMod off: chip show -00:15, -00:14, ... 00:00, 00:01 ...

Test: Post notif with `when` 15 seconds in the past,
showChronometer=true, isCountDown=true ->
  - ChipMod on:  chip never shows any text
  - ChipMod off: chip shows -00:15, -00:16, ...
Test: Post notif with `when` 15 seconds in the past,
showChronometer=true, isCountDown=false ->
  - ChipMod on:  chip starts at 00:15 and counts up with 00:16, 00:17...
  - ChipMod off: chip starts at 00:15 and counts up with 00:16, 00:17...

Test: atest ChronometerStateTest NotifChipsViewModelTest
Test: Test the above with ChipsModernization both off and on

Change-Id: I20d1cf44e5ae2937ac64ceacb7ea045b9fe9989d
parent 91a4647e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment