mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 02:01:36 +03:00
fix camera related crashes on Chromebook
This commit is contained in:
parent
1ae5704a28
commit
ec948d06f9
@ -19,6 +19,7 @@ package com.yubico.authenticator
|
||||
import android.content.*
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
||||
import android.content.pm.PackageManager
|
||||
import android.hardware.camera2.CameraCharacteristics
|
||||
import android.hardware.camera2.CameraManager
|
||||
import android.hardware.usb.UsbDevice
|
||||
import android.hardware.usb.UsbManager
|
||||
@ -352,7 +353,10 @@ class MainActivity : FlutterFragmentActivity() {
|
||||
val cameraService =
|
||||
getSystemService(Context.CAMERA_SERVICE) as CameraManager
|
||||
result.success(
|
||||
cameraService.cameraIdList.isNotEmpty()
|
||||
cameraService.cameraIdList.any {
|
||||
cameraService.getCameraCharacteristics(it)
|
||||
.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_BACK
|
||||
}
|
||||
)
|
||||
}
|
||||
else -> Log.w(TAG, "Unknown app method: ${methodCall.method}")
|
||||
|
Loading…
Reference in New Issue
Block a user