k3b / CameraFolder

When "Camera Folder" is installed many Android-Apps that can open jpg files can also take a photo from camera.
GNU General Public License v3.0
38 stars 4 forks source link

Since Android 11 not all camera apps are selectable #5

Open rugk opened 2 years ago

rugk commented 2 years ago

STR

  1. Install the app.
  2. Use it and you can only choose the default camera app: camer-app-selection

System

Device: Pixel 4 OS: Android 12, CalyxOS 3.2.0 source: F-Droid version: v5.3.1

Problem

I've reported this to the camera apps like https://github.com/SimpleMobileTools/Simple-Camera-Abandoned/issues/310 or OpenCamera. Apparently, the issue is however an Android one related to how camera apps are handled since Android 11. See See https://www.xda-developers.com/android-11-blocks-third-party-camera-apps-appearing-image-video-picking-intents/

In case I understood it correctly, the calling app needs to whitelist all the camera apps it wants the user to be able to choose.

So could we go though F-Droid at least and whitelist all good/known camera apps? This app here is pretty useless without that…

I'd specifically suggest these:

k3b commented 2 years ago

thanks for info.

if i understood https://commonsware.com/blog/2020/08/16/action-image-capture-android-r.html correctly

ACTION_IMAGE_CAPTURE. need EXTRA_INITIAL_INTENTS with a list to other existing, known apps as implemented in

https://gitlab.com/commonsguy/cw-android-r/-/blob/v0.3/CamChooser/src/main/java/com/commonsware/android/r/camchooser/CameraIntent.kt

k3b commented 2 years ago

i have added code that should fix the issue for "opencamera" and "simple camera".

unfortunately i cannot test the changes because i have no android-11 or android-12 device and the emulator does not run on my machine.

@rugk can you test my changes and confirm that the changes work for you? the latest debug build can be found here:

https://github.com/k3b/CameraFolder/releases/download/v1.0.1/CameraFolder-debug-102.apk

you must uninstall the f-droid installation first before you can install this debug version.

[Update 2022-03-02]

I also asked on reddit to find somebody who can test this fix with android-11.

[Update 2022-03-03]

this versoin did not work. see comment below with new apk version

har-nick commented 2 years ago

Using the same workflow you mentioned in your readme, the app crashes when selecting it in the file drawer

