CameraInfo.cameraState stop working on CameraX 1.5.0

80 views
Skip to first unread message
Assigned to wenhu...@google.com by scot...@google.com

Eugene B

unread,
Sep 26, 2025, 12:37:41 PMSep 26
to Android CameraX Discussion Group
Hi,

We are experiencing a regression in the CameraState observation behavior when upgrading from CameraX 1.5.0-alpha04 to the stable 1.5.0 release.

In our application, we observe the camera's state to track its lifecycle. The following code worked as expected in version 1.5.0-alpha04:

cameraState?.observe(lifecycleOwner) { state ->
    Log.d(TAG, "Camera state = $state")
    // Handle state changing
}

Previous Behavior (1.5.0-alpha04):
The state flow consistently transitioned through CLOSED -> OPENING -> OPEN when the camera was successfully opened.

Current Behavior (1.5.0):
The state now often gets stuck at OPENING. The OPEN state is rarely emitted, even though the camera is fully functional (a preview stream is active, and capture sessions work correctly). This breaks our logic that relies on confirming the camera is fully open.

Question:

Is this a known issue in the stable 1.5.0 release?

If so, is there a known workaround to reliably get the OPEN state event?

Scott Nien

unread,
Sep 30, 2025, 4:14:56 AMSep 30
to Eugene B, Android CameraX Discussion Group
Thanks for reporting the issue!  I can't reproduce the issue using 1.5.0 stable,  can you give us some code snippet showing how you use the CameraX API ? 

And besides,  does it happen on other Android devices as well? 

Scott



--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/5cf9e88f-304f-4ea7-bb45-8669d592aaf7n%40android.com.
Message has been deleted

Eugene B

unread,
Oct 5, 2025, 1:28:55 PM (13 days ago) Oct 5
to Android CameraX Discussion Group, scot...@google.com, Android CameraX Discussion Group, Eugene B
Hi,
I have tested our app with both library versions: 1.5.0-alpha04 and 1.5.0 stable on a vendor's tablet (not yet on the market) and Xiaomi Mi 11 Pro.
As you can see in the logs below, the 1.5.0 stable version often doesn't provide the OPEN state.
I also found that switching between cameras triggers an OPEN state every time. This issue is only reproducible if the camera session is restarted on the same camera.

1.5.0-alpha04 has same behavior on the vendor's tablet and on the Xiaomi Mi 11 Pro:
2025-10-03 09:00:34.476 15710-15710 CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 09:00:34.631 15710-15710 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=CLOSING, error=null} hash = 226895643
2025-10-03 09:00:34.992 15710-15710 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPENING, error=null} hash = 226895643
2025-10-03 09:00:35.065 15710-15710 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPEN, error=null} hash = 226895643
2025-10-03 09:00:40.515 15710-15710 CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 09:00:40.735 15710-15710 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=CLOSING, error=null} hash = 226895643
2025-10-03 09:00:40.978 15710-15710 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPEN, error=null} hash = 226895643
2025-10-03 09:00:48.706 15710-15710 CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 09:00:48.769 15710-15710 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=CLOSING, error=null} hash = 226895643
2025-10-03 09:00:49.203 15710-15710 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPENING, error=null} hash = 226895643
2025-10-03 09:00:49.226 15710-15710 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPEN, error=null} hash = 226895643


1.5.0 stable also has the same behavior on the vendor's tablet and on the Xiaomi Mi 11 Pro
Vendor's tablet
2025-10-03 08:53:22.433  6514-6514  CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 08:53:22.820  6514-6514  PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPEN, error=null} hash = 204721303
2025-10-03 08:53:28.089  6514-6514  CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 08:53:28.536  6514-6514  PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPENING, error=null} hash = 204721303
2025-10-03 08:53:32.331  6514-6514  CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 08:53:32.656  6514-6514  PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=CLOSING, error=null} hash = 204721303
2025-10-03 08:53:32.739  6514-6514  PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPEN, error=null} hash = 204721303
2025-10-03 08:53:36.120  6514-6514  CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 08:53:36.520  6514-6514  PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPENING, error=null} hash = 204721303
2025-10-03 08:53:49.822  6514-6514  CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 08:53:50.236  6514-6514  PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPEN, error=null} hash = 204721303
2025-10-03 08:53:57.246  6514-6514  CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 08:53:57.700  6514-6514  PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPENING, error=null} hash = 204721303


Xiaomi Mi 11 Pro
1.5.0 stable:
2025-10-03 09:15:04.184 24846-24846 CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 09:15:04.526 24846-24846 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPENING, error=null} hash = 94856832
2025-10-03 09:15:08.537 24846-24846 CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 09:15:08.696 24846-24846 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPEN, error=null} hash = 94856832
2025-10-03 09:15:11.331 24846-24846 CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 09:15:11.546 24846-24846 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPENING, error=null} hash = 94856832
2025-10-03 09:15:14.425 24846-24846 CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 09:15:14.782 24846-24846 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPEN, error=null} hash = 94856832
2025-10-03 09:15:20.540 24846-24846 CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 09:15:20.749 24846-24846 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPENING, error=null} hash = 94856832
2025-10-03 09:15:20.851 24846-24846 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPEN, error=null} hash = 94856832
2025-10-03 09:15:23.504 24846-24846 CameraXCameraUseCase    nda.camera                   D  Starting new camera session
2025-10-03 09:15:23.655 24846-24846 PreviewViewModel        nda.camera                   D  Camera state = CameraState{type=OPENING, error=null} hash = 94856832


вторник, 30 сентября 2025 г. в 11:14:56 UTC+3, scot...@google.com:
Reply all
Reply to author
Forward
0 new messages