我通过otg cable使用指纹传感器(Integrated Biometrics)。我在Lollipop设备(API 22)中测试了我的应用程序,一切顺利。但由于我需要测试针对API 24的SourceAFIS library,我在NOUGAT设备中进行了测试。在请求设备权限后,应用程序崩溃但没有我能够真正理解的错误消息:
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 8384 (d.scannersample)
我在运行时尝试了权限请求无济于事。在调试时,代码达到了执行刚刚停止的程度,在logcat中没有错误。
完整Logcat:
com.android.scannersample I/OpenGLRenderer: Initialized EGL, version 1.4
com.android.scannersample D/OpenGLRenderer: Swap behavior 1
com.android.scannersample D/UsbDeviceConnectionJNI: close
com.android.scannersample D/IBSCAN: 0-Enter GetDeviceCount ()
com.android.scannersample D/IBSCAN: 0-Exit GetDeviceCount (pDeviceCount=1)
0-Enter GetDeviceDescription (deviceIndex=0)
com.android.scannersample D/UsbDeviceConnectionJNI: close
com.android.scannersample W/d.scannersample: type=1400 audit(0.0:5434): avc: denied { read } for uid=10238 name="devices" dev="sysfs" ino=16624 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0
com.android.scannersample A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 9547 (d.scannersample)
应用详情:
我尝试的事情:
代码(Kotlin):
val usbManager = this.applicationContext.getSystemService(Context.USB_SERVICE) as UsbManager
val deviceList : HashMap<String, UsbDevice> = usbManager.deviceList
val deviceIterator : Iterator<UsbDevice> = deviceList.values.iterator()
while (deviceIterator.hasNext()) {
val device : UsbDevice = deviceIterator.next()
val isScanDevice : Boolean = IBScan.isScanDevice(device)
if (isScanDevice) {
if (!usbManager.hasPermission(device)) {
mIbScan.requestPermission(device.deviceId)
} else {
Log.d(TAG, "Device permission granted")
}
}
}
try {
if (mIbScan.deviceCount > 0) {
try {
val deviceDesc : IBScan.DeviceDesc = this.mIbScan.getDeviceDescription(INITIALIZING_DEVICE_INDEX)
transitionToScannerAttached(deviceDesc.productName + " " + deviceDesc.serialNumber, mIbScan.deviceCount)
} catch (scanExc : ScanException) {
Log.d(TAG, "Received exception getting device description " + scanExc.getType().toString());
transitionToNoScannerAttached();
}
} else {
transitionToNoScannerAttached()
}
} catch (scanExc : ScanException) {
Log.d(TAG, "Received exception getting device count " + scanExc.getType().toString());
transitionToNoScannerAttached();
}
到目前为止,我还没有找到它为什么在棒棒糖而不是在牛轧糖中工作。提前感谢您的建议和见解