aws-amplify / amplify-ui-android

Amplify UI for Android is a collection of accessible, themeable, performant Android components that can connect directly to the cloud.
https://ui.docs.amplify.aws
Apache License 2.0
13 stars 7 forks source link

FaceLivenessDetector just shows black screen on Sony Xperia XZ3 #167

Closed shakil-bin-karim closed 2 months ago

shakil-bin-karim commented 3 months ago

Before creating a new issue, please confirm:

Which UI component?

Liveness

Gradle script dependencies

amplify-ui-liveness = { group = "com.amplifyframework.ui", name = "liveness", version.ref = "amplifyUi" }
amplifyUi = "1.2.1"

Environment information

Welcome to Gradle 8.6!

Here are the highlights of this release:
 - Configurable encryption key for configuration cache
 - Build init improvements
 - Build authoring improvements

For more details see https://docs.gradle.org/8.6/release-notes.html

------------------------------------------------------------
Gradle 8.6
------------------------------------------------------------

Build time:   2024-02-02 16:47:16 UTC
Revision:     d55c486870a0dc6f6278f53d21381396d0741c6e

Kotlin:       1.9.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.11 (Amazon.com Inc. 17.0.11+9-LTS)
OS:           Mac OS X 13.6.7 aarch64

Please include any relevant guides or documentation you're referencing

No response

Describe the bug

FaceLivenessDetector just shows black screen as it seems like it cannot access Camera using camerax library due to following permission error on Sony Xperia XZ3

Access denied finding property "persist.vendor.camera.privapp.list"

CAMERAX VERSION - 1.4.0-beta02 OS VERSION - ANDROID 10 DEVICE NAME: Sony Xperia XZ3

Reproduction steps (if applicable)

Try to render any @Composable screen that contains com.amplifyframework.ui.liveness.ui.FaceLivenessDetector on Sony Xperia XZ3 phone.

Code Snippet

FaceLivenessDetector(
  sessionId = uiState.sessionId.value,
  region = uiState.region,
  credentialsProvider = uiState.credentials,
  disableStartView = true,
  onComplete = {
    onComplete(uiState.sessionId)
  },
  onError = onError,
)

Log output

Camera2CameraImpl   D  {Camera@7dc9a41[id=1]} Cancelling scheduled re-open: androidx.camera.camera2.internal.Camera2CameraImpl$StateCallback$ScheduledReopen@8eb9794
Camera2CameraImpl   D  {Camera@7dc9a41[id=1]} Opening camera.
Camera2CameraImpl   D  {Camera@7dc9a41[id=1]} Transitioning camera internal state: REOPENING --> OPENING
CameraStateMachine  D  New public camera state CameraState{type=OPENING, error=null} from OPENING and null
CameraStateMachine  D  Publishing new public camera state CameraState{type=OPENING, error=null}
UseCaseAttachState  D  All use case: [androidx.camera.core.Preview-6ef39728-c981-4376-9378-4cdee44d4a77116505523, androidx.camera.core.ImageAnalysis-f1e44259-ae01-4e8b-a364-a789b3f0fa9d193963376] for camera: 1
libc                E  Access denied finding property "persist.vendor.camera.privapp.list"
Camera2CameraImpl   D  {Camera@7dc9a41[id=1]} CameraDevice.onOpened()
Camera2CameraImpl   D  {Camera@7dc9a41[id=1]} Transitioning camera internal state: OPENING --> OPENED

amplifyconfiguration.json

No response

Additional information and screenshots

Currently only occuring in the Xperia XZ3 device running Android 10.

shakil-bin-karim commented 3 months ago

Suggestions on any work arounds would also be appreciated.

tylerjroach commented 3 months ago

@shakil-bin-karim Can you please try and restart the device. I know that is a strange ask, but sometimes the Android camera gets in a weird state and fails to launch properly. The Camara has some shared state elements that make an app restart not enough.

If that doesn't work, can you try with 1.2.0 as is included in the Liveness library. There could be bugs with the beta library of CameraX you are using.

If neither of these suggestions work, please provide additional logs. I wouldn't expect the logcat to end there.

github-actions[bot] commented 2 months ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.