microg / GmsCore

Free implementation of Play Services
https://microg.org
Apache License 2.0
8.49k stars 1.71k forks source link

Scanning QR code does not work (missing feature?) #670

Closed bytebytebyte closed 3 years ago

bytebytebyte commented 5 years ago

Hi, thanks for this great FLOSS initiative!

I suspect this is not a bug in the existing program, but a feature that has not been implemented (yet). When I use an app that scans a QR code for something, it never recognizes the code. Instead, it just keeps the camera running indefinitely.

When running logcat on the device, the following stack trace jumps out:

11-25 18:36:53.412 25867  9525 W DynamiteModule: Local module descriptor class for com.google.android.gms.vision.dynamite not found.
11-25 18:36:53.413 25867  9525 D GmsDynamiteLoaderImpl: unimplemented Method: getModuleVersion for com.google.android.gms.vision.dynamite
11-25 18:36:53.413 25867  9525 I DynamiteModule: Considering local module com.google.android.gms.vision.dynamite:0 and remote module com.google.android.gms.vision.dynamite:0
11-25 18:36:53.415 25867  9525 E BarcodeNativeHandle: Error creating remote native handle
11-25 18:36:53.415 25867  9525 E BarcodeNativeHandle: com.google.android.gms.dynamite.DynamiteModule$iF: No acceptable module found. Local version is 0 and remote version is 0.
11-25 18:36:53.415 25867  9525 E BarcodeNativeHandle:   at com.google.android.gms.dynamite.DynamiteModule.ˋ(Unknown Source)
11-25 18:36:53.415 25867  9525 E BarcodeNativeHandle:   at o.ᴝ.ˊ(Unknown Source)
11-25 18:36:53.415 25867  9525 E BarcodeNativeHandle:   at o.ᴝ.ˏ(Unknown Source)
11-25 18:36:53.415 25867  9525 E BarcodeNativeHandle:   at o.ᴉ.ˊ(Unknown Source)
11-25 18:36:53.415 25867  9525 E BarcodeNativeHandle:   at o.п.ॱ(Unknown Source)
11-25 18:36:53.415 25867  9525 E BarcodeNativeHandle:   at o.н$ˊ.run(Unknown Source)
11-25 18:36:53.415 25867  9525 E BarcodeNativeHandle:   at java.lang.Thread.run(Thread.java:761)

I'm assuming this means the vision module is not present in the Microg implementation. Is there a way to provide this module? If I'm reading the Google documentation correctly, the Vision API is superseded by Firebase ML Kit, which is now in beta. After a quick search I found that parts of Firebase are made open source. Could we somehow include Firebase in Microg, or am I way in over my head here?

matthijskooijman commented 5 years ago

I'm seeing a similar issue with the DHL locker app, which tries to scan a 2D barcode and also shows the camera but never scans the image (easy to reproduce with DHL locker, no account or login required, just select "Deliver" at startup). The backtrace is different, though:

NativeBarcodeDetectorHandle: Error creating native barcode detector
NativeBarcodeDetectorHandle: com.google.android.gms.dynamic.zzg$zza: Could not load creator class.
NativeBarcodeDetectorHandle:   at com.google.android.gms.dynamic.zzg.a(Unknown Source)
NativeBarcodeDetectorHandle:   at com.google.android.gms.vision.barcode.internal.client.d$a.b(Unknown Source)
NativeBarcodeDetectorHandle:   at com.google.android.gms.vision.barcode.internal.client.d$a.a(Unknown Source)
NativeBarcodeDetectorHandle:   at com.google.android.gms.vision.barcode.internal.client.d.b(Unknown Source)
NativeBarcodeDetectorHandle:   at com.google.android.gms.vision.barcode.internal.client.d.a(Unknown Source)
NativeBarcodeDetectorHandle:   at com.google.android.gms.vision.barcode.a.a(Unknown Source)
NativeBarcodeDetectorHandle:   at com.google.android.gms.vision.a.b(Unknown Source)
NativeBarcodeDetectorHandle:   at com.dhl.parcellocker.scanner.camera.i$c.run(CameraSource.java:1199)
NativeBarcodeDetectorHandle:   at java.lang.Thread.run(Thread.java:818)
NativeBarcodeDetectorHandle: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.vision.client.DynamiteNativeBarcodeDetectorCreator" on path: DexPathList[[zip file "/system/framework/com.android.location.provider.jar", zip file "/data/app/com.google.android.gms-2/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.gms-2/lib/arm, /data/app/com.google.android.gms-2/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
NativeBarcodeDetectorHandle:   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
NativeBarcodeDetectorHandle:   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
NativeBarcodeDetectorHandle:   at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
NativeBarcodeDetectorHandle:   ... 9 more
NativeBarcodeDetectorHandle:   Suppressed: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.vision.client.DynamiteNativeBarcodeDetectorCreator" on path: DexPathList[[dex file "/data/dalvik-cache/xposed_XResourcesSuperClass.dex", dex file "/data/dalvik-cache/xposed_XTypedArraySuperClass.dex"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
NativeBarcodeDetectorHandle:           at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
NativeBarcodeDetectorHandle:           at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
NativeBarcodeDetectorHandle:           at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
NativeBarcodeDetectorHandle:           ... 10 more
NativeBarcodeDetectorHandle:           Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.vision.client.DynamiteNativeBarcodeDetectorCreator
NativeBarcodeDetectorHandle:                   at java.lang.Class.classForName(Native Method)
NativeBarcodeDetectorHandle:                   at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
NativeBarcodeDetectorHandle:                   at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
NativeBarcodeDetectorHandle:                   at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
NativeBarcodeDetectorHandle:                   ... 11 more
NativeBarcodeDetectorHandle:           Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
guzzard commented 5 years ago

Also having issues with scanning QR code in Swedish BankID app. This spams the logcat while the camera is active.

03-03 22:03:31.793  5376  5390 D SensorsBio: BioSensor_common::readEvents, FAR = -1
03-03 22:03:31.808  4061 11611 E SensorListener: Sensor(8) is not enabled yet!
03-03 22:03:31.840 11467 11587 D GmsDynamiteLoaderImpl: unimplemented Method: getModuleVersion for com.google.android.gms.vision.dynamite
03-03 22:03:31.841 11467 11587 D GmsDynamiteLoaderImpl: unimplemented Method: getModuleVersion for com.google.android.gms.vision.dynamite
03
elh-art commented 5 years ago

Same issue here with Swedish BankID on a Lineage OS with microg.

I bypassed this issue by installing a QR code reader (from F-droid) and show the QR code generated by the BankID website which pops up a link. An OK on the link activates the BankID app on the mobile (which runs in the background) and you have to set your password. Activation done. 👍

MathieuDebit commented 5 years ago

I guess I have the same issue when trying to use the QR code scanner to log into the 1Password app.

QR code scanner is not available in the currently installed version of Google Play Services.

siemer commented 5 years ago

I have a similar issue. The app does not even show an image from the camera, just a black square and switches to manual number-entry after a minute.

ravilov commented 5 years ago

Seconded. I know this has to do with "dynamite vision" module or somesuch and I know that's a "maybe" according to the wiki, was just wondering how likely is it to actually happen.

sm4rk0 commented 5 years ago

Duplicate of #395?

monperrus commented 5 years ago

