README
1#############################################
2 ___ _ _ _ _
3 | _ \ |_ ___| |_ ___ _ __(_)__| |_____ _ _
4 | _/ ' \/ _ \ _/ _ \ '_ \ / _| / / -_) '_|
5 |_| |_||_\___/\__\___/ .__/_\__|_\_\___|_|
6 |_|
7#############################################
8NOTE: This Photopicker application is currently being developed for
9Android API level 33+. It is intended as a drop-in replacement to the
10legacy java application. If you are working on a pre API 33 OS, you
11might be looking for:
12
13/packages/providers/MediaProvider/src/com/android/providers/media/photopicker
14
15#############################################
16# To install for development / testing:
17#############################################
18
19Photopicker is bundled in the MediaProvider apex, so building that module will
20include the Photopicker APK. It is not recommended to build Photopicker as as a
21standalone application, as it relies on pregranted permissions that it obtains via
22its bundling in the MediaProvider apex.
23
24It is very important that Photopicker apk is signed by the same certificate as the
25installed MediaProvider.apk. Photopicker relies on signature permissions declared in
26MediaProvider, and will fail to obtain them if signed separately.
27
28Additionally, the DeviceConfig `enable_modern_picker` in the `mediaprovider` namespace
29needs to be enabled to `true` in order for the new photopicker to become active.
30
31```adb shell device_config put mediaprovider enable_modern_picker true`
32
33#############################################
34# Troubleshooting
35#############################################
36
37Launching ACTION_PICK_IMAGES or ACTION_GET_CONTENT should bring you into the new
38PhotopickerActivity. If not, try debugging the intents to see if the activity
39is getting picked up by Android:
40
41adb shell pm query-activities -a "android.intent.action.GET_CONTENT" -t "image/*"
42
43This should give a print out of all activities (and their respective priorities)
44that can handle this intent and com.android.photopicker.MainActivity should be
45in the list. If not, try the installation steps above again. (Be sure to reboot)
46
47
48#############################################
49# Testing
50#############################################
51To run the tests:
52
53atest PhotopickerTests
54
55Note: PhotopickerTests bundles the application code with the tests, so the
56app does not need to be installed first for the test suite to be run. The test
57suite will bring along all the code it needs.
58