Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: termux-camera-photo returns empty file - error in logcat #514

Open
Duvio opened this issue May 12, 2022 · 2 comments
Open

[Bug]: termux-camera-photo returns empty file - error in logcat #514

Duvio opened this issue May 12, 2022 · 2 comments

Comments

@Duvio
Copy link

Duvio commented May 12, 2022

Problem description

When trying to take a picture using termux-camera-photo it most often works, but after having Termux run a long time in background, that command stops working properly. Instead of taking a picture and saving it in the provided file, it just writes zero bytes.

logcats output is:

05-12 23:31:52.657 23666 23666 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10533 <<<<<<                                      05-12 23:31:52.661 23666 23666 E libc    : Access denied finding property "persist.device_config.runtime_native_boot.profilebootclasspath"              05-12 23:31:52.661 23666 23666 E libc    : Access denied finding property "persist.device_config.runtime_native_boot.enable_apex_image"
05-12 23:31:52.661 23666 23666 I AndroidRuntime: Using default boot image                                                                               05-12 23:31:52.661 23666 23666 E libc    : Access denied finding property "persist.device_config.runtime_native_boot.disable_lock_profiling"            05-12 23:31:52.661 23666 23666 I AndroidRuntime: Leaving lock profiling enabled                                                                         05-12 23:31:52.662 23666 23666 E libc    : Access denied finding property "persist.device_config.runtime_native_boot.enable_generational_cc"
05-12 23:31:52.662 23666 23666 D SecNativeFeatureCppIf: encoded                                                                                         05-12 23:31:52.662 23666 23666 D SecNativeFeatureCppIf: decoding and unzip finish                                                                       05-12 23:31:52.662 23666 23666 D SecNativeFeatureCppIf: use unCompDataBuff. encoded                                                                     05-12 23:31:52.662 23666 23666 D SecNativeFeatureCppIf: Free unCompDataBuff                                                                             05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: encoded                                                                                         05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: decoding and unzip finish                                                                       05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: use unCompDataBuff. encoded                                                                     05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: Free unCompDataBuff
05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: encoded                                                                                         05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: decoding and unzip finish
05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: use unCompDataBuff. encoded                                                                     05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: Free unCompDataBuff                                                                             05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: encoded
05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: decoding and unzip finish
05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: use unCompDataBuff. encoded                                                                     05-12 23:31:52.663 23666 23666 D SecNativeFeatureCppIf: Free unCompDataBuff
05-12 23:31:52.663 23666 23666 D AndroidRuntime: addProductProperty: pBrand1 is not null
05-12 23:31:52.663 23666 23666 D AndroidRuntime: addProductProperty: not brand or 7                                                                     05-12 23:31:52.805 23666 23666 D app_process: Time zone APEX ICU file found: /apex/com.android.tzdata/etc/icu/icu_tzdata.dat                            05-12 23:31:52.805 23666 23666 D app_process: I18n APEX ICU file found: /apex/com.android.i18n/etc/icu/icudt66l.dat                                     05-12 23:31:52.831 23666 23666 E SemDvfsManager_JNI: SemDvfsManager: registerfunction enter                                                             05-12 23:31:52.831 23666 23666 E SemAffinityControl: SemAffinityControl: registerfunction enter                                                         05-12 23:31:52.832 23666 23666 W app_process: JNI RegisterNativeMethods: attempt to register 0 native methods for android.media.AudioAttributes         05-12 23:31:52.840 23666 23666 D AndroidRuntime: Calling main entry com.termux.termuxam.Am
05-12 23:31:52.886  4950 23680 E termux-api: Error getting camera
05-12 23:31:52.886  4950 23680 E termux-api: android.hardware.camera2.CameraAccessException: CAMERA_DISABLED (1): connectHelper:2116: Camera "2" disabled by policy                                                                                                                                             05-12 23:31:52.886  4950 23680 E termux-api:    at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:1340)
05-12 23:31:52.886  4950 23680 E termux-api:    at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:714)             05-12 23:31:52.886  4950 23680 E termux-api:    at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:895)
05-12 23:31:52.886  4950 23680 E termux-api:    at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:823)
05-12 23:31:52.886  4950 23680 E termux-api:    at com.termux.api.m1.j(Unknown Source:26)                                                               05-12 23:31:52.886  4950 23680 E termux-api:    at com.termux.api.m1.c(Unknown Source:37)                                                               05-12 23:31:52.886  4950 23680 E termux-api:    at com.termux.api.e0.a(Unknown Source:8)                                                                05-12 23:31:52.886  4950 23680 E termux-api:    at com.termux.api.util.b.b(Unknown Source:89)                                                           05-12 23:31:52.886  4950 23680 E termux-api:    at com.termux.api.util.a.run(Unknown Source:8)                                                          05-12 23:31:52.886  4950 23680 E termux-api:    at java.lang.Thread.run(Thread.java:923)                                                                05-12 23:31:52.886  4950 23680 E termux-api: Caused by: android.os.ServiceSpecificException: connectHelper:2116: Camera "2" disabled by policy (code 6)
05-12 23:31:52.886  4950 23680 E termux-api:    at android.os.Parcel.createExceptionOrNull(Parcel.java:2399)
05-12 23:31:52.886  4950 23680 E termux-api:    at android.os.Parcel.createException(Parcel.java:2369)                                                  05-12 23:31:52.886  4950 23680 E termux-api:    at android.os.Parcel.readException(Parcel.java:2352)
05-12 23:31:52.886  4950 23680 E termux-api:    at android.os.Parcel.readException(Parcel.java:2294)                                                    05-12 23:31:52.886  4950 23680 E termux-api:    at android.hardware.ICameraService$Stub$Proxy.connectDevice(ICameraService.java:767)                    05-12 23:31:52.886  4950 23680 E termux-api:    at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:681)             05-12 23:31:52.886  4950 23680 E termux-api:    ... 8 more                                                                                              05-12 23:31:52.889 23666 23666 D AndroidRuntime: Shutting down VM                                                                                       05-12 23:31:53.118 23687 23687 D AndroidRuntime: >>>>>> START com.android.internal.os.RuntimeInit uid 10533 <<<<<<
05-12 23:31:53.122 23687 23687 E libc    : Access denied finding property "persist.device_config.runtime_native_boot.profilebootclasspath"              05-12 23:31:53.122 23687 23687 E libc    : Access denied finding property "persist.device_config.runtime_native_boot.enable_apex_image"                 05-12 23:31:53.122 23687 23687 I AndroidRuntime: Using default boot image
05-12 23:31:53.122 23687 23687 E libc    : Access denied finding property "persist.device_config.runtime_native_boot.disable_lock_profiling"            05-12 23:31:53.122 23687 23687 I AndroidRuntime: Leaving lock profiling enabled                                                                         05-12 23:31:53.122 23687 23687 E libc    : Access denied finding property "persist.device_config.runtime_native_boot.enable_generational_cc"
05-12 23:31:53.123 23687 23687 D SecNativeFeatureCppIf: encoded                                                                                         05-12 23:31:53.123 23687 23687 D SecNativeFeatureCppIf: decoding and unzip finish                                                                       05-12 23:31:53.123 23687 23687 D SecNativeFeatureCppIf: use unCompDataBuff. encoded                                                                     05-12 23:31:53.123 23687 23687 D SecNativeFeatureCppIf: Free unCompDataBuff                                                                             05-12 23:31:53.123 23687 23687 D SecNativeFeatureCppIf: encoded
05-12 23:31:53.123 23687 23687 D SecNativeFeatureCppIf: decoding and unzip finish                                                                       05-12 23:31:53.123 23687 23687 D SecNativeFeatureCppIf: use unCompDataBuff. encoded                                                                     05-12 23:31:53.123 23687 23687 D SecNativeFeatureCppIf: Free unCompDataBuff                                                                             05-12 23:31:53.123 23687 23687 D SecNativeFeatureCppIf: encoded                                                                                         05-12 23:31:53.124 23687 23687 D SecNativeFeatureCppIf: decoding and unzip finish
05-12 23:31:53.124 23687 23687 D SecNativeFeatureCppIf: use unCompDataBuff. encoded
05-12 23:31:53.124 23687 23687 D SecNativeFeatureCppIf: Free unCompDataBuff                                                                             05-12 23:31:53.124 23687 23687 D SecNativeFeatureCppIf: encoded
05-12 23:31:53.124 23687 23687 D SecNativeFeatureCppIf: decoding and unzip finish
05-12 23:31:53.124 23687 23687 D SecNativeFeatureCppIf: use unCompDataBuff. encoded                                                                     05-12 23:31:53.124 23687 23687 D SecNativeFeatureCppIf: Free unCompDataBuff
05-12 23:31:53.124 23687 23687 D AndroidRuntime: addProductProperty: pBrand1 is not null
05-12 23:31:53.124 23687 23687 D AndroidRuntime: addProductProperty: not brand or 7                                                                     05-12 23:31:53.263 23687 23687 D app_process: Time zone APEX ICU file found: /apex/com.android.tzdata/etc/icu/icu_tzdata.dat                            05-12 23:31:53.263 23687 23687 D app_process: I18n APEX ICU file found: /apex/com.android.i18n/etc/icu/icudt66l.dat                                     05-12 23:31:53.291 23687 23687 E SemDvfsManager_JNI: SemDvfsManager: registerfunction enter                                                             05-12 23:31:53.291 23687 23687 E SemAffinityControl: SemAffinityControl: registerfunction enter                                                         05-12 23:31:53.292 23687 23687 W app_process: JNI RegisterNativeMethods: attempt to register 0 native methods for android.media.AudioAttributes         05-12 23:31:53.300 23687 23687 D AndroidRuntime: Calling main entry com.termux.termuxam.Am                                                              05-12 23:31:53.344  4950 23701 E termux-api: Error getting camera
05-12 23:31:53.344  4950 23701 E termux-api: android.hardware.camera2.CameraAccessException: CAMERA_DISABLED (1): connectHelper:2116: Camera "3" disabled by policy
05-12 23:31:53.344  4950 23701 E termux-api:    at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:1340)
05-12 23:31:53.344  4950 23701 E termux-api:    at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:714)             05-12 23:31:53.344  4950 23701 E termux-api:    at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:895)                      05-12 23:31:53.344  4950 23701 E termux-api:    at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:823)                            05-12 23:31:53.344  4950 23701 E termux-api:    at com.termux.api.m1.j(Unknown Source:26)                                                               05-12 23:31:53.344  4950 23701 E termux-api:    at com.termux.api.m1.c(Unknown Source:37)                                                               05-12 23:31:53.344  4950 23701 E termux-api:    at com.termux.api.e0.a(Unknown Source:8)                                                                05-12 23:31:53.344  4950 23701 E termux-api:    at com.termux.api.util.b.b(Unknown Source:89)
05-12 23:31:53.344  4950 23701 E termux-api:    at com.termux.api.util.a.run(Unknown Source:8)
05-12 23:31:53.344  4950 23701 E termux-api:    at java.lang.Thread.run(Thread.java:923)                                                                05-12 23:31:53.344  4950 23701 E termux-api: Caused by: android.os.ServiceSpecificException: connectHelper:2116: Camera "3" disabled by policy (code 6) 05-12 23:31:53.344  4950 23701 E termux-api:    at android.os.Parcel.createExceptionOrNull(Parcel.java:2399)
05-12 23:31:53.344  4950 23701 E termux-api:    at android.os.Parcel.createException(Parcel.java:2369)                                                  05-12 23:31:53.344  4950 23701 E termux-api:    at android.os.Parcel.readException(Parcel.java:2352)                                                    05-12 23:31:53.344  4950 23701 E termux-api:    at android.os.Parcel.readException(Parcel.java:2294)                                                    05-12 23:31:53.344  4950 23701 E termux-api:    at android.hardware.ICameraService$Stub$Proxy.connectDevice(ICameraService.java:767)                    05-12 23:31:53.344  4950 23701 E termux-api:    at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:681)             05-12 23:31:53.344  4950 23701 E termux-api:    ... 8 more                                                                                              05-12 23:31:53.349 23687 23687 D AndroidRuntime: Shutting down VM

