From 4c1d687b1cee0ac3ec99765d7e7f0788578ad2ae Mon Sep 17 00:00:00 2001 From: Steve Elliott Date: Tue, 15 Mar 2022 16:19:39 -0400 Subject: [PATCH] Fix incorrect RemoteInput result source Conditional was accidentally flipped in a previous change. This change also de-dupes the problematic code. Test: atest RemoteInputViewTest Fixes: 224824265 Change-Id: I75fc4b77ea76b9166df0ef4f54a27d0381ba492a --- .../statusbar/policy/RemoteInputViewController.kt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputViewController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputViewController.kt index bd878750dfe16..f8451017b367b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputViewController.kt @@ -299,10 +299,7 @@ class RemoteInputViewControllerImpl @Inject constructor( view.clearAttachment() entry.remoteInputUri = null entry.remoteInputMimeType = null - val resultSource = entry.editedSuggestionInfo - ?.let { RemoteInput.SOURCE_FREE_FORM_INPUT } - ?: RemoteInput.SOURCE_CHOICE - RemoteInput.setResultsSource(fillInIntent, resultSource) + RemoteInput.setResultsSource(fillInIntent, remoteInputResultsSource) return fillInIntent } @@ -332,10 +329,12 @@ class RemoteInputViewControllerImpl @Inject constructor( entry.remoteInputText = fullText // mirror prepareRemoteInputFromText for text input - val resultSource = entry.editedSuggestionInfo - ?.let { RemoteInput.SOURCE_FREE_FORM_INPUT } - ?: RemoteInput.SOURCE_CHOICE - RemoteInput.setResultsSource(fillInIntent, resultSource) + RemoteInput.setResultsSource(fillInIntent, remoteInputResultsSource) return fillInIntent } + + private val remoteInputResultsSource + get() = entry.editedSuggestionInfo + ?.let { RemoteInput.SOURCE_CHOICE } + ?: RemoteInput.SOURCE_FREE_FORM_INPUT }