[Bug]: termux-camera-photo returns empty file - error in logcat
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 920
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the termux-camera-photo command and the Android camera2 openCamera path shown in the logcat, especially the CAMERA_DISABLED error. Reproduce the failure after Termux has run in the background and verify that the command no longer leaves a zero-byte output file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100