Merge "Add mainline tests to presubmit." into sc-mainline-prod
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..be6b71b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+# Intellij
+**/.idea/
+*.iml
diff --git a/gen_strings.py b/gen_strings.py
index a3d98be..23b3315 100755
--- a/gen_strings.py
+++ b/gen_strings.py
@@ -38,42 +38,42 @@
         if verb == "trash":
             print Template('''
 <!-- Dialog title asking if user will allow $verb permission to the $data item displayed below this string. [CHAR LIMIT=128] -->
-<plurals name="permission_${verb}_${data}">
-    <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this $datalabel to trash?</item>
-    <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s to trash?</item>
-</plurals>
+<string name="permission_${verb}_${data}"> {count, plural,
+    =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this $datalabel to trash?}
+    other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s to trash?}
+}</string>
 ''').substitute(vars()).strip("\n")
             print Template('''
 <!-- Progress dialog message after user allows $verb permission to the $data item [CHAR LIMIT=128] -->
-<plurals name="permission_progress_${verb}_${data}">
-    <item quantity="one">Moving $datalabel to trash&#8230;</item>
-    <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s to trash&#8230;</item>
-</plurals>
+<string name="permission_progress_${verb}_${data}"> {count, plural,
+    =1    {Moving $datalabel to trash&#8230;}
+    other {Moving <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s to trash&#8230;}
+}</string>
 ''').substitute(vars()).strip("\n")
 
         elif verb == "untrash":
             print Template('''
 <!-- Dialog title asking if user will allow $verb permission to the $data item displayed below this string. [CHAR LIMIT=128] -->
-<plurals name="permission_${verb}_${data}">
-    <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this $datalabel out of trash?</item>
-    <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s out of trash?</item>
-</plurals>
+<string name="permission_${verb}_${data}"> {count, plural,
+    =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this $datalabel out of trash?}
+    other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s out of trash?}
+}</string>
 ''').substitute(vars()).strip("\n")
             print Template('''
 <!-- Progress dialog message after user allows $verb permission to the $data item [CHAR LIMIT=128] -->
-<plurals name="permission_progress_${verb}_${data}">
-    <item quantity="one">Moving $datalabel out of trash&#8230;</item>
-    <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s out of trash&#8230;</item>
-</plurals>
+<string name="permission_progress_${verb}_${data}"> {count, plural,
+    =1    {Moving $datalabel out of trash&#8230;}
+    other {Moving <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s out of trash&#8230;}
+}</string>
 ''').substitute(vars()).strip("\n")
 
         else:
             print Template('''
 <!-- Dialog title asking if user will allow $verb permission to the $data item displayed below this string. [CHAR LIMIT=128] -->
-<plurals name="permission_${verb}_${data}">
-    <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to $verblabel this $datalabel?</item>
-    <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to $verblabel <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s?</item>
-</plurals>
+<string name="permission_${verb}_${data}"> {count, plural,
+    =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to $verblabel this $datalabel?}
+    other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to $verblabel <xliff:g id="count" example="42">^2</xliff:g> ${datalabel}s?}
+}</string>
 ''').substitute(vars()).strip("\n")
             if verb == "write":
                 actionLabel = "Modifying"
