Skip to content

fw/popups/phone_ui: fix call duration timer showing on unanswered calls#875

Open
spr4bhu wants to merge 1 commit intocoredevices:mainfrom
spr4bhu:call-duration-unanswered
Open

fw/popups/phone_ui: fix call duration timer showing on unanswered calls#875
spr4bhu wants to merge 1 commit intocoredevices:mainfrom
spr4bhu:call-duration-unanswered

Conversation

@spr4bhu
Copy link
Contributor

@spr4bhu spr4bhu commented Feb 21, 2026

This PR complements the mobileapp fix (coredevices/mobileapp#124) by adding guards against stale call_start_time values and explicit status text handling for all call end scenarios.

Changes:

  • Add call_start_time == 0 guard in prv_update_call_time() — if the timer callback fires after being stopped, it won't compute a duration from a stale timestamp
  • Reset call_start_time = 0 in prv_stop_call_duration_timer() — ensures no stale timestamp can persist after stopping the timer
  • Add CallStatus.ENDED enum and update prv_set_status_text() to explicitly handle ENDED — replaces the heuristic that used call_start_time to infer "Call Ended" vs "Call Declined"
  • Update phone_ui_handle_call_end() to use ENDED for unanswered calls (caller hangs up before answer) instead of DECLINED
  • Update phone_ui_handle_call_hide() for iOS unanswered calls to show "Call Ended" with proper end-of-call UI (icon, color, delay) instead of immediately popping the window

Closes #808

@spr4bhu spr4bhu force-pushed the call-duration-unanswered branch 2 times, most recently from dce19fe to 39343f8 Compare February 21, 2026 10:34
Copy link
Member

@gmarull gmarull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please, follow commit guidelines

Comment on lines 1192 to 1204
// Just pop the window - it'll handle all the cleanup
prv_window_pop();
if (!s_phone_ui_data) {
return;
}
prv_stop_ringing();
prv_stop_call_duration_timer();
prv_action_bar_setup(PhoneCallActions_None);
prv_set_icon_resource(TIMELINE_RESOURCE_DISMISSED_PHONE_CALL);
prv_set_window_color(DECLINE_COLOR, true);
prv_set_status_text(ENDED);
prv_window_pop_with_delay(CALL_END_DELAY_MS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks overcomplicated compared to the previous impl

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous phone_ui_handle_call_hide() just called prv_window_pop() which silently dismissed the UI with no status text or delay

I will simplify it to reuse the phone_ui_handle_call_end(bool call_accepted, bool disconnected) function

Comment on lines 1177 to 1188
if (call_accepted) {
prv_set_icon_resource(TIMELINE_RESOURCE_DURING_PHONE_CALL);
prv_set_window_color(ACCEPT_COLOR, true);
prv_set_status_text(ACCEPTED);
prv_set_status_text(ENDED);
} else {
prv_set_icon_resource(TIMELINE_RESOURCE_DISMISSED_PHONE_CALL);
prv_set_window_color(DECLINE_COLOR, true);
if (disconnected) {
prv_set_status_text(DISCONNECTED);
} else {
prv_set_status_text(DECLINED);
prv_set_status_text(ENDED);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both branches now set 'ENDED', code is hard to follow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both branches set ENDED because the status text is always 'Call Ended' regardless of whether the call was answered (The status appears on screen only when the call ends so ACCEPTED is the wrong thing to display)

the if else only controls the icon and colour

Signed-off-by: Shashvat Prabhu <shashvatprabhu2006@gmail.com>
@spr4bhu spr4bhu force-pushed the call-duration-unanswered branch from 39343f8 to 89483fc Compare February 23, 2026 11:22
@spr4bhu spr4bhu requested a review from gmarull February 23, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duration of not answered call is showing

2 participants