summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Joanne Chung <joannechung@google.com> 2022-12-22 08:18:14 +0000
committer Joanne Chung <joannechung@google.com> 2022-12-22 12:44:23 +0000
commitfdca2fb83b3ca3a1ce842fd10c595bf2199ff08b (patch)
tree6090ac44b05a794d5250095462b66646d9a59100
parent0a30707b174266d6df859d7a61e449eea9b31ab2 (diff)
Do not dismiss session ui if the close dialog reason is assist
When assistant is launched from the hardware button, it will try to close system dialog with assist reason and launch a new UI again. From the current logic, the voice system service doesn't filter the assist reason to hide itself. If the session already exists, it will hide itself and get another onShow immediately. This causes unnecessary ui animations for hide/show from the user perspective. To fix it, this change will filter the assist reason to hide the session. Bug: 257275314 Test: atest CtsVoiceInteractionTestCases Test: use hotware button to trigger assistant and monitor the animation status Change-Id: Ibe636ad0b6776a1dbdf7f709a9ef5e804c6b015a
-rw-r--r--services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
index f041adcc7d77..964328271866 100644
--- a/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
+++ b/services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java
@@ -22,6 +22,8 @@ import static android.app.ActivityManager.START_VOICE_HIDDEN_SESSION;
import static android.app.ActivityManager.START_VOICE_NOT_ACTIVE_SESSION;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
+import static com.android.server.policy.PhoneWindowManager.SYSTEM_DIALOG_REASON_ASSIST;
+
import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -62,6 +64,7 @@ import android.service.voice.IVoiceInteractionSession;
import android.service.voice.VoiceInteractionService;
import android.service.voice.VoiceInteractionServiceInfo;
import android.system.OsConstants;
+import android.text.TextUtils;
import android.util.PrintWriterPrinter;
import android.util.Slog;
import android.view.IWindowManager;
@@ -118,7 +121,9 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(intent.getAction())) {
String reason = intent.getStringExtra("reason");
- if (!CLOSE_REASON_VOICE_INTERACTION.equals(reason) && !"dream".equals(reason)) {
+ if (!CLOSE_REASON_VOICE_INTERACTION.equals(reason)
+ && !TextUtils.equals("dream", reason)
+ && !SYSTEM_DIALOG_REASON_ASSIST.equals(reason)) {
synchronized (mServiceStub) {
if (mActiveSession != null && mActiveSession.mSession != null) {
try {