Logcat ``` 03-02 18:33:33.596 1718 1962 I ActivityManager: Start proc 20766:de.k3b.android.camerafolder.debug/u0a22 for pre-top-activity {de.k3b.android.camerafolder.debug/de.k3b.android.camerafolder.GetDocument2CameraActivity} 03-02 18:33:33.599 20766 20766 I libc : SetHeapTaggingLevel: tag level set to 0 03-02 18:33:33.601 20766 20766 I erafolder.debu: Late-enabling -Xcheck:jni 03-02 18:33:33.622 1422 1487 I adbd : jdwp connection from 20766 03-02 18:33:33.624 20766 20766 D ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument 03-02 18:33:33.649 20766 20766 D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10022; state: DISABLED 03-02 18:33:33.655 20766 20766 D ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar 03-02 18:33:33.678 20766 20766 V GraphicsEnvironment: ANGLE Developer option for 'de.k3b.android.camerafolder.debug' set to: 'default' 03-02 18:33:33.680 20766 20766 V GraphicsEnvironment: ANGLE GameManagerService for de.k3b.android.camerafolder.debug: false 03-02 18:33:33.680 20766 20766 V GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported. 03-02 18:33:33.682 20766 20766 D NetworkSecurityConfig: No Network Security Config specified, using platform default 03-02 18:33:33.683 20766 20766 D NetworkSecurityConfig: No Network Security Config specified, using platform default 03-02 18:33:33.707 20766 20766 I k3b.camerafolder: additional known camera app added 'net.sourceforge.opencamera' = ResolveInfo{72c1414 net.sourceforge.opencamera/.MainActivity m=0x108000} 03-02 18:33:33.711 1718 16157 I ActivityTaskManager: START u0 {act=android.media.action.IMAGE_CAPTURE flg=0x3 clip={text/uri-list hasLabel(0) {U(content)}} (has extras)} from uid 10022 03-02 18:33:33.711 20766 20766 D AndroidRuntime: Shutting down VM 03-02 18:33:33.713 20766 20766 E AndroidRuntime: FATAL EXCEPTION: main 03-02 18:33:33.713 20766 20766 E AndroidRuntime: Process: de.k3b.android.camerafolder.debug, PID: 20766 03-02 18:33:33.713 20766 20766 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{de.k3b.android.camerafolder.debug/de.k3b.android.camerafolder.GetDocument2CameraActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 clip={text/uri-list hasLabel(0) {U(content)}} (has extras) } 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3635) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7839) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 clip={text/uri-list hasLabel(0) {U(content)}} (has extras) } 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2087) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1747) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:5403) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:5361) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at de.k3b.android.camerafolder.GetDocument2CameraActivity.onRequestPhoto(GetDocument2CameraActivity.java:124) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at de.k3b.android.camerafolder.GetDocument2CameraActivity.onCreate(GetDocument2CameraActivity.java:84) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8050) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8030) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608) 03-02 18:33:33.713 20766 20766 E AndroidRuntime: ... 12 more 03-02 18:33:33.715 1718 20787 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2 03-02 18:33:33.716 1718 16157 W ActivityTaskManager: Force finishing activity de.k3b.android.camerafolder.debug/de.k3b.android.camerafolder.GetDocument2CameraActivity 03-02 18:33:33.720 20766 20766 I Process : Sending signal. PID: 20766 SIG: 9 03-02 18:33:33.729 1718 16157 I ActivityManager: Process de.k3b.android.camerafolder.debug (pid 20766) has died: fg TOP 03-02 18:33:33.731 964 964 I Zygote : Process 20766 exited due to signal 9 (Killed) 03-02 18:33:33.731 1718 1966 I libprocessgroup: Successfully killed process cgroup uid 10022 pid 20766 in 1ms 03-02 18:33:33.741 1718 16157 I ActivityManager: Killing 19011:com.android.permissioncontroller/u10a176 (adj 965): empty #17 03-02 18:33:33.748 1718 1966 I libprocessgroup: Successfully killed process cgroup uid 1010176 pid 19011 in 6ms 03-02 18:33:33.764 964 964 I Zygote : Process 19011 exited due to signal 9 (Killed) ```

I tested it with Camera PX and OpenCamera installed.

k3b commented 2 years ago

@har-nick thanks a lot for testing.

camera found

03-02 18:33:33.707 20766 20766 I k3b.camerafolder: -- additional known camera app added 'net.sourceforge.opencamera' = ResolveInfo{72c1414 net.sourceforge.opencamera/.MainActivity m=0x108000}

but cannot start

de.k3b.android.camerafolder.GetDocument2CameraActivity}: android.content.ActivityNotFoundException: -- No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 clip={text/uri-list hasLabel(0) {U(content)}} (has extras) }

