Ensure SysUI gets VIS callback when session's over

There are chances that SysUI does not get the
onVoiceSessionWindowVisibilityChanged(false) callback if the
voice interaction window was visible then the connection is closed.

This could cause issue for TaskBar since TaskBar relies on the callback
to clear its intermediate state.

Video: http://recall/-/b1EZhgUkQcpML5OwZekLBN/giEfwSaYA9saSOfGQwCAus
Bug: 254070601
Test: follow the reproduce steps in bug, see also video
Change-Id: I0222eea38179620c36253f47f332536ffb9e434c
This commit is contained in:
Hongwei Wang
2022-11-17 17:22:26 -08:00
parent d7f99f6c63
commit cabd5d5592
2 changed files with 5 additions and 0 deletions

View File

@@ -31,6 +31,8 @@
/**
* Called when a voice session window is shown/hidden.
* Caution that there could be duplicated visibility change callbacks, it's up to the listener
* to dedup those events.
*/
void onVoiceSessionWindowVisibilityChanged(boolean visible);

View File

@@ -880,5 +880,8 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
@Override
public void onSessionHidden(VoiceInteractionSessionConnection connection) {
mServiceStub.onSessionHidden();
// Notifies visibility change here can cause duplicate events, it is added to make sure
// client always get the callback even if session is unexpectedly closed.
mServiceStub.setSessionWindowVisible(connection.mToken, false);
}
}