From f29f2d4adab511e6b43ac05e32526274d9f26db2 Mon Sep 17 00:00:00 2001 From: Gustav Sennton Date: Tue, 2 Apr 2019 15:10:00 +0100 Subject: [PATCH] Tell the app that a smart reply was used even when it has been edited. The existing API RemoteInput.Source covers two scenarios for responding to message notifications: 1. A user uses the 'reply' button and enters a response freely. 2. A user clicks a smart reply which is used as the response. Before this CL the platform would notify the app of scenario nr. 1 in the case where we use tap-to-edit smart replies (replies that can be edited before being sent). With this CL we instead log scenario nr. 2 (since a smart reply was clicked). Bug: 123407240 Test: use a test-app to ensure that a response created using smart replies + tap-to-edit logs the correct @Source. Change-Id: I3dc8169a3c440af106c4f244b72ddf7c9e450203 --- .../android/systemui/statusbar/policy/RemoteInputView.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java index 1e090630efdb4..c1950a21d10fd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java @@ -146,7 +146,11 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene Intent fillInIntent = new Intent().addFlags(Intent.FLAG_RECEIVER_FOREGROUND); RemoteInput.addResultsToIntent(mRemoteInputs, fillInIntent, results); - RemoteInput.setResultsSource(fillInIntent, RemoteInput.SOURCE_FREE_FORM_INPUT); + if (mEntry.editedSuggestionInfo == null) { + RemoteInput.setResultsSource(fillInIntent, RemoteInput.SOURCE_FREE_FORM_INPUT); + } else { + RemoteInput.setResultsSource(fillInIntent, RemoteInput.SOURCE_CHOICE); + } mEditText.setEnabled(false); mSendButton.setVisibility(INVISIBLE);