This topic needs further investigation :-(

k3b commented 2 years ago

@har-nick

In https://stackoverflow.com/questions/63246442/android-11-r-return-empty-list-when-querying-intent-for-action-image-capture i found that i need an additional <queries/> entry in manifest file when compiling with android api 30 and later to make it work.

I have added this to the sources and the latest build

https://github.com/k3b/CameraFolder/releases/download/v1.0.1/CameraFolder-debug-102-3.apk

May i ask you to test this version again?

har-nick commented 2 years ago

Seems like the same issue, sorry

Logcat ``` 03-03 12:47:09.252 1668 1863 I ActivityManager: Start proc 14898:de.k3b.android.camerafolder.debug/u0a22 for pre-top-activity {de.k3b.android.camerafolder.debug/de.k3b.android.camerafolder.GetDocument2CameraActivity} 03-03 12:47:09.257 14898 14898 I libc : SetHeapTaggingLevel: tag level set to 0 03-03 12:47:09.260 14898 14898 I erafolder.debu: Late-enabling -Xcheck:jni 03-03 12:47:09.287 14898 14898 D ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument 03-03 12:47:09.288 1387 1430 I adbd : jdwp connection from 14898 03-03 12:47:09.312 14898 14898 D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10022; state: DISABLED 03-03 12:47:09.318 14898 14898 D ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar 03-03 12:47:09.345 14898 14898 V GraphicsEnvironment: ANGLE Developer option for 'de.k3b.android.camerafolder.debug' set to: 'default' 03-03 12:47:09.345 14898 14898 V GraphicsEnvironment: ANGLE GameManagerService for de.k3b.android.camerafolder.debug: false 03-03 12:47:09.345 14898 14898 V GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported. 03-03 12:47:09.347 14898 14898 D NetworkSecurityConfig: No Network Security Config specified, using platform default 03-03 12:47:09.348 14898 14898 D NetworkSecurityConfig: No Network Security Config specified, using platform default 03-03 12:47:09.380 14898 14898 I k3b.camerafolder: known camera app added 'net.sourceforge.opencamera' = ResolveInfo{37e3009 net.sourceforge.opencamera/.MainActivity m=0x108000} 03-03 12:47:09.384 1668 3453 I ActivityTaskManager: START u0 {act=android.media.action.IMAGE_CAPTURE flg=0x3 clip={text/uri-list hasLabel(0) {U(content)}} (has extras)} from uid 10022 03-03 12:47:09.385 14898 14898 D AndroidRuntime: Shutting down VM --------- beginning of crash 03-03 12:47:09.388 14898 14898 E AndroidRuntime: FATAL EXCEPTION: main 03-03 12:47:09.388 14898 14898 E AndroidRuntime: Process: de.k3b.android.camerafolder.debug, PID: 14898 03-03 12:47:09.388 14898 14898 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{de.k3b.android.camerafolder.debug/de.k3b.android.camerafolder.GetDocument2CameraActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 clip={text/uri-list hasLabel(0) {U(content)}} (has extras) } 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3635) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3792) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7839) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)03-03 12:47:09.388 14898 14898 E AndroidRuntime: Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 clip={text/uri-list hasLabel(0) {U(content)}} (has extras) } 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2087) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.Instrumentation.execStartActivity(Instrumentation.java:1747) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:5403) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.Activity.startActivityForResult(Activity.java:5361) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at de.k3b.android.camerafolder.GetDocument2CameraActivity.onRequestPhoto(GetDocument2CameraActivity.java:126) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at de.k3b.android.camerafolder.GetDocument2CameraActivity.onCreate(GetDocument2CameraActivity.java:86) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8050) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8030) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1329) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3608) 03-03 12:47:09.388 14898 14898 E AndroidRuntime: ... 12 more 03-03 12:47:09.391 1668 14918 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2 03-03 12:47:09.393 1668 3453 W ActivityTaskManager: Force finishing activity de.k3b.android.camerafolder.debug/de.k3b.android.camerafolder.GetDocument2CameraActivity 03-03 12:47:09.396 14898 14898 I Process : Sending signal. PID: 14898 SIG: 9 03-03 12:47:09.403 1668 3453 I ActivityManager: Process de.k3b.android.camerafolder.debug (pid 14898) has died: fg TOP 03-03 12:47:09.404 1668 1869 I libprocessgroup: Successfully killed process cgroup uid 10022 pid 14898 in 0ms 03-03 12:47:09.406 973 973 I Zygote : Process 14898 exited due to signal 9 (Killed) ```
k3b commented 2 years ago

thanks again for testing.

i ask on stackoverflow what is wrong: https://stackoverflow.com/questions/71338593/action-image-capture-how-to-whitelist-a-different-camerapp-in-android-11-and-la

k3b commented 2 years ago

I have added a stackoverflow-bounty to https://stackoverflow.com/questions/71338593/action-image-capture-how-to-whitelist-a-different-camerapp-in-android-11-and-la but no answer yet.