From 07215350f97c46b3c74d0d8757ec12ea61ced258 Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 23 Jun 2016 11:19:28 -0700 Subject: [PATCH] HUN: Close RemoteInputView when Home is pressed CLOSE_SYSTEM_DIALOGS usually dismisses the notification shade, but that's not the case for HUNs because the shade is not actually open. However, CLOSE_SYSTEM_DIALOGS will now close the Direct Reply even with HUNs. Change-Id: If8e5115e33f93db0f8b4e442331ea3d60fc0c63d Fixes: 29583313 --- .../statusbar/RemoteInputController.java | 22 +++++++++++++++++++ .../statusbar/phone/PhoneStatusBar.java | 3 +++ 2 files changed, 25 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java b/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java index 5fea674f47b1f..6cbaceaa00ff1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java @@ -130,6 +130,28 @@ public class RemoteInputController { } } + public void closeRemoteInputs() { + if (mOpen.size() == 0) { + return; + } + + // Make a copy because closing the remote inputs will modify mOpen. + ArrayList list = new ArrayList<>(mOpen.size()); + for (int i = mOpen.size() - 1; i >= 0; i--) { + NotificationData.Entry item = mOpen.get(i).get(); + if (item != null && item.row != null) { + list.add(item); + } + } + + for (int i = list.size() - 1; i >= 0; i--) { + NotificationData.Entry item = list.get(i); + if (item.row != null) { + item.row.closeRemoteInput(); + } + } + } + public interface Callback { default void onRemoteInputActive(boolean active) {} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 8201b06428e0f..f7b258f62f098 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -3351,6 +3351,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, String action = intent.getAction(); if (Intent.ACTION_CLOSE_SYSTEM_DIALOGS.equals(action)) { KeyboardShortcuts.dismiss(); + if (mRemoteInputController != null) { + mRemoteInputController.closeRemoteInputs(); + } if (isCurrentProfile(getSendingUserId())) { int flags = CommandQueue.FLAG_EXCLUDE_NONE; String reason = intent.getStringExtra("reason");