Obsolete
Status Update
Comments
sc...@google.com <sc...@google.com> #2
Hi Venkatesh,
Several questions for you
(1) What is the purpose of the main activity and activity 2 described in the flow.
Is it possible that user launches activity2. on top of main activity , but open other fragments that won't open camera for a long time and then go back to the CameraFragment ?
I am investigating on what the time duration could be between calling getCameraIdList in your app and in CameraX.
(2) According our meeting, CameraProcessProvider.getInstance().get() is called on CameraFragment.onCreate()
what about bindToLifecycle? Is it also called on CameraFragment.onCreate() ?
Several questions for you
(1) What is the purpose of the main activity and activity 2 described in the flow.
Is it possible that user launches activity2. on top of main activity , but open other fragments that won't open camera for a long time and then go back to the CameraFragment ?
I am investigating on what the time duration could be between calling getCameraIdList in your app and in CameraX.
(2) According our meeting, CameraProcessProvider.getInstance().get() is called on CameraFragment.onCreate()
what about bindToLifecycle? Is it also called on CameraFragment.onCreate() ?
sc...@google.com <sc...@google.com> #3
Hi Ventatesh,
Can you kindly help clarify the questions above? Thanks a lot !
Can you kindly help clarify the questions above? Thanks a lot !
er...@google.com <er...@google.com> #4
Hi Ventatesh,
Can you kindly help clarify the questions above?
l....@gmail.com <l....@gmail.com> #5
Note:
We are SDK team providing features to our apps. One of those features is Camera. <Our partners will invoke use via function calls.>
(1) What is the purpose of the main activity and activity 2 described in the flow.
=>main activity => (PARTNER ACTIVITY) => an activity showing some readable views. In it's onPostResume() checks if permissions are available then invoke SDK method in which we launch an activity having a fragment opening camera.
Is it possible that user launches activity2. on top of main activity , but open other fragments that won't open camera for a long time and then go back to the CameraFragment ?
=> In the app that had reported this issue. it is not possible. Always Activity 2 launches CameraFragment.
(2) According our meeting, CameraProcessProvider.getInstance().get() is called on CameraFragment.onCreate()
=> CameraProcessProvider.getInstance().get() is called in onViewCreated().
what about bindToLifecycle? Is it also called on CameraFragment.onCreate() ?
=> Yes
We are SDK team providing features to our apps. One of those features is Camera. <Our partners will invoke use via function calls.>
(1) What is the purpose of the main activity and activity 2 described in the flow.
=>main activity => (PARTNER ACTIVITY) => an activity showing some readable views. In it's onPostResume() checks if permissions are available then invoke SDK method in which we launch an activity having a fragment opening camera.
Is it possible that user launches activity2. on top of main activity , but open other fragments that won't open camera for a long time and then go back to the CameraFragment ?
=> In the app that had reported this issue. it is not possible. Always Activity 2 launches CameraFragment.
(2) According our meeting, CameraProcessProvider.getInstance().get() is called on CameraFragment.onCreate()
=> CameraProcessProvider.getInstance().get() is called in onViewCreated().
what about bindToLifecycle? Is it also called on CameraFragment.onCreate() ?
=> Yes
l....@gmail.com <l....@gmail.com> #6
Hi Scott,
Any update on this bug?
Regards,
Venkatesh.
Any update on this bug?
Regards,
Venkatesh.
l....@gmail.com <l....@gmail.com> #7
Adding to above, we are observing that native camera is also not opening after this issue/error.
We had to re-start device for native or our camera to be rendered.
We had to re-start device for native or our camera to be rendered.
sc...@google.com <sc...@google.com> #8
Thanks, this is a valuable information.
Do you have any device name for this symptom (had to re-start device for native or our camera to be rendered) ?
Some feedback from our partners said that adding some delay and retrying could mitigate the issue. So it looks like there are two symptoms, one is unrecoverable and another is recoverable.
Do you have any device name for this symptom (had to re-start device for native or our camera to be rendered) ?
Some feedback from our partners said that adding some delay and retrying could mitigate the issue. So it looks like there are two symptoms, one is unrecoverable and another is recoverable.
l....@gmail.com <l....@gmail.com> #9
Hi Scott,
=>Do you have any device name for this symptom (had to re-start device for native or our camera to be rendered) ?
It was on Microsoft Surface Duo EMULATOR. Can be downloaded fromhttps://www.microsoft.com/en-us/download/confirmation.aspx?id=100847
=>Do you have any device name for this symptom (had to re-start device for native or our camera to be rendered) ?
It was on Microsoft Surface Duo EMULATOR. Can be downloaded from
we...@google.com <we...@google.com> #10
Copy the issue device information from the mail thread.
ap...@google.com <ap...@google.com> #11
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 3db9b7de5767037e08a7f23a6212050a9eba089e
Author: WenHung_Teng <wenhungteng@google.com>
Date: Mon Oct 05 21:30:51 2020
Retry init when it gets incorrect number of cameras
Gets the device camera lens facing information from the
PackageManager.hasSystemFeature()
Retry the CameraX initialize when one of the lens facing
camera doesn't been setup correctly.
Bug: 167201193
Test: Manually test CameraXTest on reported devices
Change-Id: I96cc61c6ec28fb8bb98c2ce41f2bb21bc75e65b8
M camera/camera-core/src/main/java/androidx/camera/core/CameraX.java
A camera/camera-core/src/main/java/androidx/camera/core/impl/CameraValidator.java
A camera/camera-core/src/main/java/androidx/camera/core/impl/quirk/IncompleteCameraListQuirk.java
A camera/camera-core/src/main/java/androidx/camera/core/impl/quirk/package-info.java
https://android-review.googlesource.com/1457035
Branch: androidx-master-dev
commit 3db9b7de5767037e08a7f23a6212050a9eba089e
Author: WenHung_Teng <wenhungteng@google.com>
Date: Mon Oct 05 21:30:51 2020
Retry init when it gets incorrect number of cameras
Gets the device camera lens facing information from the
PackageManager.hasSystemFeature()
Retry the CameraX initialize when one of the lens facing
camera doesn't been setup correctly.
Bug: 167201193
Test: Manually test CameraXTest on reported devices
Change-Id: I96cc61c6ec28fb8bb98c2ce41f2bb21bc75e65b8
M camera/camera-core/src/main/java/androidx/camera/core/CameraX.java
A camera/camera-core/src/main/java/androidx/camera/core/impl/CameraValidator.java
A camera/camera-core/src/main/java/androidx/camera/core/impl/quirk/IncompleteCameraListQuirk.java
A camera/camera-core/src/main/java/androidx/camera/core/impl/quirk/package-info.java
we...@google.com <we...@google.com> #12
The "No available camera can be found" might cause by the cameraHAL underreports an unexpected list of available camera devices while we call to "getCameraIdList".
For this issue the problem seems to be that the camera HAL has been put into a bad state, while CameraX is working as intended.
Some devices only temporary and after a few seconds the absent device ids re-appear.
There is an update to reload the id list, it might reduce the issue happen rate if the cameraHAL can recover from the unexpected error itself.
The change will be in the next release.
However, we notice some devices might disable the camera from the available id list, user might need to reboot the device to recover the issue.
Usually when the camera gets some serious failure.
For the above case. We would recommend to use the CameraProvider.hasCamera() to check the camera availability before use it.
For this issue the problem seems to be that the camera HAL has been put into a bad state, while CameraX is working as intended.
Some devices only temporary and after a few seconds the absent device ids re-appear.
There is an update to reload the id list, it might reduce the issue happen rate if the cameraHAL can recover from the unexpected error itself.
The change will be in the next release.
However, we notice some devices might disable the camera from the available id list, user might need to reboot the device to recover the issue.
Usually when the camera gets some serious failure.
For the above case. We would recommend to use the CameraProvider.hasCamera() to check the camera availability before use it.
we...@google.com <we...@google.com> #13
The retry mechanism is already updated. As the #12 mentioned, this kind of the cameraHAL may not easy to be resolved at application level completely.
We'd keep track on this issue and the improve the solution once we get further investigation results on it.
We'd keep track on this issue and the improve the solution once we get further investigation results on it.
sc...@google.com <sc...@google.com> #14
Hi Venkatesh,
The retry mechanism has been integrated and release around November. Do you have chances to test it in production app to see if it improves or not ? It will help us evaluate the next steps for the issues. Thanks a lot.
The retry mechanism has been integrated and release around November. Do you have chances to test it in production app to see if it improves or not ? It will help us evaluate the next steps for the issues. Thanks a lot.
ap...@google.com <ap...@google.com> #15
Project: platform/frameworks/support
Branch: androidx-main
commit 2b7013371f446e5e95ce559840093dadc1575007
Author: WenHung_Teng <wenhungteng@google.com>
Date: Fri Mar 12 10:33:24 2021
Add some Pixel devices into lens facing retry list
Add the Pixel devices starting from 2017 into the retry list.
Bug: 167201193
Bug: 182375799
Test: Manually test CameraXInitTest on reported devices
Change-Id: Ib91f0d26ccc9b61d3857d5755bbaaf118b838a12
M camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/IncompleteCameraListQuirk.java
https://android-review.googlesource.com/1633183
Branch: androidx-main
commit 2b7013371f446e5e95ce559840093dadc1575007
Author: WenHung_Teng <wenhungteng@google.com>
Date: Fri Mar 12 10:33:24 2021
Add some Pixel devices into lens facing retry list
Add the Pixel devices starting from 2017 into the retry list.
Bug: 167201193
Bug: 182375799
Test: Manually test CameraXInitTest on reported devices
Change-Id: Ib91f0d26ccc9b61d3857d5755bbaaf118b838a12
M camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/IncompleteCameraListQuirk.java
ap...@google.com <ap...@google.com> #16
Project: platform/frameworks/support
Branch: androidx-main
commit c5c7ff7b3bfdac1e07e755d14498195d7a3d75ab
Author: WenHung_Teng <wenhungteng@google.com>
Date: Wed Apr 14 11:30:57 2021
Apply retry camera list for all devices
Allow the retry solution for b/167201193 to be applied on all the devices.
Test: manually run the CameraXInitTest to ensure the Retry doesn't run.
Change-Id: Ifc0fb28be26e9ce7d9f8ddc4be0d2c6cbd973c9d
M camera/camera-core/src/main/java/androidx/camera/core/CameraX.java
M camera/camera-core/src/main/java/androidx/camera/core/impl/CameraValidator.java
M camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/DeviceQuirksLoader.java
D camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/IncompleteCameraListQuirk.java
https://android-review.googlesource.com/1674240
Branch: androidx-main
commit c5c7ff7b3bfdac1e07e755d14498195d7a3d75ab
Author: WenHung_Teng <wenhungteng@google.com>
Date: Wed Apr 14 11:30:57 2021
Apply retry camera list for all devices
Allow the retry solution for
Test: manually run the CameraXInitTest to ensure the Retry doesn't run.
Change-Id: Ifc0fb28be26e9ce7d9f8ddc4be0d2c6cbd973c9d
M camera/camera-core/src/main/java/androidx/camera/core/CameraX.java
M camera/camera-core/src/main/java/androidx/camera/core/impl/CameraValidator.java
M camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/DeviceQuirksLoader.java
D camera/camera-core/src/main/java/androidx/camera/core/internal/compat/quirk/IncompleteCameraListQuirk.java
an...@favordelivery.com <an...@favordelivery.com> #17
Looking for a resolution and also getting somethig similar for my app. Nothing fancy just happening with 2 users same issue over and over.
Fatal Exception: java.lang.IllegalArgumentException: No available camera can be found.
at androidx.camera.core.CameraSelector.filter(CameraSelector.java:107)
at androidx.camera.core.CameraSelector.filter(CameraSelector.java:137)
at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:388)
at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:274)
Fatal Exception: java.lang.IllegalArgumentException: No available camera can be found.
at androidx.camera.core.CameraSelector.filter(CameraSelector.java:107)
at androidx.camera.core.CameraSelector.filter(CameraSelector.java:137)
at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:388)
at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:274)
sc...@google.com <sc...@google.com> #18
The fix has been applied to all devices. But keep in mind that it can't fix all of these issue.
This issue is often caused by a bug in OEM such as something stuck in the Camera HAL or camera service. What we do to mitigate it is to retry when CameraX detects getCameraIdList() returns empty or incomplete ids , if we get lucky , for example, if the device is restarting the camera service, then the retry approach will recover it successfully. In our testing, the retry approach can recover around 40% when the failure happens.
Description
CAMERAX VERSION : beta-05
java.lang.IllegalArgumentException: No available camera can be found
androidx.camera.core.CameraSelector.select SourceFile:80
androidx.camera.core.CameraX.getCameraWithCameraSelector SourceFile:515
androidx.camera.core.CameraX.bindToLifecycle SourceFile:325
androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle SourceFile:234
As camera is the first screen that users see in our app, these users will be facing crash on app launch.
Flow:
<MainAcitivity >
cameraManager.getCameraIdList ,
// get output size from stream configuration
// compute resolution
<Activity 2>
<CameraFragment>
onCreate()
CameraProcessProvider.getInstance().get().
build use case / bindToLifecycle().