Snap for 5671254 from e678b83816cfe3922d49cce97062cca1e3249ed1 to qt-release

Change-Id: Ib89a7a6dd4a8afa5ff914e5be82124f1feaa168a
diff --git a/res/anim/progress_indeterminate_horizontal_rect1.xml b/res/anim/progress_indeterminate_horizontal_rect1.xml
new file mode 100644
index 0000000..4bca4e5
--- /dev/null
+++ b/res/anim/progress_indeterminate_horizontal_rect1.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="2000"
+        android:propertyXName="translateX"
+        android:pathData="M -522.59998,0 c 48.89972,0 166.02656,0 301.21729,0 c 197.58128,0 420.9827,0 420.9827,0 "
+        android:interpolator="@interpolator/progress_indeterminate_horizontal_rect1_translatex"
+        android:repeatCount="infinite" />
+    <objectAnimator
+        android:duration="2000"
+        android:propertyYName="scaleX"
+        android:pathData="M 0 0.1 L 1 0.826849212646 L 2 0.1"
+        android:interpolator="@interpolator/progress_indeterminate_horizontal_rect1_scalex"
+        android:repeatCount="infinite" />
+</set>
diff --git a/res/anim/progress_indeterminate_horizontal_rect2.xml b/res/anim/progress_indeterminate_horizontal_rect2.xml
new file mode 100644
index 0000000..ff1e67d
--- /dev/null
+++ b/res/anim/progress_indeterminate_horizontal_rect2.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android" >
+    <objectAnimator
+        android:duration="2000"
+        android:propertyXName="translateX"
+        android:pathData="M -197.60001,0 c 14.28182,0 85.07782,0 135.54689,0 c 54.26191,0 90.42461,0 168.24331,0 c 144.72154,0 316.40982,0 316.40982,0 "
+        android:interpolator="@interpolator/progress_indeterminate_horizontal_rect2_translatex"
+        android:repeatCount="infinite" />
+    <objectAnimator
+        android:duration="2000"
+        android:propertyYName="scaleX"
+        android:pathData="M 0.0,0.1 L 1.0,0.571379510698 L 2.0,0.909950256348 L 3.0,0.1"
+        android:interpolator="@interpolator/progress_indeterminate_horizontal_rect2_scalex"
+        android:repeatCount="infinite" />
+</set>
diff --git a/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml b/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml
index 070b9a1..a6668bc 100644
--- a/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml
+++ b/res/drawable/progress_indeterminate_horizontal_material_trimmed.xml
@@ -21,8 +21,8 @@
     android:drawable="@drawable/vector_drawable_progress_indeterminate_horizontal_trimmed" >
     <target
         android:name="rect2_grp"
-        android:animation="@*android:anim/progress_indeterminate_horizontal_rect2" />
+        android:animation="@anim/progress_indeterminate_horizontal_rect2" />
     <target
         android:name="rect1_grp"
-        android:animation="@*android:anim/progress_indeterminate_horizontal_rect1" />
+        android:animation="@anim/progress_indeterminate_horizontal_rect1" />
 </animated-vector>
diff --git a/res/interpolator/progress_indeterminate_horizontal_rect1_scalex.xml b/res/interpolator/progress_indeterminate_horizontal_rect1_scalex.xml
new file mode 100644
index 0000000..39efe84
--- /dev/null
+++ b/res/interpolator/progress_indeterminate_horizontal_rect1_scalex.xml
@@ -0,0 +1,17 @@
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0 0 L 0.3665 0 C 0.47252618112021,0.062409910275 0.61541608570164,0.5 0.68325,0.5 C 0.75475061236836,0.5 0.75725829093844,0.814510098964 1.0,1.0" />
diff --git a/res/interpolator/progress_indeterminate_horizontal_rect1_translatex.xml b/res/interpolator/progress_indeterminate_horizontal_rect1_translatex.xml
new file mode 100644
index 0000000..46e0777
--- /dev/null
+++ b/res/interpolator/progress_indeterminate_horizontal_rect1_translatex.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 L 0.2 0 C 0.3958333333336,0.0 0.474845090492,0.206797621729 0.5916666666664,0.417082932942 C 0.7151610251224,0.639379624869 0.81625,0.974556908664 1.0,1.0 " />
diff --git a/res/interpolator/progress_indeterminate_horizontal_rect2_scalex.xml b/res/interpolator/progress_indeterminate_horizontal_rect2_scalex.xml
new file mode 100644
index 0000000..34ebe07
--- /dev/null
+++ b/res/interpolator/progress_indeterminate_horizontal_rect2_scalex.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0,0 C 0.06834272400867,0.01992566661414 0.19220331656133,0.15855429260523 0.33333333333333,0.34926160892842 C 0.38410433133433,0.41477913453861 0.54945792615267,0.68136029463551 0.66666666666667,0.68279962777002 C 0.752586273196,0.68179620963216 0.737253971954,0.878896194318 1,1" />
diff --git a/res/interpolator/progress_indeterminate_horizontal_rect2_translatex.xml b/res/interpolator/progress_indeterminate_horizontal_rect2_translatex.xml
new file mode 100644
index 0000000..d740e01
--- /dev/null
+++ b/res/interpolator/progress_indeterminate_horizontal_rect2_translatex.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<pathInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
+    android:pathData="M 0.0,0.0 C 0.0375,0.0 0.128764607715,0.0895380946618 0.25,0.218553507947 C 0.322410320025,0.295610602487 0.436666666667,0.417591408114 0.483333333333,0.489826169306 C 0.69,0.80972296795 0.793333333333,0.950016125212 1.0,1.0 " />
diff --git a/src/com/android/documentsui/files/ActionHandler.java b/src/com/android/documentsui/files/ActionHandler.java
index b563b7e..4d4f082 100644
--- a/src/com/android/documentsui/files/ActionHandler.java
+++ b/src/com/android/documentsui/files/ActionHandler.java
@@ -33,6 +33,7 @@
 import android.util.Log;
 import android.view.DragEvent;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.fragment.app.FragmentActivity;
 import androidx.recyclerview.selection.ItemDetailsLookup.ItemDetails;
 import androidx.recyclerview.selection.MutableSelection;