Steps to reproduce the behavior.

termux-camera-photo tmp.jpg

What is the expected behavior?

termux-camera-photo should write a picture to the file.

System information

$ termux-info
Termux Variables:
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.org/apt/termux-main/ stable main
Updatable packages:
clang/stable 14.0.3-1 aarch64 [upgradable from: 14.0.1]
curl/stable 7.83.1 aarch64 [upgradable from: 7.83.0]
dpkg/stable 1.21.7 aarch64 [upgradable from: 1.21.1-1]
git/stable 2.36.1 aarch64 [upgradable from: 2.35.3]
glib/stable 2.72.1-1 aarch64 [upgradable from: 2.72.1]
libcompiler-rt/stable 14.0.3-1 aarch64 [upgradable from: 14.0.1]
libcurl/stable 7.83.1 aarch64 [upgradable from: 7.83.0]
libid3tag/stable 0.16.2 aarch64 [upgradable from: 0.15.1b-3]
libllvm/stable 14.0.3-1 aarch64 [upgradable from: 14.0.1]
libxml2/stable 2.9.14 aarch64 [upgradable from: 2.9.13]
lld/stable 14.0.3-1 aarch64 [upgradable from: 14.0.1]
llvm/stable 14.0.3-1 aarch64 [upgradable from: 14.0.1]
openssl-1.1/stable 1.1.1o aarch64 [upgradable from: 1.1.1n]
openssl/stable 3.0.3 aarch64 [upgradable from: 3.0.2]
sox/stable 14.4.2-22 aarch64 [upgradable from: 14.4.2-21]
termux-keyring/stable 3.4 all [upgradable from: 3.3]
Android version:
11
Kernel build information:
Linux localhost 4.14.190-22524370-abA715FXXU8BVA2 termux/termux-app#1 SMP PREEMPT Thu Jan 6 17:30:49 KST 2022 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-A715F
@zairullahdev
Copy link

Termux-API Problem, Run Termux-API to fix this

@agnostic-apollo
Copy link
Member

Check https://www.reddit.com/r/tasker/comments/u6jw92/helptermuxtasker/

The camera/microphone/location APIs need to be rewritten to be compliant with A11 background restrictions. It's on the to-do list.

https://developer.android.com/guide/components/foreground-services#bg-access-restrictions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants