3

I'm using a fingerprint sensor (Integrated Biometrics) through otg cable. I tested my app in a Lollipop device (API 22) and everything goes well. But since i need to test SourceAFIS library which targets API 24, I tested in a NOUGAT device. After requesting permissions for device, the app crashes but there is no error message that i can truly understand:

A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0xc in tid 8384 (d.scannersample)

I have tried permission requests at runtime to no avail. While debugging, the code reached a point where execution just stops, again, with no errors in logcat.

Full 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)

App Details:

  • App consists of a state machine that, depending on callback received, it updates UI to enable/disable buttons.
  • App can email the generated image (in png format). I did not find permissions required for this to work, but if anyone knows better, please inform.
  • App saves images generated from sensor, so permission request is executed
  • Since USB is used, "android.hardware.usb.host" feature is declared in manifest. In Lollipop device the only permissions listed in App info screen are "modify or delete the contents of your USB storage" and "read the contents of your USB storage"
  • I'm using libusb library with the prebuilt .so files in armeabi and armeabi-v7a folders inside jniLibs directory. I discarded compatibility issues since while debugging device permission request is shown as granted, but if anyone knows better, I'll take any advice.

Things I tried:

  • Disable Hardware acceleration as suggested in this thread
  • Request External Storage (read, write) permission at runtime
  • Debug to see if there are any null values or procedural errors that might affect execution
  • Add add permissions in Manifest and runtime requests

Code (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();
    }

So far i haven't been able to find why it is working in lollipop and not in Nougat. Thanks in advance for your advises and insights

CristhL
  • 31
  • 6

0 Answers0