GmsCore: Corona-Warn-App problems with MicroG (Exposure Notification API)

When activating the Expore Logging in the Corona-Warn-App, microG crashes:

08-03 21:33:58.744 13117 13117 E AndroidRuntime: FATAL EXCEPTION: main
08-03 21:33:58.744 13117 13117 E AndroidRuntime: Process: com.google.android.gms, PID: 13117
08-03 21:33:58.744 13117 13117 E AndroidRuntime: java.lang.ClassCastException: org.microg.gms.nearby.exposurenotification.ExposureDatabase cannot be cast to java.lang.AutoCloseable
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at org.microg.gms.nearby.exposurenotification.ExposureNotificationServiceImpl$start$1.invoke(ExposureNotificationServiceImpl.kt:62)
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at org.microg.gms.nearby.exposurenotification.ExposureNotificationServiceImpl$start$1.invoke(ExposureNotificationServiceImpl.kt:29)
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at org.microg.gms.nearby.exposurenotification.ExposureNotificationServiceImpl$confirm$1.onReceiveResult(ExposureNotificationServiceImpl.kt:38)
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at android.os.ResultReceiver$MyRunnable.run(ResultReceiver.java:50)
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:790)
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:164)
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6494)
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
08-03 21:33:58.744 13117 13117 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

The app stays open, but after microG starts up again, I get the notification to Turn off the Exposure Notifiactions, and microG crashes again after clicking both options and the app closes (without error).
I somehow got into the app anyway after tapping alot of buttons, but while downloading the exposure data, microG crashes again. The error is always the same as in the logcat above.

I built microG at commit 5f70d943.
Corona-Warn-App is at version 1.1.1.34.
I run LineageOS 15.1 (Build date 25.06) on a Moto G4 Plus.

EDIT:

Note: the AutoCloseable interface was first added in the Build.VERSION_CODES.Q release.

From https://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper

EDIT²: After manually adding the use function (from https://github.com/JetBrains/kotlin/blob/master/libraries/stdlib/jdk7/src/kotlin/AutoCloseable.kt ), I now get this error while downloading the exporure data inside the app:

08-04 00:26:18.764 10986 12728 W ExposureNotification: java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/com.google.android.gms/databases/exposure.db
08-04 00:26:18.764 10986 12728 W ExposureNotification:  at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
08-04 00:26:18.764 10986 12728 W ExposureNotification:  at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1516)
08-04 00:26:18.764 10986 12728 W ExposureNotification:  at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1417)
08-04 00:26:18.764 10986 12728 W ExposureNotification:  at org.microg.gms.nearby.exposurenotification.ExposureDatabase.storeDiagnosisKey(ExposureDatabase.kt:127)
08-04 00:26:18.764 10986 12728 W ExposureNotification:  at org.microg.gms.nearby.exposurenotification.ExposureNotificationServiceImpl.storeDiagnosisKeyExport(ExposureNotificationServiceImpl.kt:134)
08-04 00:26:18.764 10986 12728 W ExposureNotification:  at org.microg.gms.nearby.exposurenotification.ExposureNotificationServiceImpl.access$storeDiagnosisKeyExport(ExposureNotificationServiceImpl.kt:29)
08-04 00:26:18.764 10986 12728 W ExposureNotification:  at org.microg.gms.nearby.exposurenotification.ExposureNotificationServiceImpl$provideDiagnosisKeys$1.run(ExposureNotificationServiceImpl.kt:163)
08-04 00:26:18.764 10986 12728 W ExposureNotification:  at java.lang.Thread.run(Thread.java:764)

This only happens after a while, and the startup of the app functions properly, except the window appearing which asks for exposure api to be turned off again, which can be ignored.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Just so you understand a bit more what’s happening here:

  • tek_check contains the keys that have been provided by CWA as diagnosed positive
  • diagnosis contains the information associated with each key in each single diagnosis check run. CWA does this every day and processes something like 40k-50k keys on each run, so this table gets about 50k new entries per day.
  • advertisement is the table containing your collected IDs
  • Processed 0 keys is not an issue. This happens when CWA presents keys to the service it already knows about. I’ll change the log to specifically say 0 new keys to avoid confusion.
  • UNIQUE constraint errors can happen when the CWA is running two diagnosis checks in parallel. This should not have any impact on the results though.

Great that it worked. Please let me know should you notice any issues while using CWA (except for the TODOs mentioned in #1057).

@celle1234 It should work again with latest commit df5ad9f3de16d33c0bc3c88713c8b167c5aba223