Search Issue Tracker

Fixed in 2020.2.X

Votes

1

Found in

2019.4

2019.4.0f1

2020.2

Issue ID

1262468

Regression

No

[Android] App crashes with FATAL EXCEPTION: CameraBackground error when enabling device camera permissions for the app

Android

-

Reproduction steps:
1. Open the attached user's project "Dice.zip"
2. Switch the Platform to Android
3. Build for Android
4. Enable Camera permissions when prompted and complete the tutorial
5. Go to app permissions on the device settings and disable camera permission
6. Go back to the app, open the Cogwheel settings and click on the camera icon
7. Select "Do not ask again" and "Deny"
8. Go back to app permissions and enable camera permission
9. Launch the app

Expected result: the app does not crash
Actual result: the app crashes several times and starts up normally (see attached AppPermCrash.mp4)

Reproduces on: 2019.4.10f1, 2020.1.5f1, 2020.2.0b2
Could not test on 2018.4 due to the project breaking

Reproduces with these devices:
VLNQA00220, Samsung Galaxy Note9 (SM-N960F), Android 8.1.0, CPU: Exynos 9 Series 9810, GPU: Mali-G72
VLNQA00096, Samsung Galaxy S8 (SM-G950F), Android 8.0.0, CPU: Exynos 9 Octa 8895, GPU: Mali-G71
VLNQA00316, Samsung Galaxy Note10 (SM-N970F), Android 9, CPU: Exynos 9 Series 9825, GPU: Mali-G76
N/A, Samsung Galaxy S9 (SM-G960F), Android 8.0.0, CPU: Exynos 9 Series 9810, GPU: Mali-G72

Does not reproduce with these devices:
VLNQA00015, Samsung Galaxy Note8 (SM-N950W), Android 8.0.0, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
VLNQA00286, Meizu - (PRO 5), Android 7.0, CPU: Exynos 7 Octa 7420, GPU: Mali-T760
VLNQA00285, Samsung Galaxy J4 Core (SM-J410F), Android 8.1.0, CPU: Snapdragon 425 MSM8917, GPU: Adreno (TM) 308
VLNQA00123, Google Pixel 2 XL (Pixel 2 XL), Android R, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
VLNQA00024, Xiaomi Mi 5 (MI 5), Android 7.0, CPU: Snapdragon 820 MSM8996, GPU: Adreno (TM) 530
N/A, Xiaomi Mi A3 (Mi A3), Android 9, CPU: Snapdragon 665 SM6125, GPU: Adreno (TM) 610
VLNQA00229, Oneplus OnePlus6T (ONEPLUS A6013), Android 9, CPU: Snapdragon 845 SDM845, GPU: Adreno (TM) 630

Could not test on these devices due to no app camera permission settings:
VLNQA00042, Lge LG G3 (LG-D855), Android 5.0, CPU: Snapdragon 801 MSM8974AC, GPU: Adreno (TM) 330
VLNQA00313, Huawei Y6 Ⅱ Compact (HUAWEI LYO-L01), Android 5.1, CPU: MediaTek MT6735, GPU: Mali-T720

Android Logcat exception error:

2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime FATAL EXCEPTION: CameraBackground
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime Process: com.madnesslabo.app02, PID: 22722
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime java.lang.IllegalStateException: CameraDevice was already closed
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2432)
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime at android.hardware.camera2.impl.CameraDeviceImpl.createCaptureRequest(CameraDeviceImpl.java:783)
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime at com.unity3d.player.b$2.onConfigured(Unknown Source:30)
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime at android.hardware.camera2.impl.CallbackProxies$SessionStateCallbackProxy.lambda$onConfigured$0(CallbackProxies.java:53)
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime at android.hardware.camera2.impl.-$$Lambda$CallbackProxies$SessionStateCallbackProxy$soW0qC12Osypoky6AfL3P2-TeDw.run(Unknown Source:4)
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime at android.os.Handler.handleCallback(Handler.java:873)
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:99)
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime at android.os.Looper.loop(Looper.java:216)
2020/09/15 14:37:47.259 22722 22863 Error AndroidRuntime at android.os.HandlerThread.run(HandlerThread.java:65)

Notes:
-Repeat steps if the crash does not occur
-If Development build is enabled no crashes occur
-On 2020.2.0b2 the crash still occurs but less frequently than on 2019.4.10f1

  1. Resolution Note (fix version 2020.2):

    Fixed in 2021.1.0a1

Comments (1)

  1. chico_barnstorm

    Jan 05, 2021 10:13

    Is there any chance for this fix to be backported to Unity2018 or Unity2019?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.