Filter out ACTION_UP events in onKey() listener.

Previously we invokes performeSave both for ACTION_DOWN and ACTION_UP,
thus it creates two documents.

Change-Id: I7fc2a62c34fc239c2bf3ca6c71122e360d589727
Fixes: 28179791
diff --git a/src/com/android/documentsui/SaveFragment.java b/src/com/android/documentsui/SaveFragment.java
index f3b750a..d830c61 100644
--- a/src/com/android/documentsui/SaveFragment.java
+++ b/src/com/android/documentsui/SaveFragment.java
@@ -84,6 +84,13 @@
                 new View.OnKeyListener() {
                     @Override
                     public boolean onKey(View v, int keyCode, KeyEvent event) {
+                        // Only handle key-down events. This is simpler, consistent with most other
+                        // UIs, and enables the handling of repeated key events from holding down a
+                        // key.
+                        if (event.getAction() != KeyEvent.ACTION_DOWN) {
+                            return false;
+                        }
+
                         if (keyCode == KeyEvent.KEYCODE_ENTER && mSave.isEnabled()) {
                             performSave();
                             return true;