@@ -75,8 +76,6 @@
 import com.android.documentsui.services.FileOperations;
 import com.android.documentsui.ui.DialogController;
 
-import androidx.annotation.VisibleForTesting;
-
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Executor;
@@ -215,7 +214,7 @@
         if (mConfig.isDocumentEnabled(doc.mimeType, doc.flags, mState)) {
             onDocumentPicked(doc, type, fallback);
             mSelectionMgr.clearSelection();
-            return true;
+            return !doc.isContainer();
         }
         return false;
     }
diff --git a/src/com/android/documentsui/picker/ActionHandler.java b/src/com/android/documentsui/picker/ActionHandler.java
index 7318d5b..ef16e6d 100644
--- a/src/com/android/documentsui/picker/ActionHandler.java
+++ b/src/com/android/documentsui/picker/ActionHandler.java
@@ -35,6 +35,7 @@
 import android.provider.Settings;
 import android.util.Log;
 
+import androidx.annotation.VisibleForTesting;
 import androidx.fragment.app.FragmentActivity;
 import androidx.fragment.app.FragmentManager;
 import androidx.recyclerview.selection.ItemDetailsLookup.ItemDetails;
@@ -60,7 +61,6 @@
 import com.android.documentsui.queries.SearchViewManager;
 import com.android.documentsui.roots.ProvidersAccess;
 import com.android.documentsui.services.FileOperationService;
-import androidx.annotation.VisibleForTesting;
 
 import java.util.Arrays;
 import java.util.concurrent.Executor;
@@ -319,7 +319,7 @@
         if (mConfig.isDocumentEnabled(doc.mimeType, doc.flags, mState)) {
             mActivity.onDocumentPicked(doc);
             mSelectionMgr.clearSelection();
-            return true;
+            return !doc.isDirectory();
         }
         return false;
     }
diff --git a/tests/unit/com/android/documentsui/files/ActionHandlerTest.java b/tests/unit/com/android/documentsui/files/ActionHandlerTest.java
index 23a4f16..de4f7fa 100644
--- a/tests/unit/com/android/documentsui/files/ActionHandlerTest.java
+++ b/tests/unit/com/android/documentsui/files/ActionHandlerTest.java
@@ -360,18 +360,20 @@
         mActivity.currentRoot = TestProvidersAccess.HOME;
         mEnv.docs.nextDocument = TestEnv.FILE_ARCHIVE;
 
-        mHandler.openDocument(TestEnv.FILE_ARCHIVE, ActionHandler.VIEW_TYPE_PREVIEW,
-                ActionHandler.VIEW_TYPE_REGULAR);
+        final boolean result = mHandler.openDocument(TestEnv.FILE_ARCHIVE,
+                ActionHandler.VIEW_TYPE_PREVIEW, ActionHandler.VIEW_TYPE_REGULAR);
         assertEquals(TestEnv.FILE_ARCHIVE, mEnv.state.stack.peek());
+        assertEquals(false, result);
     }
 
     @Test
     public void testDocumentPicked_OpensDirectories() throws Exception {
         mActivity.currentRoot = TestProvidersAccess.HOME;
 
-        mHandler.openDocument(TestEnv.FOLDER_1, ActionHandler.VIEW_TYPE_PREVIEW,
-                ActionHandler.VIEW_TYPE_REGULAR);
+        final boolean result = mHandler.openDocument(TestEnv.FOLDER_1,
+                ActionHandler.VIEW_TYPE_PREVIEW, ActionHandler.VIEW_TYPE_REGULAR);
         assertEquals(TestEnv.FOLDER_1, mEnv.state.stack.peek());
+        assertEquals(false, result);
     }
 
     @Test