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
This commit is contained in:
Gustav Sennton
2019-04-02 15:10:00 +01:00
parent 2a127a77fe
commit f29f2d4ada

View File

@@ -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);