Merge "DirectReply: Send button was wrongly actionable on empty field" into nyc-dev
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 f3033cd..a855aed 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java
@@ -91,8 +91,6 @@
         mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
             @Override
             public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
-
-                // Check if this was the result of hitting the enter key
                 final boolean isSoftImeEvent = event == null
                         && (actionId == EditorInfo.IME_ACTION_DONE
                         || actionId == EditorInfo.IME_ACTION_NEXT
@@ -102,7 +100,10 @@
                         && event.getAction() == KeyEvent.ACTION_DOWN;
 
                 if (isSoftImeEvent || isKeyboardEnterKey) {
-                    sendRemoteInput();
+                    if (mEditText.length() > 0) {
+                        sendRemoteInput();
+                    }
+                    // Consume action to prevent IME from closing.
                     return true;
                 }
                 return false;