summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
author Corina <corinac@google.com> 2021-11-25 15:26:03 +0000
committer Corina <corinac@google.com> 2021-11-25 15:35:37 +0000
commit25cb0ae98b0b98e375d61d36a9ab24aaca43afe1 (patch)
tree1b2b9ecc200381d7b0460a0e181ce57e18e0e950 /tools
parentf5a0e4cee87df5e54deb097c1c6cb70398b8d714 (diff)
Photo Picker test app using special SDK and gradle
Bug: 192304192 Test: Run on SX SDK emulator from Android Studio Change-Id: Id275312d259342467492b8f7c909d01ed349cd48
Diffstat (limited to 'tools')
-rw-r--r--tools/photopicker-gradle/app/.gitignore1
-rw-r--r--tools/photopicker-gradle/app/build.gradle34
-rw-r--r--tools/photopicker-gradle/app/proguard-rules.pro21
-rw-r--r--tools/photopicker-gradle/app/src/main/AndroidManifest.xml19
-rw-r--r--tools/photopicker-gradle/app/src/main/java/com/android/providers/media/tools/photopicker/PhotoPickerToolActivity.java303
-rw-r--r--tools/photopicker-gradle/app/src/main/res/layout/activity_main.xml121
-rw-r--r--tools/photopicker-gradle/app/src/main/res/values/styles.xml22
-rw-r--r--tools/photopicker-gradle/build.gradle17
-rw-r--r--tools/photopicker-gradle/gradle.properties19
-rw-r--r--tools/photopicker-gradle/gradle/wrapper/gradle-wrapper.jarbin0 -> 59203 bytes
-rw-r--r--tools/photopicker-gradle/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xtools/photopicker-gradle/gradlew185
-rw-r--r--tools/photopicker-gradle/gradlew.bat89
-rw-r--r--tools/photopicker-gradle/settings.gradle10
14 files changed, 847 insertions, 0 deletions
diff --git a/tools/photopicker-gradle/app/.gitignore b/tools/photopicker-gradle/app/.gitignore
new file mode 100644
index 000000000..42afabfd2
--- /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 000000000..255b67ed2
--- /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 000000000..481bb4348
--- /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 000000000..8ca3d10b8
--- /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 000000000..475c10022
--- /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 000000000..c900517b9
--- /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 000000000..3ad12154d
--- /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 000000000..7cbb66447
--- /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 000000000..52f5917cb
--- /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 000000000..e708b1c02
--- /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 000000000..1a33dec32
--- /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 000000000..4f906e0c8
--- /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 000000000..ac1b06f93
--- /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 000000000..e09bea455
--- /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'