I confirm that using a separate qr scanner app (SecScanQR from F-droid) works as workaround for BankId (with the right version of gmscore, see #824).

JohanAR commented 4 years ago

I confirm that using a separate qr scanner app (SecScanQR from F-droid) works as workaround for BankId (with the right version of gmscore, see #824).

This does not work for me now, not sure if they changed something or if there's something wrong with my phone. SecScanQR opens the link with BankId, which changes to say "Please wait..." for a fraction of a second but then goes back to the main/idle screen. It was working with my old id earlier today before I reinstalled the app.

fuggla commented 4 years ago

@JohanAR the workaround doesn't work on my phone either, so I'm guessing BankID have been updated. I'll report back if I find another way.

JohanAR commented 4 years ago

@owlnical I managed to install a new bank-id a few days ago. I had emailed Nordea asking for a manual activation code and they sent me a generic template response with instructions. It also had a link to a different bank-id activation page: https://identify.nordea.com/apps/bankid/login that shows a QR code (but yeah, a different page than the one you get if you try to order a bank-id from inside the online banking service). However this QR code I could scan with SecScanQR and the bank-id app would now ask me to set a password instead of getting stuck like before. Setting a password also failed 4 times, but then the web page refreshed with a new QR code that allowed me to finally get everything working.

Anyhow, if the QR codes aren't working for you and you have Nordea then you can order a personal code. If you use that code to identify at the previous web site it should give you an activation code that you can enter into the bank-id app after it complains about missing QR library. I used a mobile authenticator which is why I got the QR code instead of activation code I was trying to get.

fuggla commented 4 years ago

@JohanAR Perfect! This is exactly what I've been struggling with. Thanks a lot for sharing!

monperrus commented 4 years ago

More and more apps use the QR code Google API.

Does anybody know a library that implements the QR code Google API?

ArchangeGabriel commented 4 years ago

https://github.com/microg/android_external_GmsApi/pull/14 and https://github.com/microg/android_external_GmsLib/pull/18 were pushed y-day.

monperrus commented 4 years ago

thanks for the update, subscribed to those PRs!

Albert1st1 commented 4 years ago

@JohanAR @owlnical You only get the QR-codes if you use different devices like your computer and your phone. If you instead activates bankid on the same device aka your smartphone then there are no QR-codes and you don't have that problem. The QR-codes are added as an security feature to stop fraud by adding an proximity check (QR-code) if different devices are used. If you instead use firefox (web-browser) on the same device then there is no QR-codes.

That said there's still need for QR-codes to work and i will try the newly added functionality as soon as it's in an release or someone explain how i can try it out.

monperrus commented 4 years ago

For BankId on a different device, a workaround is to scan with SecScanQR, copy the text, add &redirect=null and paste it in Firefox, resulting it in opening in BankId correctly. You have to go fast because the token is short-lived :)

Albert1st1 commented 4 years ago

@monperrus is that for creating an mobilt BankID or for logging in to a service on a different device (computer)? If i try to log in on a different device the QR-code reads bankid:///?autostarttoken=28efdaf3-820a-48d8-82cc-94fbbd7a5687 and pasting that into a web browser opens BankID but it doesn't let me sign a login.

monperrus commented 4 years ago

for logging in to a service on a different device. Did you also manually add the &redirect=null?

Albert1st1 commented 4 years ago

@monperrus adding &redirect=null doesn't change anything and it still doesn't work on different devices. My bank uses QR-code if i try to login from my computer using mobile BankID and it doesn't work what ever i try. Is your QR-code constructed like the one i posted?

klasrocket commented 4 years ago

I've had the same problem while trying to use BankID for some webservices like Handelsbanken but actually got the "&redirect=null"-workaround working, only tested Handelsbanken so far though, THANKS!

Rikj000 commented 4 years ago

Confirmed not working for Belfius Mobile and Payconiq. The SecScanQR workaround does work for some applications (Sometimes you need to cut a piece out of the scanned URL/Code, but at least it does the trick). But not if the applications don't offer a way to enter the codes manually / refuse to work without the Google QR Code API... Which is the case for both these apps :/

Any sight on implementation? Or another workaround to be suggested?

mar-v-in commented 3 years ago

Vision Barcode API is now added via 5e39818a20032d261215420fc72e05efad4202b5.