@@ -81,10 +81,10 @@
                 actionLabel = "Deleting"
             print Template('''
 <!-- Progress dialog message after user allows $verb permission to the $data item [CHAR LIMIT=128] -->
-<plurals name="permission_progress_${verb}_${data}">
-    <item quantity="one">$actionLabel $datalabel&#8230;</item>
-    <item quantity="other">$actionLabel <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s&#8230;</item>
-</plurals>
+<string name="permission_progress_${verb}_${data}"> {count, plural,
+    =1    {$actionLabel $datalabel&#8230;}
+    other {$actionLabel <xliff:g id="count" example="42">^1</xliff:g> ${datalabel}s&#8230;}
+}</string>
 ''').substitute(vars()).strip("\n")
 
 print '''
diff --git a/res/drawable/ic_artwork_camera.xml b/res/drawable/ic_artwork_camera.xml
new file mode 100644
index 0000000..dc22c49
--- /dev/null
+++ b/res/drawable/ic_artwork_camera.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="120dp"
+    android:height="80dp"
+    android:viewportWidth="120"
+    android:viewportHeight="80">
+  <path
+      android:pathData="M96,14m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"
+      android:fillColor="#EA4335"/>
+  <path
+      android:pathData="M8,14h104v64h-104z"
+      android:fillColor="#DADCE0"/>
+  <path
+      android:pathData="M16,10h16v4h-16z"
+      android:fillColor="#5F6368"/>
+  <path
+      android:strokeWidth="1"
+      android:pathData="M60,48m-25.5,0a25.5,25.5 0,1 1,51 0a25.5,25.5 0,1 1,-51 0"
+      android:fillColor="#DADCE0"
+      android:strokeColor="#5F6368"/>
+  <path
+      android:pathData="M60,48m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0"
+      android:fillColor="#BDC1C6"/>
+</vector>
diff --git a/res/layout/fragment_picker_tab.xml b/res/layout/fragment_picker_tab.xml
index 17960f9..59cea08 100644
--- a/res/layout/fragment_picker_tab.xml
+++ b/res/layout/fragment_picker_tab.xml
@@ -20,6 +20,35 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
+    <LinearLayout
+        android:id="@android:id/empty"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="80dp"
+        android:orientation="vertical"
+        android:visibility="gone">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_horizontal"
+            android:scaleType="fitCenter"
+            android:src="@drawable/ic_artwork_camera"
+            android:contentDescription="@null"/>
+
+        <TextView
+            android:id="@+id/empty_text_view"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/picker_empty_text_margin"
+            android:gravity="center_horizontal"
+            android:text="@string/picker_photos_empty_message"
+            android:textColor="?android:attr/textColorSecondary"
+            android:textSize="@dimen/picker_empty_text_size"
+            style="?android:attr/textAppearanceListItem"/>
+
+    </LinearLayout>
+
     <com.android.providers.media.photopicker.ui.AutoFitRecyclerView
         android:id="@+id/picker_tab_recyclerview"
         android:layout_width="match_parent"
@@ -34,7 +63,7 @@
         android:layout_height="wrap_content"
         android:layout_marginBottom="@dimen/picker_profile_button_margin_bottom"
         android:layout_gravity="bottom|center"
-        android:textAppearance="@style/PickerProfileButton"
+        android:textAppearance="@style/PickerButtonTextAppearance"
         android:textColor="@color/picker_profile_button_content_color"
         android:text="@string/picker_work_profile"
         android:visibility="gone"
@@ -65,7 +94,7 @@
             android:textAllCaps="false"
             android:textColor="?android:attr/colorAccent"
             app:iconPadding="@dimen/picker_bottom_bar_vertical_gap"
-            style="?attr/borderlessButtonStyle"/>
+            style="@style/MaterialBorderlessButtonStyle"/>
 
         <Button
             android:id="@+id/button_add"
@@ -77,7 +106,7 @@
             android:text="@string/add"
             android:textAllCaps="false"
             android:backgroundTint="?android:attr/colorAccent"
-            style="?attr/materialButtonStyle"/>
+            style="@style/MaterialButtonStyle"/>
 
     </FrameLayout>
-</FrameLayout>
\ No newline at end of file
+</FrameLayout>
diff --git a/res/layout/fragment_preview.xml b/res/layout/fragment_preview.xml
index ede43a1..1d6c3f8 100644
--- a/res/layout/fragment_preview.xml
+++ b/res/layout/fragment_preview.xml
@@ -62,7 +62,7 @@
             android:textAllCaps="false"
             android:text="@string/deselect"
             android:textColor="@color/picker_default_white"
-            style="?attr/borderlessButtonStyle"/>
+            style="@style/MaterialBorderlessButtonStyle"/>
 
         <Button
             android:id="@+id/preview_add_or_select_button"
@@ -73,6 +73,7 @@
             android:text="@string/add"
             android:textAllCaps="false"
             android:textColor="@color/preview_default_grey"
-            style="?attr/materialButtonStyle"/>
+            style="@style/MaterialButtonStyle"/>
+
     </FrameLayout>
 </FrameLayout>
diff --git a/res/layout/item_album_grid.xml b/res/layout/item_album_grid.xml
index 8c148c1..e40891e 100644
--- a/res/layout/item_album_grid.xml
+++ b/res/layout/item_album_grid.xml
@@ -42,15 +42,17 @@
     <TextView
         android:id="@+id/album_name"
         android:layout_width="wrap_content"
-        android:layout_height="@dimen/picker_album_name_min_height"
+        android:layout_height="wrap_content"
+        android:minHeight="@dimen/picker_album_name_min_height"
         android:layout_marginTop="@dimen/picker_album_name_margin"
-        android:textAppearance="?attr/textAppearanceSubtitle2"/>
+        android:textAppearance="@style/PickerHeaderTextAppearance"/>
 
     <TextView
         android:id="@+id/item_count"
         android:layout_width="wrap_content"
-        android:layout_height="@dimen/picker_album_item_count_height"
+        android:layout_height="wrap_content"
+        android:minHeight="@dimen/picker_album_item_count_height"
         android:layout_marginTop="@dimen/picker_album_item_count_margin"
-        android:textAppearance="?attr/textAppearanceCaption"/>
+        android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small"/>
 
 </LinearLayout>
diff --git a/res/layout/item_date_header.xml b/res/layout/item_date_header.xml
index fd6f826..d3a931a 100644
--- a/res/layout/item_date_header.xml
+++ b/res/layout/item_date_header.xml
@@ -17,6 +17,7 @@
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
           android:id="@+id/date_header_title"
           android:layout_width="match_parent"
-          android:layout_height="@dimen/picker_date_header_height"
+          android:layout_height="wrap_content"
+          android:minHeight="@dimen/picker_date_header_height"
           android:padding="@dimen/picker_date_header_padding"
-          android:textAppearance="@style/PickerDateHeader"/>
\ No newline at end of file
+          android:textAppearance="@style/PickerHeaderTextAppearance"/>
diff --git a/res/layout/picker_chip_tab_header.xml b/res/layout/picker_chip_tab_header.xml
index f081b98..c2c1dfa 100644
--- a/res/layout/picker_chip_tab_header.xml
+++ b/res/layout/picker_chip_tab_header.xml
@@ -20,7 +20,7 @@
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_gravity="center"
-    android:textAppearance="@style/PickerChipText"
+    android:textAppearance="@style/PickerChipTextAppearance"
     android:textColor="@color/picker_chip_text_color"
     app:chipBackgroundColor="@color/picker_chip_background_color"
     app:chipCornerRadius="@dimen/picker_chip_radius"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index e85c2ba..88fbe53 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -59,6 +59,9 @@
     <dimen name="picker_drag_margin_top">8dp</dimen>
     <dimen name="picker_drag_margin_bottom">12dp</dimen>
 
+    <dimen name="picker_empty_text_margin">20dp</dimen>
+    <dimen name="picker_empty_text_size">18sp</dimen>
+
     <!-- PhotoPicker Preview -->
     <dimen name="preview_buttons_padding_horizontal">16dp</dimen>
     <dimen name="preview_deselect_padding_start">2dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 26dbbbb..288a54e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -50,16 +50,16 @@
     <string name="grant_dialog_button_deny">Deny</string>
 
     <!-- Text placed over a visual thumbnail indicating that there are more items beyond the number currently displayed on the screen. [CHAR LIMIT=6] -->
-    <plurals name="permission_more_thumb">
-        <item quantity="one">+<xliff:g id="count" example="1">^1</xliff:g></item>
-        <item quantity="other">+<xliff:g id="count" example="42">^1</xliff:g></item>
-    </plurals>
+    <string name="permission_more_thumb"> {count, plural,
+        =1    {+<xliff:g id="count" example="1">^1</xliff:g>}
+        other {+<xliff:g id="count" example="42">^1</xliff:g>}
+    }</string>
 
     <!-- Text shown at the end of a list indicating that there are more items beyond the number currently displayed on the screen. [CHAR LIMIT=32]  -->
-    <plurals name="permission_more_text">
-        <item quantity="one">Plus <xliff:g id="count" example="1">^1</xliff:g> additional item</item>
-        <item quantity="other">Plus <xliff:g id="count" example="42">^1</xliff:g> additional items</item>
-    </plurals>
+    <string name="permission_more_text"> {count, plural,
+        =1    {Plus <xliff:g id="count" example="1">^1</xliff:g> additional item}
+        other {Plus <xliff:g id="count" example="42">^1</xliff:g> additional items}
+    }</string>
 
     <!-- Cache clearing permission dialog warning title. [CHAR LIMIT=NONE] -->
     <string name="cache_clearing_dialog_title">Clear temporary app files</string>
@@ -89,14 +89,19 @@
     <string name="select">Select</string>
 
     <!-- Select up to max label message for PhotoPicker. [CHAR LIMIT=30] -->
-    <plurals name="select_up_to">
-        <item quantity="one">Select up to <xliff:g id="count" example="1">^1</xliff:g> item</item>
-        <item quantity="other">Select up to <xliff:g id="count" example="42">^1</xliff:g> items</item>
-    </plurals>
+    <string name="select_up_to"> {count, plural,
+        =1    {Select up to <xliff:g id="count" example="1">^1</xliff:g> item}
+        other {Select up to <xliff:g id="count" example="42">^1</xliff:g> items}
+    }</string>
 
     <!-- Recent header for PhotoPicker. [CHAR LIMIT=50] -->
     <string name="recent">Recent</string>
 
+    <!-- The message for empty message on Photos tab in PhotoPicker when the item count is zero. [CHAR LIMIT=NONE] -->
+    <string name="picker_photos_empty_message">No photos or videos</string>
+    <!-- The message for empty message on Albums tab in PhotoPicker when the item count is zero. [CHAR LIMIT=NONE] -->
+    <string name="picker_albums_empty_message">No albums</string>
+
     <!-- PhotoPicker view selected action text. [CHAR LIMIT=80] -->
     <string name="picker_view_selected">View selected</string>
 
@@ -127,10 +132,10 @@
     <string name="picker_profile_work_paused_msg">To open work photos, turn on your work apps then try again</string>
 
     <!-- Text shown on the album item in PhotoPicker. [CHAR LIMIT=30]  -->
-    <plurals name="picker_album_item_count">
-        <item quantity="one"><xliff:g id="count" example="1">^1</xliff:g> item</item>
-        <item quantity="other"><xliff:g id="count" example="42">^1</xliff:g> items</item>
-    </plurals>
+    <string name="picker_album_item_count"> {count, plural,
+        =1    {<xliff:g id="count" example="1">^1</xliff:g> item}
+        other {<xliff:g id="count" example="42">^1</xliff:g> items}
+    }</string>
 
     <!-- Text shown on the add button for multi-select in PhotoPicker. [CHAR LIMIT=30]  -->
     <string name="picker_add_button_multi_select">Add (<xliff:g id="count" example="42">^1</xliff:g>)</string>
@@ -154,174 +159,174 @@
     <!-- ========================= WRITE STRINGS ========================= -->
 
     <!-- Dialog title asking if user will allow write permission to the audio item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_write_audio">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify this audio file?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify <xliff:g id="count" example="42">^2</xliff:g> audio files?</item>
-    </plurals>
+    <string name="permission_write_audio"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify this audio file?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify <xliff:g id="count" example="42">^2</xliff:g> audio files?}
+    }</string>
     <!-- Progress dialog message after user allows write permission to the audio item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_write_audio">
-        <item quantity="one">Modifying audio file&#8230;</item>
-        <item quantity="other">Modifying <xliff:g id="count" example="42">^1</xliff:g> audio files&#8230;</item>
-    </plurals>
+    <string name="permission_progress_write_audio"> {count, plural,
+        =1    {Modifying audio file&#8230;}
+        other {Modifying <xliff:g id="count" example="42">^1</xliff:g> audio files&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow write permission to the video item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_write_video">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify this video?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify <xliff:g id="count" example="42">^2</xliff:g> videos?</item>
-    </plurals>
+    <string name="permission_write_video"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify this video?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify <xliff:g id="count" example="42">^2</xliff:g> videos?}
+    }</string>
     <!-- Progress dialog message after user allows write permission to the video item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_write_video">
-        <item quantity="one">Modifying video&#8230;</item>
-        <item quantity="other">Modifying <xliff:g id="count" example="42">^1</xliff:g> videos&#8230;</item>
-    </plurals>
+    <string name="permission_progress_write_video"> {count, plural,
+        =1    {Modifying video&#8230;}
+        other {Modifying <xliff:g id="count" example="42">^1</xliff:g> videos&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow write permission to the image item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_write_image">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify this photo?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify <xliff:g id="count" example="42">^2</xliff:g> photos?</item>
-    </plurals>
+    <string name="permission_write_image"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify this photo?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify <xliff:g id="count" example="42">^2</xliff:g> photos?}
+    }</string>
     <!-- Progress dialog message after user allows write permission to the image item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_write_image">
-        <item quantity="one">Modifying photo&#8230;</item>
-        <item quantity="other">Modifying <xliff:g id="count" example="42">^1</xliff:g> photos&#8230;</item>
-    </plurals>
+    <string name="permission_progress_write_image"> {count, plural,
+        =1    {Modifying photo&#8230;}
+        other {Modifying <xliff:g id="count" example="42">^1</xliff:g> photos&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow write permission to the generic item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_write_generic">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify this item?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify <xliff:g id="count" example="42">^2</xliff:g> items?</item>
-    </plurals>
+    <string name="permission_write_generic"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify this item?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to modify <xliff:g id="count" example="42">^2</xliff:g> items?}
+    }</string>
     <!-- Progress dialog message after user allows write permission to the generic item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_write_generic">
-        <item quantity="one">Modifying item&#8230;</item>
-        <item quantity="other">Modifying <xliff:g id="count" example="42">^1</xliff:g> items&#8230;</item>
-    </plurals>
+    <string name="permission_progress_write_generic"> {count, plural,
+        =1    {Modifying item&#8230;}
+        other {Modifying <xliff:g id="count" example="42">^1</xliff:g> items&#8230;}
+    }</string>
 
     <!-- ========================= TRASH STRINGS ========================= -->
 
     <!-- Dialog title asking if user will allow trash permission to the audio item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_trash_audio">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this audio file to trash?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> audio files to trash?</item>
-    </plurals>
+    <string name="permission_trash_audio"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this audio file to trash?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> audio files to trash?}
+    }</string>
     <!-- Progress dialog message after user allows trash permission to the audio item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_trash_audio">
-        <item quantity="one">Moving audio file to trash&#8230;</item>
-        <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> audio files to trash&#8230;</item>
-    </plurals>
+    <string name="permission_progress_trash_audio"> {count, plural,
+        =1    {Moving audio file to trash&#8230;}
+        other {Moving <xliff:g id="count" example="42">^1</xliff:g> audio files to trash&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow trash permission to the video item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_trash_video">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this video to trash?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> videos to trash?</item>
-    </plurals>
+    <string name="permission_trash_video"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this video to trash?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> videos to trash?}
+    }</string>
     <!-- Progress dialog message after user allows trash permission to the video item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_trash_video">
-        <item quantity="one">Moving video to trash&#8230;</item>
-        <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> videos to trash&#8230;</item>
-    </plurals>
+    <string name="permission_progress_trash_video"> {count, plural,
+        =1    {Moving video to trash&#8230;}
+        other {Moving <xliff:g id="count" example="42">^1</xliff:g> videos to trash&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow trash permission to the image item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_trash_image">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this photo to trash?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> photos to trash?</item>
-    </plurals>
+    <string name="permission_trash_image"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this photo to trash?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> photos to trash?}
+    }</string>
     <!-- Progress dialog message after user allows trash permission to the image item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_trash_image">
-        <item quantity="one">Moving photo to trash&#8230;</item>
-        <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> photos to trash&#8230;</item>
-    </plurals>
+    <string name="permission_progress_trash_image"> {count, plural,
+        =1    {Moving photo to trash&#8230;}
+        other {Moving <xliff:g id="count" example="42">^1</xliff:g> photos to trash&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow trash permission to the generic item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_trash_generic">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this item to trash?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> items to trash?</item>
-    </plurals>
+    <string name="permission_trash_generic"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this item to trash?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> items to trash?}
+    }</string>
     <!-- Progress dialog message after user allows trash permission to the generic item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_trash_generic">
-        <item quantity="one">Moving item to trash&#8230;</item>
-        <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> items to trash&#8230;</item>
-    </plurals>
+    <string name="permission_progress_trash_generic"> {count, plural,
+        =1    {Moving item to trash&#8230;}
+        other {Moving <xliff:g id="count" example="42">^1</xliff:g> items to trash&#8230;}
+    }</string>
 
     <!-- ========================= UNTRASH STRINGS ========================= -->
 
     <!-- Dialog title asking if user will allow untrash permission to the audio item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_untrash_audio">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this audio file out of trash?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> audio files out of trash?</item>
-    </plurals>
+    <string name="permission_untrash_audio"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this audio file out of trash?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> audio files out of trash?}
+    }</string>
     <!-- Progress dialog message after user allows untrash permission to the audio item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_untrash_audio">
-        <item quantity="one">Moving audio file out of trash&#8230;</item>
-        <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> audio files out of trash&#8230;</item>
-    </plurals>
+    <string name="permission_progress_untrash_audio"> {count, plural,
+        =1    {Moving audio file out of trash&#8230;}
+        other {Moving <xliff:g id="count" example="42">^1</xliff:g> audio files out of trash&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow untrash permission to the video item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_untrash_video">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this video out of trash?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> videos out of trash?</item>
-    </plurals>
+    <string name="permission_untrash_video"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this video out of trash?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> videos out of trash?}
+    }</string>
     <!-- Progress dialog message after user allows untrash permission to the video item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_untrash_video">
-        <item quantity="one">Moving video out of trash&#8230;</item>
-        <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> videos out of trash&#8230;</item>
-    </plurals>
+    <string name="permission_progress_untrash_video"> {count, plural,
+        =1    {Moving video out of trash&#8230;}
+        other {Moving <xliff:g id="count" example="42">^1</xliff:g> videos out of trash&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow untrash permission to the image item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_untrash_image">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this photo out of trash?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> photos out of trash?</item>
-    </plurals>
+    <string name="permission_untrash_image"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this photo out of trash?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> photos out of trash?}
+    }</string>
     <!-- Progress dialog message after user allows untrash permission to the image item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_untrash_image">
-        <item quantity="one">Moving photo out of trash&#8230;</item>
-        <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> photos out of trash&#8230;</item>
-    </plurals>
+    <string name="permission_progress_untrash_image"> {count, plural,
+        =1    {Moving photo out of trash&#8230;}
+        other {Moving <xliff:g id="count" example="42">^1</xliff:g> photos out of trash&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow untrash permission to the generic item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_untrash_generic">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this item out of trash?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> items out of trash?</item>
-    </plurals>
+    <string name="permission_untrash_generic"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move this item out of trash?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to move <xliff:g id="count" example="42">^2</xliff:g> items out of trash?}
+    }</string>
     <!-- Progress dialog message after user allows untrash permission to the generic item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_untrash_generic">
-        <item quantity="one">Moving item out of trash&#8230;</item>
-        <item quantity="other">Moving <xliff:g id="count" example="42">^1</xliff:g> items out of trash&#8230;</item>
-    </plurals>
+    <string name="permission_progress_untrash_generic"> {count, plural,
+        =1    {Moving item out of trash&#8230;}
+        other {Moving <xliff:g id="count" example="42">^1</xliff:g> items out of trash&#8230;}
+    }</string>
 
     <!-- ========================= DELETE STRINGS ========================= -->
 
     <!-- Dialog title asking if user will allow delete permission to the audio item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_delete_audio">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete this audio file?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete <xliff:g id="count" example="42">^2</xliff:g> audio files?</item>
-    </plurals>
+    <string name="permission_delete_audio"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete this audio file?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete <xliff:g id="count" example="42">^2</xliff:g> audio files?}
+    }</string>
     <!-- Progress dialog message after user allows delete permission to the audio item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_delete_audio">
-        <item quantity="one">Deleting audio file&#8230;</item>
-        <item quantity="other">Deleting <xliff:g id="count" example="42">^1</xliff:g> audio files&#8230;</item>
-    </plurals>
+    <string name="permission_progress_delete_audio"> {count, plural,
+        =1    {Deleting audio file&#8230;}
+        other {Deleting <xliff:g id="count" example="42">^1</xliff:g> audio files&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow delete permission to the video item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_delete_video">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete this video?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete <xliff:g id="count" example="42">^2</xliff:g> videos?</item>
-    </plurals>
+    <string name="permission_delete_video"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete this video?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete <xliff:g id="count" example="42">^2</xliff:g> videos?}
+    }</string>
     <!-- Progress dialog message after user allows delete permission to the video item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_delete_video">
-        <item quantity="one">Deleting video&#8230;</item>
-        <item quantity="other">Deleting <xliff:g id="count" example="42">^1</xliff:g> videos&#8230;</item>
-    </plurals>
+    <string name="permission_progress_delete_video"> {count, plural,
+        =1    {Deleting video&#8230;}
+        other {Deleting <xliff:g id="count" example="42">^1</xliff:g> videos&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow delete permission to the image item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_delete_image">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete this photo?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete <xliff:g id="count" example="42">^2</xliff:g> photos?</item>
-    </plurals>
+    <string name="permission_delete_image"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete this photo?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete <xliff:g id="count" example="42">^2</xliff:g> photos?}
+    }</string>
     <!-- Progress dialog message after user allows delete permission to the image item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_delete_image">
-        <item quantity="one">Deleting photo&#8230;</item>
-        <item quantity="other">Deleting <xliff:g id="count" example="42">^1</xliff:g> photos&#8230;</item>
-    </plurals>
+    <string name="permission_progress_delete_image"> {count, plural,
+        =1    {Deleting photo&#8230;}
+        other {Deleting <xliff:g id="count" example="42">^1</xliff:g> photos&#8230;}
+    }</string>
     <!-- Dialog title asking if user will allow delete permission to the generic item displayed below this string. [CHAR LIMIT=128] -->
-    <plurals name="permission_delete_generic">
-        <item quantity="one">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete this item?</item>
-        <item quantity="other">Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete <xliff:g id="count" example="42">^2</xliff:g> items?</item>
-    </plurals>
+    <string name="permission_delete_generic"> {count, plural,
+        =1    {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete this item?}
+        other {Allow <xliff:g id="app_name" example="Gmail">^1</xliff:g> to delete <xliff:g id="count" example="42">^2</xliff:g> items?}
+    }</string>
     <!-- Progress dialog message after user allows delete permission to the generic item [CHAR LIMIT=128] -->
-    <plurals name="permission_progress_delete_generic">
-        <item quantity="one">Deleting item&#8230;</item>
-        <item quantity="other">Deleting <xliff:g id="count" example="42">^1</xliff:g> items&#8230;</item>
-    </plurals>
+    <string name="permission_progress_delete_generic"> {count, plural,
+        =1    {Deleting item&#8230;}
+        other {Deleting <xliff:g id="count" example="42">^1</xliff:g> items&#8230;}
+    }</string>
 
     <!-- ========================= END AUTO-GENERATED BY gen_strings.py ========================= -->
 
diff --git a/res/values/styles.xml b/res/values/styles.xml
index f629e9d..0a15288 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -50,6 +50,15 @@
         <item name="android:textColor">?android:attr/textColorPrimary</item>
     </style>
 
+    <style name="MaterialBorderlessButtonStyle"
+           parent="@style/Widget.MaterialComponents.Button.TextButton">
+        <item name="android:textAppearance">@style/PickerButtonTextAppearance</item>
+    </style>
+
+    <style name="MaterialButtonStyle" parent="@style/Widget.MaterialComponents.Button">
+        <item name="android:textAppearance">@style/PickerButtonTextAppearance</item>
+    </style>
+
     <style name="ProfileDialogTheme"
            parent="@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog.Centered">
         <item name="android:dialogCornerRadius">@dimen/picker_profile_dialog_radius</item>
@@ -77,17 +86,21 @@
         <item name="android:layout_height">@dimen/picker_profile_dialog_icon_height</item>
     </style>
 
-    <style name="PickerDefaultTheme" parent="@style/Theme.MaterialComponents.DayNight.NoActionBar">
+    <style name="PickerDefaultTheme" parent="android:style/Theme.DeviceDefault.DayNight">
         <!-- Color section -->
         <item name="android:colorAccent">@color/picker_primary_color</item>
         <item name="android:colorBackground">@color/picker_background_color</item>
 
         <!-- System | Widget section -->
+        <item name="android:backgroundDimEnabled">true</item>
+        <item name="android:navigationBarColor">?android:attr/colorBackground</item>
         <item name="android:statusBarColor">@android:color/transparent</item>
-        <item name="android:navigationBarColor">?android:colorBackground</item>
         <item name="android:windowBackground">@android:color/transparent</item>
         <item name="android:windowIsTranslucent">true</item>
-        <item name="android:backgroundDimEnabled">true</item>
+        <item name="android:windowNoTitle">true</item>
+    </style>
+
+    <style name="PickerMaterialTheme" parent="@style/Theme.MaterialComponents.DayNight.NoActionBar">
         <item name="materialAlertDialogTheme">@style/ProfileDialogTheme</item>
     </style>
 
diff --git a/res/values/styles_text.xml b/res/values/styles_text.xml
index b972c8b..55a71b8 100644
--- a/res/values/styles_text.xml
+++ b/res/values/styles_text.xml
@@ -16,18 +16,19 @@
 
 <resources xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <style name="PickerDateHeader" parent="@android:style/TextAppearance.Material.Title">
+    <style name="PickerHeaderTextAppearance"
+           parent="@android:style/TextAppearance.DeviceDefault.WindowTitle">
         <item name="android:textColor">@color/picker_date_header_text_color</item>
         <item name="android:textSize">16sp</item>
     </style>
 
-    <style name="PickerChipText" parent="@android:style/TextAppearance.Material.Title">
+    <style name="PickerChipTextAppearance"
+           parent="@android:style/TextAppearance.DeviceDefault.Widget.Button">
         <item name="android:textSize">@dimen/picker_chip_text_size</item>
     </style>
 
-    <style name="PickerProfileButton" parent="@android:style/TextAppearance.Material.Button">
-        <item name="android:textAllCaps">false</item>
-    </style>
+    <style name="PickerButtonTextAppearance"
+           parent="@android:style/TextAppearance.DeviceDefault.Widget.Button"/>
 
     <style name="PickerProfileDialogTitle"
            parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle">
diff --git a/src/com/android/providers/media/PermissionActivity.java b/src/com/android/providers/media/PermissionActivity.java
index 0bf8f24..5b53e7d 100644
--- a/src/com/android/providers/media/PermissionActivity.java
+++ b/src/com/android/providers/media/PermissionActivity.java
@@ -47,6 +47,7 @@
 import android.graphics.ImageDecoder.Source;
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Icon;
+import android.icu.text.MessageFormat;
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Bundle;
@@ -76,11 +77,15 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 import java.util.Objects;
 import java.util.function.Predicate;
 import java.util.function.ToIntFunction;
 import java.util.stream.Collectors;
+import src.com.android.providers.media.util.StringUtils;
 
 /**
  * Permission dialog that asks for user confirmation before performing a
@@ -506,11 +511,11 @@
      */
     private @Nullable CharSequence resolveTitleText() {
         final String resName = "permission_" + verb + "_" + data;
-        final int resId = getResources().getIdentifier(resName, "plurals",
+        final int resId = getResources().getIdentifier(resName, "string",
                 getResources().getResourcePackageName(R.string.app_label));
         if (resId != 0) {
             final int count = uris.size();
-            final CharSequence text = getResources().getQuantityText(resId, count);
+            final CharSequence text = StringUtils.getICUFormatString(getResources(), count, resId);
             return TextUtils.expandTemplate(text, label, String.valueOf(count));
         } else {
             // We always need a string to prompt the user with
@@ -524,11 +529,11 @@
      */
     private @Nullable CharSequence resolveProgressMessageText() {
         final String resName = "permission_progress_" + verb + "_" + data;
-        final int resId = getResources().getIdentifier(resName, "plurals",
+        final int resId = getResources().getIdentifier(resName, "string",
                 getResources().getResourcePackageName(R.string.app_label));
         if (resId != 0) {
             final int count = uris.size();
-            final CharSequence text = getResources().getQuantityText(resId, count);
+            final CharSequence text = StringUtils.getICUFormatString(getResources(), count, resId);
             return TextUtils.expandTemplate(text, String.valueOf(count));
         } else {
             // Only some actions have a progress message string; it's okay if
@@ -693,9 +698,11 @@
 
                 final int shownCount = Math.min(visualResults.size(), MAX_THUMBS - 1);
                 final int moreCount = results.size() - shownCount;
-                final CharSequence moreText = TextUtils.expandTemplate(res.getQuantityText(
-                        R.plurals.permission_more_thumb, moreCount), String.valueOf(moreCount));
-
+                final CharSequence moreText =
+                    TextUtils.expandTemplate(
+                        StringUtils.getICUFormatString(
+                            res, moreCount, R.string.permission_more_thumb),
+                        String.valueOf(moreCount));
                 thumbMoreText.setText(moreText);
                 thumbMoreContainer.setVisibility(View.VISIBLE);
                 gradientView.setVisibility(View.VISIBLE);
@@ -733,8 +740,11 @@
 
                 if (list.size() >= MAX_THUMBS && results.size() > list.size()) {
                     final int moreCount = results.size() - list.size();
-                    final CharSequence moreText = TextUtils.expandTemplate(res.getQuantityText(
-                            R.plurals.permission_more_text, moreCount), String.valueOf(moreCount));
+                    final CharSequence moreText =
+                        TextUtils.expandTemplate(
+                            StringUtils.getICUFormatString(
+                                res, moreCount, R.string.permission_more_text),
+                            String.valueOf(moreCount));
                     list.add(moreText);
                     break;
                 }
diff --git a/src/com/android/providers/media/PickerUriResolver.java b/src/com/android/providers/media/PickerUriResolver.java
index d39071d..6f5c83b 100644
--- a/src/com/android/providers/media/PickerUriResolver.java
+++ b/src/com/android/providers/media/PickerUriResolver.java
@@ -18,6 +18,7 @@
 
 import static android.content.pm.PackageManager.PERMISSION_GRANTED;
 import static com.android.providers.media.photopicker.util.CursorUtils.getCursorString;
+import static com.android.providers.media.util.FileUtils.toFuseFile;
 
 import android.content.ContentResolver;
 import android.content.ContentUris;
@@ -201,7 +202,7 @@
         if (file == null) {
             throw new FileNotFoundException("File not found for uri: " + uri);
         }
-        return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
+        return ParcelFileDescriptor.open(toFuseFile(file), ParcelFileDescriptor.MODE_READ_ONLY);
     }
 
     private File getPickerFileFromUri(Uri uri) {
diff --git a/src/com/android/providers/media/photopicker/PhotoPickerActivity.java b/src/com/android/providers/media/photopicker/PhotoPickerActivity.java
index c092d30..4b176dc 100644
--- a/src/com/android/providers/media/photopicker/PhotoPickerActivity.java
+++ b/src/com/android/providers/media/photopicker/PhotoPickerActivity.java
@@ -102,6 +102,11 @@
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
+        // We use the device default theme as the base theme. Apply the material them for the
+        // material components. We use force "false" here, only values that are not already defined
+        // in the base theme will be copied.
+        getTheme().applyStyle(R.style.PickerMaterialTheme, /* force */ false);
+
         super.onCreate(savedInstanceState);
 
         if (!isPhotoPickerEnabled()) {
diff --git a/src/com/android/providers/media/photopicker/ui/AlbumGridHolder.java b/src/com/android/providers/media/photopicker/ui/AlbumGridHolder.java
index 9533b48..67fed45 100644
--- a/src/com/android/providers/media/photopicker/ui/AlbumGridHolder.java
+++ b/src/com/android/providers/media/photopicker/ui/AlbumGridHolder.java
@@ -17,6 +17,7 @@
 package com.android.providers.media.photopicker.ui;
 
 import android.content.Context;
+import android.icu.text.MessageFormat;
 import android.text.TextUtils;
 import android.view.View;
 import android.view.ViewGroup;
@@ -29,7 +30,10 @@
 import com.android.providers.media.photopicker.data.model.Category;
 
 import java.text.NumberFormat;
+import java.util.HashMap;
 import java.util.Locale;
+import java.util.Map;
+import src.com.android.providers.media.util.StringUtils;
 
 /**
  * ViewHolder of a album item within a RecyclerView.
@@ -66,9 +70,9 @@
         } else {
             mItemCount.setVisibility(View.VISIBLE);
             final int itemCount = category.getItemCount();
-            final String quantityText = itemView.getResources().getQuantityString(
-                    R.plurals.picker_album_item_count, itemCount);
-
+            final String quantityText =
+                    StringUtils.getICUFormatString(
+                        itemView.getResources(), itemCount, R.string.picker_album_item_count);
             final String itemCountString = NumberFormat.getInstance(Locale.getDefault()).format(
                     itemCount);
             mItemCount.setText(TextUtils.expandTemplate(quantityText, itemCountString));
diff --git a/src/com/android/providers/media/photopicker/ui/AlbumsTabFragment.java b/src/com/android/providers/media/photopicker/ui/AlbumsTabFragment.java
index eafb874..8834f9d 100644
--- a/src/com/android/providers/media/photopicker/ui/AlbumsTabFragment.java
+++ b/src/com/android/providers/media/photopicker/ui/AlbumsTabFragment.java
@@ -82,6 +82,11 @@
         return bottomBarSize + mBottomBarGap;
     }
 
+    @Override
+    protected String getEmptyMessage() {
+        return getString(R.string.picker_albums_empty_message);
+    }
+
     /**
      * Create the albums tab fragment and add it into the FragmentManager
      *
diff --git a/src/com/android/providers/media/photopicker/ui/AutoFitRecyclerView.java b/src/com/android/providers/media/photopicker/ui/AutoFitRecyclerView.java
index 526d090..81bd941 100644
--- a/src/com/android/providers/media/photopicker/ui/AutoFitRecyclerView.java
+++ b/src/com/android/providers/media/photopicker/ui/AutoFitRecyclerView.java
@@ -18,6 +18,7 @@
 
 import android.content.Context;
 import android.util.AttributeSet;
+import android.view.View;
 
 import androidx.annotation.Nullable;
 import androidx.recyclerview.widget.GridLayoutManager;
@@ -31,6 +32,50 @@
     private int mColumnWidth = -1;
     private int mMinimumSpanCount = 2;
     private boolean mIsGridLayout;
+    private View mEmptyView;
+    private AdapterDataObserver mAdapterDataObserver = new AdapterDataObserver() {
+        @Override
+        public void onChanged() {
+            super.onChanged();
+            checkIsEmpty();
+        }
+
+        /**
+         * If the user triggers {@link RecyclerView.Adapter#notifyItemInserted(int)}, this method
+         * will be triggered. We also need to check whether the dataset is empty or not to decide
+         * the visibility of the empty view.
+         */
+        @Override
+        public void onItemRangeInserted(int positionStart, int itemCount) {
+            super.onItemRangeInserted(positionStart, itemCount);
+            checkIsEmpty();
+        }
+
+        /**
+         * If the user triggers {@link RecyclerView.Adapter#notifyItemRemoved(int)}, this method
+         * will be triggered. We also need to check whether the dataset is empty or not to decide
+         * the visibility of the empty view.
+         */
+        @Override
+        public void onItemRangeRemoved(int positionStart, int itemCount) {
+            super.onItemRangeRemoved(positionStart, itemCount);
+            checkIsEmpty();
+        }
+
+        private void checkIsEmpty() {
+            if (mEmptyView == null) {
+                return;
+            }
+
+            if (getAdapter().getItemCount() == 0) {
+                mEmptyView.setVisibility(VISIBLE);
+                setVisibility(GONE);
+            } else {
+                mEmptyView.setVisibility(GONE);
+                setVisibility(VISIBLE);
+            }
+        }
+    };
 
     public AutoFitRecyclerView(Context context) {
         super(context);
@@ -62,6 +107,22 @@
         }
     }
 
+    @Override
+    public void setAdapter(@Nullable RecyclerView.Adapter adapter) {
+        super.setAdapter(adapter);
+        if (adapter != null) {
+            adapter.registerAdapterDataObserver(mAdapterDataObserver);
+        }
+        mAdapterDataObserver.onChanged();
+    }
+
+    /**
+     * Set the empty view. If the empty view is not null, when the item count is zero, it is shown.
+     */
+    public void setEmptyView(@Nullable View emptyView) {
+        mEmptyView = emptyView;
+    }
+
     public void setColumnWidth(int columnWidth) {
         mColumnWidth = columnWidth;
     }
diff --git a/src/com/android/providers/media/photopicker/ui/PhotosTabFragment.java b/src/com/android/providers/media/photopicker/ui/PhotosTabFragment.java
index 51e3052..e9b37db 100644
--- a/src/com/android/providers/media/photopicker/ui/PhotosTabFragment.java
+++ b/src/com/android/providers/media/photopicker/ui/PhotosTabFragment.java
@@ -17,6 +17,7 @@
 
 import static com.android.providers.media.photopicker.ui.PhotosTabAdapter.COLUMN_COUNT;
 
+import android.icu.text.MessageFormat;
 import android.os.Bundle;
 import android.text.TextUtils;
 import android.view.View;
@@ -39,7 +40,10 @@
 import com.google.android.material.snackbar.Snackbar;
 
 import java.text.NumberFormat;
+import java.util.HashMap;
 import java.util.Locale;
+import java.util.Map;
+import src.com.android.providers.media.util.StringUtils;
 
 /**
  * Photos tab fragment for showing the photos
@@ -136,6 +140,11 @@
         }
     }
 
+    @Override
+    protected String getEmptyMessage() {
+        return getString(R.string.picker_photos_empty_message);
+    }
+
     private void onItemClick(@NonNull View view) {
         if (mSelection.canSelectMultiple()) {
             final boolean isSelectedBefore = view.isSelected();
@@ -146,11 +155,12 @@
                 if (!mSelection.isSelectionAllowed()) {
                     final int maxCount = mSelection.getMaxSelectionLimit();
                     final CharSequence quantityText =
-                            getResources().getQuantityString(R.plurals.select_up_to, maxCount);
+                        StringUtils.getICUFormatString(
+                            getResources(), maxCount, R.string.select_up_to);
                     final String itemCountString = NumberFormat.getInstance(Locale.getDefault())
-                            .format(maxCount);
+                        .format(maxCount);
                     final CharSequence message = TextUtils.expandTemplate(quantityText,
-                            itemCountString);
+                        itemCountString);
                     Snackbar.make(view, message, Snackbar.LENGTH_SHORT).show();
                     return;
                 } else {
diff --git a/src/com/android/providers/media/photopicker/ui/TabFragment.java b/src/com/android/providers/media/photopicker/ui/TabFragment.java
index a35bb11..1ab6229 100644
--- a/src/com/android/providers/media/photopicker/ui/TabFragment.java
+++ b/src/com/android/providers/media/photopicker/ui/TabFragment.java
@@ -22,6 +22,7 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
+import android.widget.TextView;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -53,6 +54,7 @@
 
     private int mBottomBarSize;
     private ExtendedFloatingActionButton mProfileButton;
+    private TextView mEmptyTextView;
     private UserIdManager mUserIdManager;
     private boolean mHideProfileButton;
 
@@ -70,6 +72,9 @@
 
         mImageLoader = new ImageLoader(getContext());
         mRecyclerView = view.findViewById(R.id.picker_tab_recyclerview);
+        View emptyView = view.findViewById(android.R.id.empty);
+        mRecyclerView.setEmptyView(emptyView);
+        mEmptyTextView = emptyView.findViewById(R.id.empty_text_view);
         mRecyclerView.setHasFixedSize(true);
         mPickerViewModel = new ViewModelProvider(requireActivity()).get(PickerViewModel.class);
         mSelection = mPickerViewModel.getSelection();
@@ -120,6 +125,7 @@
     public void onResume() {
         super.onResume();
 
+        mEmptyTextView.setText(getEmptyMessage());
         updateProfileButtonAsync();
     }
 
@@ -232,6 +238,13 @@
         return bottomBarSize;
     }
 
+    /**
+     * Get the messages to show on empty view
+     */
+    protected String getEmptyMessage() {
+        return getString(R.string.picker_photos_empty_message);
+    }
+
     protected void hideProfileButton(boolean hide) {
         mHideProfileButton = hide;
         if (hide) {
diff --git a/src/com/android/providers/media/util/StringUtils.java b/src/com/android/providers/media/util/StringUtils.java
new file mode 100644
index 0000000..f73a58a
--- /dev/null
+++ b/src/com/android/providers/media/util/StringUtils.java
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package src.com.android.providers.media.util;
+
+import android.icu.text.MessageFormat;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import android.content.res.Resources;
+
+public class StringUtils {
+
+  /**
+   * Returns the formatted ICU format string corresponding to the provided resource ID and count
+   * number of entities in the plural string.
+   */
+  public static String getICUFormatString(Resources resources, int count, int resourceID) {
+    MessageFormat msgFormat = new MessageFormat(
+        resources.getString(resourceID),
+        Locale.getDefault());
+    Map<String, Object> arguments = new HashMap<>();
+    arguments.put("count", count);
+    return msgFormat.format(arguments);
+  }
+}
diff --git a/tests/src/com/android/providers/media/photopicker/espresso/NoItemsTest.java b/tests/src/com/android/providers/media/photopicker/espresso/NoItemsTest.java
new file mode 100644
index 0000000..7d78605
--- /dev/null
+++ b/tests/src/com/android/providers/media/photopicker/espresso/NoItemsTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+package com.android.providers.media.photopicker.espresso;
+
+import static androidx.test.espresso.Espresso.onView;
+import static androidx.test.espresso.action.ViewActions.click;
+import static androidx.test.espresso.assertion.ViewAssertions.matches;
+import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
+import static androidx.test.espresso.matcher.ViewMatchers.withId;
+import static androidx.test.espresso.matcher.ViewMatchers.withParent;
+import static androidx.test.espresso.matcher.ViewMatchers.withText;
+
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.not;
+
+import androidx.test.core.app.ActivityScenario;
+import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
+
+import com.android.providers.media.R;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4ClassRunner.class)
+public class NoItemsTest extends PhotoPickerBaseTest {
+
+    @BeforeClass
+    public static void setupClass() throws Exception {
+        PhotoPickerBaseTest.setupClass();
+        deleteFiles(/* invalidateMediaStore */ true);
+    }
+
+    /**
+     * Simple test to check we are able to launch PhotoPickerActivity with no items
+     */
+    @Test
+    public void testNoItems_Simple() {
+        try (ActivityScenario<PhotoPickerTestActivity> scenario = ActivityScenario.launch(
+                PhotoPickerBaseTest.getSingleSelectionIntent())) {
+            final int pickerTabRecyclerViewId = R.id.picker_tab_recyclerview;
+
+            onView(withId(pickerTabRecyclerViewId)).check(matches(not(isDisplayed())));
+            onView(withId(android.R.id.empty)).check(matches(isDisplayed()));
+            onView(withText(R.string.picker_photos_empty_message)).check(matches(isDisplayed()));
+
+            // Goto Albums page
+            onView(allOf(withText(R.string.picker_albums), withParent(withId(R.id.chip_container))))
+                    .perform(click());
+
+            onView(withId(pickerTabRecyclerViewId)).check(matches(not(isDisplayed())));
+            onView(withId(android.R.id.empty)).check(matches(isDisplayed()));
+            onView(withText(R.string.picker_albums_empty_message)).check(matches(isDisplayed()));
+        }
+    }
+}
diff --git a/tests/src/com/android/providers/media/photopicker/espresso/PhotoPickerActivityTest.java b/tests/src/com/android/providers/media/photopicker/espresso/PhotoPickerActivityTest.java
index cd6a6f1..cd995a8 100644
--- a/tests/src/com/android/providers/media/photopicker/espresso/PhotoPickerActivityTest.java
+++ b/tests/src/com/android/providers/media/photopicker/espresso/PhotoPickerActivityTest.java
@@ -35,6 +35,7 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.not;
 
 import android.app.Activity;
 
@@ -61,6 +62,7 @@
         onView(withId(R.id.toolbar)).check(matches(isDisplayed()));
         onView(withId(R.id.fragment_container)).check(matches(isDisplayed()));
         onView(withId(DRAG_BAR_ID)).check(matches(isDisplayed()));
+        onView(withId(android.R.id.empty)).check(matches(not(isDisplayed())));
         onView(withContentDescription("Navigate up")).perform(click());
         assertThat(mRule.getScenario().getResult().getResultCode()).isEqualTo(
                 Activity.RESULT_CANCELED);
diff --git a/tests/src/com/android/providers/media/photopicker/espresso/PhotoPickerBaseTest.java b/tests/src/com/android/providers/media/photopicker/espresso/PhotoPickerBaseTest.java
index 14a4881..76f0c78 100644
--- a/tests/src/com/android/providers/media/photopicker/espresso/PhotoPickerBaseTest.java
+++ b/tests/src/com/android/providers/media/photopicker/espresso/PhotoPickerBaseTest.java
@@ -163,14 +163,28 @@
 
     @AfterClass
     public static void destroyClass() {
-        IMAGE_1_FILE.delete();
-        IMAGE_2_FILE.delete();
-        VIDEO_FILE.delete();
+        deleteFiles(/* invalidateMediaStore */ false);
 
         InstrumentationRegistry.getInstrumentation()
                 .getUiAutomation().dropShellPermissionIdentity();
     }
 
+    protected static void deleteFiles(boolean invalidateMediaStore) {
+        deleteFile(IMAGE_1_FILE, invalidateMediaStore);
+        deleteFile(IMAGE_2_FILE, invalidateMediaStore);
+        deleteFile(VIDEO_FILE, invalidateMediaStore);
+    }
+
+    private static void deleteFile(File file, boolean invalidateMediaStore) {
+        file.delete();
+        if (invalidateMediaStore) {
+            final Uri uri = MediaStore.scanFile(getIsolatedContext().getContentResolver(), file);
+            assertThat(uri).isNull();
+            // Force picker db sync for that db operation
+            MediaStore.waitForIdle(getIsolatedContext().getContentResolver());
+        }
+    }
+
     private static void createFiles() throws Exception {
         long timeNow = System.currentTimeMillis();
         // Create files and change dateModified so that we can predict the recyclerView item
diff --git a/tools/photopicker-gradle/app/.gitignore b/tools/photopicker-gradle/app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/tools/photopicker-gradle/app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/tools/photopicker-gradle/app/build.gradle b/tools/photopicker-gradle/app/build.gradle
new file mode 100644
index 0000000..255b67e
--- /dev/null
+++ b/tools/photopicker-gradle/app/build.gradle
@@ -0,0 +1,34 @@
+plugins {
+    id 'com.android.application'
+}
+
+android {
+    compileSdk 30
+    compileSdkVersion 'android-SX'
+
+    defaultConfig {
+        applicationId "com.android.providers.media.tools.photopicker"
+        minSdk 16
+        targetSdk 30
+        versionCode 1
+        versionName "1.0"
+    }
+
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+        }
+    }
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
+}
+
+dependencies {
+
+    implementation 'androidx.appcompat:appcompat:1.2.0'
+    implementation 'com.google.android.material:material:1.3.0'
+    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
+}
\ No newline at end of file
diff --git a/tools/photopicker-gradle/app/proguard-rules.pro b/tools/photopicker-gradle/app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/tools/photopicker-gradle/app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/tools/photopicker-gradle/app/src/main/AndroidManifest.xml b/tools/photopicker-gradle/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..8ca3d10
--- /dev/null
+++ b/tools/photopicker-gradle/app/src/main/AndroidManifest.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.providers.media.tools.photopicker">
+
+    <application
+        android:allowBackup="true"
+        android:label="PhotoPickerTool"
+        android:supportsRtl="true">
+        <activity
+            android:name=".PhotoPickerToolActivity"
+            android:exported="true"
+            android:theme="@style/Theme.MaterialComponents.DayNight">
+            <intent-filter android:label="PhotoPickerTool">
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/tools/photopicker-gradle/app/src/main/java/com/android/providers/media/tools/photopicker/PhotoPickerToolActivity.java b/tools/photopicker-gradle/app/src/main/java/com/android/providers/media/tools/photopicker/PhotoPickerToolActivity.java
new file mode 100644
index 0000000..475c100
--- /dev/null
+++ b/tools/photopicker-gradle/app/src/main/java/com/android/providers/media/tools/photopicker/PhotoPickerToolActivity.java
@@ -0,0 +1,303 @@
+package com.android.providers.media.tools.photopicker;
+
+import static android.os.Build.VERSION.SDK_INT;
+import static android.provider.MediaStore.ACTION_PICK_IMAGES;
+import static android.provider.MediaStore.EXTRA_PICK_IMAGES_MAX;
+
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
+
+import android.content.ActivityNotFoundException;
+import android.content.ClipData;
+import android.content.Intent;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.ext.SdkExtensions;
+import android.provider.MediaStore;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.ScrollView;
+import android.widget.TextView;
+import android.widget.VideoView;
+
+import com.google.android.material.snackbar.Snackbar;
+
+public class PhotoPickerToolActivity extends AppCompatActivity {
+
+    private static final String TAG = "PhotoPickerToolActivity";
+    private static final int REQUEST_CODE = 42;
+
+    private int mMaxCount = 10;
+    private boolean mIsShowImageOnly;
+    private boolean mIsShowVideoOnly;
+    private boolean mSetMimeType;
+    private ScrollView mScrollView;
+
+    private CheckBox mSetImageOnlyCheckBox;
+    private CheckBox mSetVideoOnlyCheckBox;
+    private CheckBox mSetMimeTypeCheckBox;
+    private CheckBox mSetSelectionCountCheckBox;
+    private CheckBox mAllowMultipleCheckBox;
+    private CheckBox mGetContentCheckBox;
+    private EditText mMaxCountText;
+    private EditText mMimeTypeText;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.activity_main);
+
+        mAllowMultipleCheckBox = findViewById(R.id.cbx_allow_multiple);
+        mGetContentCheckBox = findViewById(R.id.cbx_get_content);
+        mSetImageOnlyCheckBox = findViewById(R.id.cbx_set_image_only);
+        mSetMimeTypeCheckBox = findViewById(R.id.cbx_set_mime_type);
+        mSetSelectionCountCheckBox = findViewById(R.id.cbx_set_selection_count);
+        mSetVideoOnlyCheckBox = findViewById(R.id.cbx_set_video_only);
+        mMaxCountText = findViewById(R.id.edittext_max_count);
+        mMimeTypeText = findViewById(R.id.edittext_mime_type);
+        mScrollView = findViewById(R.id.scrollview);
+
+        mSetImageOnlyCheckBox.setOnCheckedChangeListener(this::onShowImageOnlyCheckedChanged);
+        mSetVideoOnlyCheckBox.setOnCheckedChangeListener(this::onShowVideoOnlyCheckedChanged);
+        mSetMimeTypeCheckBox.setOnCheckedChangeListener(this::onSetMimeTypeCheckedChanged);
+        mSetSelectionCountCheckBox.setOnCheckedChangeListener(
+                this::onSetSelectionCountCheckedChanged);
+
+        mMaxCountText.addTextChangedListener(new TextWatcher() {
+            @Override
+            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+            }
+
+            @Override
+            public void onTextChanged(CharSequence s, int start, int before, int count) {
+            }
+
+            @Override
+            public void afterTextChanged(Editable s) {
+                try {
+                    mMaxCount = Integer.parseInt(mMaxCountText.getText().toString().trim());
+                } catch (NumberFormatException ex) {
+                    final String wrongFormatWarning =
+                            "The count format is wrong! Please input correct number!";
+                    Snackbar.make(mMaxCountText, wrongFormatWarning, Snackbar.LENGTH_LONG).show();
+                }
+            }
+        });
+
+        final Button launchButton = findViewById(R.id.launch_button);
+        launchButton.setOnClickListener(this::onLaunchButtonClicked);
+    }
+
+    private void onShowImageOnlyCheckedChanged(View view, boolean isChecked) {
+        if (mIsShowImageOnly == isChecked) {
+            return;
+        }
+
+        mIsShowImageOnly = isChecked;
+        if (isChecked) {
+            mSetVideoOnlyCheckBox.setChecked(false);
+            mSetMimeTypeCheckBox.setChecked(false);
+        }
+    }
+
+    private void onShowVideoOnlyCheckedChanged(View view, boolean isChecked) {
+        if (mIsShowVideoOnly == isChecked) {
+            return;
+        }
+
+        mIsShowVideoOnly = isChecked;
+        if (isChecked) {
+            mSetImageOnlyCheckBox.setChecked(false);
+            mSetMimeTypeCheckBox.setChecked(false);
+        }
+    }
+
+    private void onSetMimeTypeCheckedChanged(View view, boolean isChecked) {
+        if (mSetMimeType == isChecked) {
+            return;
+        }
+
+        mSetMimeType = isChecked;
+        if (isChecked) {
+            mSetImageOnlyCheckBox.setChecked(false);
+            mSetVideoOnlyCheckBox.setChecked(false);
+        }
+        mMimeTypeText.setEnabled(isChecked);
+    }
+
+    private void onSetSelectionCountCheckedChanged(View view, boolean isChecked) {
+        mMaxCountText.setEnabled(isChecked);
+    }
+
+    private void onLaunchButtonClicked(View view) {
+        final Intent intent;
+        if (mGetContentCheckBox.isChecked()) {
+            intent = new Intent(Intent.ACTION_GET_CONTENT);
+            intent.setType("*/*");
+        } else {
+            if (!isPhotoPickerAvailable()) {
+                logErrorAndShowToast("Photo Picker is not available on this device");
+                return;
+            }
+            intent = new Intent(ACTION_PICK_IMAGES);
+        }
+
+        if (mAllowMultipleCheckBox.isChecked()) {
+            if (mGetContentCheckBox.isChecked()) {
+                intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
+            } else {
+                intent.putExtra(EXTRA_PICK_IMAGES_MAX, MediaStore.getPickImagesMaxLimit());
+            }
+        }
+
+        if (mSetImageOnlyCheckBox.isChecked()) {
+            intent.setType("image/*");
+        } else if (mSetVideoOnlyCheckBox.isChecked()) {
+            intent.setType("video/*");
+        } else if (mSetMimeTypeCheckBox.isChecked()) {
+            final String mimeType = mMimeTypeText.getText().toString().trim();
+            intent.setType(mimeType);
+        }
+
+        if (mSetSelectionCountCheckBox.isChecked()) {
+            intent.putExtra(EXTRA_PICK_IMAGES_MAX, mMaxCount);
+        }
+
+        try {
+            startActivityForResult(intent, REQUEST_CODE);
+        } catch (ActivityNotFoundException ex){
+            final String errorMessage =
+                    "No Activity found to handle Intent with type \"" + intent.getType() + "\"";
+            logErrorAndShowToast(errorMessage);
+        }
+    }
+
+    private boolean isPhotoPickerAvailable() {
+        return SDK_INT >= Build.VERSION_CODES.R
+            && SdkExtensions.getExtensionVersion(Build.VERSION_CODES.R) >= 2;
+    }
+
+    private void logErrorAndShowToast(String errorMessage) {
+        Log.e(TAG, errorMessage);
+        Snackbar.make(mScrollView, errorMessage, Snackbar.LENGTH_LONG).show();
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+
+        if (resultCode == RESULT_CANCELED) {
+            Log.e(TAG, "The result code is canceled");
+            return;
+        };
+
+        if (requestCode != REQUEST_CODE) {
+            logErrorAndShowToast("The request code is not as we expected");
+            return;
+        }
+
+        if (data == null) {
+            logErrorAndShowToast("The result intent is null");
+            return;
+        }
+
+        final Uri uri = data.getData();
+        if (uri == null && data.getClipData() == null) {
+            logErrorAndShowToast("The uri and clipData of result intent is null");
+            return;
+        }
+
+        final LinearLayout itemContainer = findViewById(R.id.item_container);
+        final int itemSize = (int) (300 * getResources().getDisplayMetrics().density);
+        final LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(itemSize, itemSize);
+        params.gravity = Gravity.CENTER;
+        itemContainer.removeAllViews();
+        if (uri != null) {
+            itemContainer.addView(generateText(uri.toString()));
+            itemContainer.addView(generateItems(uri, params));
+        } else {
+            final ClipData clipData = data.getClipData();
+            final int count = clipData.getItemCount();
+            for (int i = 0; i < count; i++) {
+                Uri item = (Uri) clipData.getItemAt(i).getUri();
+                itemContainer.addView(generateText("" + i + ". " + item.toString()));
+                itemContainer.addView(generateItems(item, params));
+            }
+            // scroll to first item
+            mScrollView.smoothScrollTo(0, 0);
+        }
+    }
+
+    private TextView generateText(String text) {
+        final TextView textView = new TextView(this);
+        textView.setTextAppearance(R.style.HeaderTitle);
+        textView.setText(text);
+        return textView;
+    }
+
+    private View generateItems(Uri uri, LinearLayout.LayoutParams params) {
+        String mimeType = null;
+        // TODO: after getType issue is fixed, change to use getType
+        try (Cursor cursor = getContentResolver().query(uri,
+                new String[]{MediaStore.Files.FileColumns.MIME_TYPE}, null, null, null, null)) {
+            cursor.moveToFirst();
+            mimeType = cursor.getString(0);
+        }
+
+        if (isVideoMimeType(mimeType)) {
+            return generateVideoView(uri, params);
+        } else {
+            return generateImageView(uri, params);
+        }
+    }
+
+    private VideoView generateVideoView(Uri uri, LinearLayout.LayoutParams params) {
+        final VideoView video = new VideoView(this);
+        video.setLayoutParams(params);
+        video.setVideoURI(uri);
+        video.setOnPreparedListener(mp -> {
+            mp.setLooping(true);
+            mp.seekTo(0);
+            mp.start();
+        });
+        return video;
+    }
+
+    private ImageView generateImageView(Uri uri, LinearLayout.LayoutParams params) {
+        final ImageView image = new ImageView(this);
+        image.setLayoutParams(params);
+        image.setScaleType(ImageView.ScaleType.CENTER_CROP);
+        image.setImageURI(uri);
+        return image;
+    }
+
+    private static boolean isVideoMimeType(@Nullable String mimeType) {
+        if (mimeType == null) {
+            return false;
+        }
+        return startsWithIgnoreCase(mimeType, "video/");
+    }
+
+    /**
+     * Variant of {@link String#startsWith(String)} but which tests with case-insensitivity.
+     */
+    private static boolean startsWithIgnoreCase(@Nullable String target, @Nullable String other) {
+        if (target == null || other == null) {
+            return false;
+        }
+        if (other.length() >= target.length()) {
+            return false;
+        }
+        return target.regionMatches(true, 0, other, 0, other.length());
+    }
+}
diff --git a/tools/photopicker-gradle/app/src/main/res/layout/activity_main.xml b/tools/photopicker-gradle/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..c900517
--- /dev/null
+++ b/tools/photopicker-gradle/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ Copyright 2021 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
+
+     https://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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <CheckBox
+        android:id="@+id/cbx_get_content"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="ACTION_GET_CONTENT"
+        android:textSize="16sp" />
+
+    <CheckBox
+        android:id="@+id/cbx_allow_multiple"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="ALLOW MULTIPLE"
+        android:textSize="16sp" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+
+        <CheckBox
+            android:id="@+id/cbx_set_image_only"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="SHOW IMAGE ONLY"
+            android:textSize="16sp" />
+
+        <CheckBox
+            android:id="@+id/cbx_set_video_only"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="SHOW VIDEO ONLY"
+            android:textSize="16sp" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+
+        <CheckBox
+            android:id="@+id/cbx_set_mime_type"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="SET MIME TYPE"
+            android:textSize="16sp" />
+
+        <EditText
+            android:id="@+id/edittext_mime_type"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:enabled="false"
+            android:textSize="16sp" />
+    </LinearLayout>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+
+        <CheckBox
+            android:id="@+id/cbx_set_selection_count"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="SET SELECTION COUNT"
+            android:textSize="16sp" />
+
+        <EditText
+            android:id="@+id/edittext_max_count"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:gravity="center"
+            android:enabled="false"
+            android:text="10"
+            android:textSize="16sp" />
+    </LinearLayout>
+
+    <Button
+        android:id="@+id/launch_button"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="Launch"
+        android:textSize="16sp" />
+
+    <ScrollView
+        android:id="@+id/scrollview"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <LinearLayout
+            android:id="@+id/item_container"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="vertical" />
+    </ScrollView>
+</LinearLayout>
diff --git a/tools/photopicker-gradle/app/src/main/res/values/styles.xml b/tools/photopicker-gradle/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..3ad1215
--- /dev/null
+++ b/tools/photopicker-gradle/app/src/main/res/values/styles.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+
+<resources xmlns:tools="http://schemas.android.com/tools">
+    <style name="HeaderTitle"
+        parent="@android:style/TextAppearance.DeviceDefault.DialogWindowTitle">
+        <item name="android:textColor">?android:attr/textColorPrimary</item>
+    </style>
+</resources>
diff --git a/tools/photopicker-gradle/build.gradle b/tools/photopicker-gradle/build.gradle
new file mode 100644
index 0000000..7cbb664
--- /dev/null
+++ b/tools/photopicker-gradle/build.gradle
@@ -0,0 +1,17 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+buildscript {
+    repositories {
+        google()
+        mavenCentral()
+    }
+    dependencies {
+        classpath "com.android.tools.build:gradle:7.0.3"
+
+        // NOTE: Do not place your application dependencies here; they belong
+        // in the individual module build.gradle files
+    }
+}
+
+task clean(type: Delete) {
+    delete rootProject.buildDir
+}
\ No newline at end of file
diff --git a/tools/photopicker-gradle/gradle.properties b/tools/photopicker-gradle/gradle.properties
new file mode 100644
index 0000000..52f5917
--- /dev/null
+++ b/tools/photopicker-gradle/gradle.properties
@@ -0,0 +1,19 @@
+# Project-wide Gradle settings.
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true
+# AndroidX package structure to make it clearer which packages are bundled with the
+# Android operating system, and which are packaged with your app"s APK
+# https://developer.android.com/topic/libraries/support-library/androidx-rn
+android.useAndroidX=true
+# Automatically convert third-party libraries to use AndroidX
+android.enableJetifier=true
\ No newline at end of file
diff --git a/tools/photopicker-gradle/gradle/wrapper/gradle-wrapper.jar b/tools/photopicker-gradle/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..e708b1c
--- /dev/null
+++ b/tools/photopicker-gradle/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/tools/photopicker-gradle/gradle/wrapper/gradle-wrapper.properties b/tools/photopicker-gradle/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..1a33dec
--- /dev/null
+++ b/tools/photopicker-gradle/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Nov 24 17:14:38 GMT 2021
+distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
+distributionPath=wrapper/dists
+zipStorePath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
diff --git a/tools/photopicker-gradle/gradlew b/tools/photopicker-gradle/gradlew
new file mode 100755
index 0000000..4f906e0
--- /dev/null
+++ b/tools/photopicker-gradle/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# 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
+#
+#      https://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.
+#
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn () {
+    echo "$*"
+}
+
+die () {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+  NONSTOP* )
+    nonstop=true
+    ;;
+esac
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+    JAVACMD=`cygpath --unix "$JAVACMD"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=`expr $i + 1`
+    done
+    case $i in
+        0) set -- ;;
+        1) set -- "$args0" ;;
+        2) set -- "$args0" "$args1" ;;
+        3) set -- "$args0" "$args1" "$args2" ;;
+        4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Escape application args
+save () {
+    for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+    echo " "
+}
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+exec "$JAVACMD" "$@"
diff --git a/tools/photopicker-gradle/gradlew.bat b/tools/photopicker-gradle/gradlew.bat
new file mode 100644
index 0000000..ac1b06f
--- /dev/null
+++ b/tools/photopicker-gradle/gradlew.bat
@@ -0,0 +1,89 @@
+@rem

+@rem Copyright 2015 the original author or authors.

+@rem

+@rem Licensed under the Apache License, Version 2.0 (the "License");

+@rem you may not use this file except in compliance with the License.

+@rem You may obtain a copy of the License at

+@rem

+@rem      https://www.apache.org/licenses/LICENSE-2.0

+@rem

+@rem Unless required by applicable law or agreed to in writing, software

+@rem distributed under the License is distributed on an "AS IS" BASIS,

+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+@rem See the License for the specific language governing permissions and

+@rem limitations under the License.

+@rem

+

+@if "%DEBUG%" == "" @echo off

+@rem ##########################################################################

+@rem

+@rem  Gradle startup script for Windows

+@rem

+@rem ##########################################################################

+

+@rem Set local scope for the variables with windows NT shell

+if "%OS%"=="Windows_NT" setlocal

+

+set DIRNAME=%~dp0

+if "%DIRNAME%" == "" set DIRNAME=.

+set APP_BASE_NAME=%~n0

+set APP_HOME=%DIRNAME%

+

+@rem Resolve any "." and ".." in APP_HOME to make it shorter.

+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

+

+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.

+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

+

+@rem Find java.exe

+if defined JAVA_HOME goto findJavaFromJavaHome

+

+set JAVA_EXE=java.exe

+%JAVA_EXE% -version >NUL 2>&1

+if "%ERRORLEVEL%" == "0" goto execute

+

+echo.

+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

+echo.

+echo Please set the JAVA_HOME variable in your environment to match the

+echo location of your Java installation.

+

+goto fail

+

+:findJavaFromJavaHome

+set JAVA_HOME=%JAVA_HOME:"=%

+set JAVA_EXE=%JAVA_HOME%/bin/java.exe

+

+if exist "%JAVA_EXE%" goto execute

+

+echo.

+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%

+echo.

+echo Please set the JAVA_HOME variable in your environment to match the

+echo location of your Java installation.

+

+goto fail

+

+:execute

+@rem Setup the command line

+

+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

+

+

+@rem Execute Gradle

+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

+

+:end

+@rem End local scope for the variables with windows NT shell

+if "%ERRORLEVEL%"=="0" goto mainEnd

+

+:fail

+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of

+rem the _cmd.exe /c_ return code!

+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1

+exit /b 1

+

+:mainEnd

+if "%OS%"=="Windows_NT" endlocal

+

+:omega

diff --git a/tools/photopicker-gradle/settings.gradle b/tools/photopicker-gradle/settings.gradle
new file mode 100644
index 0000000..e09bea4
--- /dev/null
+++ b/tools/photopicker-gradle/settings.gradle
@@ -0,0 +1,10 @@
+dependencyResolutionManagement {
+    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
+    repositories {
+        google()
+        mavenCentral()
+        jcenter() // Warning: this repository is going to shut down soon
+    }
+}
+rootProject.name = "photopicker"
+include ':app'