ARTICLE AD BOX
The following crashes occur only on Android 16 devices when the app is in the background state (100% based on Firebase Crashlytics, check the attached screenshot).
My application is a video recording app that runs with a foreground service, which allows it to continue working (using camera) while the app is in the background.
The crashes are reported by Firebase Crashlytics, so I have not been able to reproduce the issue yet or provide a minimal sample project.
The app currently has about 600,000 installed users. According to Crashlytics, the issue has affected 109 users (319 events) so far. So far, it happens rarely, and I can't reproduce it on the same devices.
Stack trace:
Fatal Exception: java.lang.IllegalArgumentException: Unable to find task ID 5429 at android.os.Parcel.createExceptionOrNull(Parcel.java:3377) at android.os.Parcel.createException(Parcel.java:3357) at android.os.Parcel.readException(Parcel.java:3340) at android.os.Parcel.readException(Parcel.java:3282) at android.app.IAppTask$Stub$Proxy.getTaskInfo(IAppTask.java:249) at android.app.ActivityManager$AppTask.getTaskInfo(ActivityManager.java:6376) at android.hardware.camera2.CameraManager.getRotationOverride(CameraManager.java:1674) at android.hardware.camera2.CameraManager.getRotationOverride(CameraManager.java:1653) at android.hardware.camera2.CameraManager.getCameraCharacteristics(CameraManager.java:714) at com.MY_APP_HIDDEN.utilities.CameraUtil.getCameraCharacteristics(CameraUtil.kt:296)Similar with a different task ID:
Unable to find task ID 147 Unable to find task ID 13649 Unable to find task ID 3420 Unable to find task ID ANY_NUMBERThe crashes occur on the following devices (mostly Pixel devices, some newer Samsung models, and one Sony Xperia device):
Galaxy S10e (Android 16) Galaxy S23 Ultra (Android 16) Galaxy S25 Ultra (Android 16) Galaxy S26 (Android 16) Galaxy S26 Ultra (Android 16) Pixel 10 (Android 16) Pixel 10 Pro (Android 16) Pixel 10 Pro Fold (Android 16) Pixel 10 Pro XL (Android 16) Pixel 6 (Android 16) Pixel 6 Pro (Android 16) Pixel 6a (Android 16) Pixel 7 (Android 16) Pixel 7 Pro (Android 16) Pixel 7a (Android 16) Pixel 8 (Android 16) Pixel 8 Pro (Android 16) Pixel 8a (Android 16) Pixel 9 (Android 16) Pixel 9 Pro (Android 16) Pixel 9 Pro Fold (Android 16) Pixel 9 Pro XL (Android 16) Pixel 9a (Android 16) Pixel Fold (Android 16) Xperia 1 V (Android 16)It is unclear why CameraManager.getCameraCharacteristics() internally calls android.app.ActivityManager$AppTask.getTaskInfo
From a Android developer perspective, CameraManager.getCameraCharacteristics() should be safe to call at any time and should not depend on the application task state.

