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