minvws / nl-covid19-notification-app-android

Android sources for the Dutch Covid19 Notification App
European Union Public License 1.2
163 stars 25 forks source link

Coronamelder app doesn't work with microg #31

Closed Raubion closed 3 years ago

Raubion commented 3 years ago

Describe the bug, issue or concern

Due to privacy concerns, I don't have Google Play Services installed on my Android 10 phone. For a long time, I've been running microg instead (see: https://github.com/microg/android_packages_apps_GmsCore if unknown).

When Coronamelder was just released, I was still running a microg version which hadn't implemented the Exposure Notifications API. As expected, I got the notification that I needed a Google Play Services update. About three weeks ago microg was updated to include the Exposure Notifications API and the message to update Play Services disappeared in Coronamelder.

However, upon clicking 'turn on' in the 'turn on Exposure Notifications screen' pop up, nothing seems to happen. The screen of some people and a bike that is supposed to appear, appears partly for less than a split second and then disappears again. "De app is niet actief" remains in the screen.

In short: Coronamelder cannot be turned on with microg instead of Play Services, even though latest version has the Exposure Notifaction API implemented.

To Reproduce

Steps to reproduce the behavior:

  1. Have microg instead of Play Services
  2. Try to turn on Coronamelder
  3. Don't get the outdated Play Service message
  4. But still don't have a working Coronamelder

Expected behavior

Coronamelder should work with latest version of microg since Exposure Notifications API was implemented.

Device information

Xiaomi Mi A1 with Android 10 (Lineage 17.1)

Governance

hvisser commented 3 years ago

Sorry, we can only officially support Google Play Services. The MicroG implementation is like you mention unofficial reimplementation, and might not implement all the features we that are required, or implement those features correctly.

For example MicroG isn't validating the TEK files sent to the API so potentially it's possible to spoof those files. This is a security issue.

Raubion commented 3 years ago

Thanks for the reply. So out of curiosity: do the German, Belgian and UK Corona apps have a security issue? As they work with microg, according to users. See this discussion the forum of /e/, an Android fork which relies on Microg: https://community.e.foundation/t/dutch-coronamelder-app-needs-current-g-gle-play-services/19998/117

hvisser commented 3 years ago

Yes, this is because microG can't (and doesn't) check the public key that is registered with Google as part of processing diagnostic keys. For CoronaMelder we have additional cryptographic signatures to prevent spoofing by the way.

I've seen reports stating that the app worked with microG and we're not doing anything actively to prevent it, but supporting it officially is not something that we are doing either.

Raubion commented 3 years ago

Alright, thanks for the extra information. As a matter of fact, after playing around a bit with my settings, I've figured out that the app actually does work with microg, but it is a necessary to turn on location services - so I guess this is my fault. However, since I have these turned off by the default I had no clue. Does this mean that for the app to work, location services have to be on all the time? Because in that case it would help if the app would indicate this somehow.

Edit: apparently Bluetooth Low Energy scanning will only work if location services are enabled since Android 6 - so it makes sense now.

hvisser commented 3 years ago

Google Play Services will prompt the user for this up to Android 11, and will show reminder notifications when you turn off bluetooth or location services. Apparently microG doesn't?

You're right that unless the rom you are running made this possible, location services are required for BLE scanning. I'd assume that most custom roms keep this restriction in place, as it is there for privacy reasons in the first place.

Note that CoronaMelder itself doesn't use location permission so no location data will ever be shared with CoronaMelder as this is technically not possible and not allowed under the usage terms for Exposure Notifications either.

Raubion commented 3 years ago

Right, no microg doesn't prompt a message about the location services. I understand the position to not actively support microg officially, but it might be an idea to promt a message the first time the app is opened regardless of wether microg or Play Services is installed. Such a notification would surely have helped me.

hvisser commented 3 years ago

The lastest update does this more or less, it will tell you in the onboarding that location services need to be enabled to prepare you for Google Play Services asking it when enabling the api. The app will also show on its main status that it's not working correctly with location disabled and in the update it will show new ui to help enabling location services. So I think that should help in that regard!

And thanks for pointing this out. This is good to know when other microg users raise questions.

matthijskooijman commented 3 years ago

I'm also using microg (on a Fairphone 2 with FP Open OS Android 7.1.2, and microg installed).

I noticed the same issue, but in addition to enabling location (coarse-grained location is enough, no need to enable GPS) I had to enable bluetooth as well to make it work (that is, to make Coronomelder switch from "The app is not active // Turn on app" to "The app is active").

IIUC from above, it seems that normally Play Services handles enabling location/bluetooth whatever, but apparently microg does not. Maybe I could file an appropriate issue at microg to see if this can be fixed on their end, if I understand the details well enough. Looking at the logcat (see below) of when pressing the "Turn on app" button, it seems that CoronaMelder sends a com.google.android.gms/org.microg.gms.nearby.exposurenotification.ServiceTrigger, which is handled by microg without errors. Then, how does CoronaMelder decide whether or not the service is active or not? Is there some kind of reply from microg/Play Services? I looked around the code a bit and I think the decision is made here which forwards to, I think here, which checks the GAEN status (through nl.rijksoverheid.en.enapi.nearby.ExposureNotificationApi for which I couldn't find the source quickly), but also checks bluetooth and location status explicitly.

Why does CoronaMelder even check these explicitly? Isn't the GAEN status returned by (I presume) the GAEN framework sufficient? Shouldn't that just check everything needed already (well, apparently not, but any thoughts on why)? What would be the most sensible way to improve this situation (either by making changes in CoronaMelder or microg)?

For reference, here's some logcat output from going through the wizard.

Clicking "Turn on", this shows a microg popup asking to enable EN (there is a traceback there, but I suspect it is unrelated. I could further investigate, though):

12-09 19:33:03.361 20220 20253 D ExposureNotification: Created instance 108315189 of database for ExposureNotificationService
12-09 19:33:03.409 20220 20253 D ExposureNotification: Created instance 141608342 of database for ExposureNotificationService
12-09 19:33:03.419 20220 20253 D ExposureNotification: Pending: Intent { act=org.microg.gms.nearby.exposurenotification.CONFIRM pkg=com.google.android.gms cmp=com.google.android.gms/org.microg.gms.nearby.core.ui.ExposureNotificationsConfirmActivity (has extras) }
12-09 19:33:03.420 20220 20253 D ExposureNotification: Pending: PendingIntent{d6ba522: android.os.BinderProxy@d71dbb3}
12-09 19:33:03.425  6835  8352 I ActivityManager: START u0 {act=org.microg.gms.nearby.exposurenotification.CONFIRM pkg=com.google.android.gms cmp=com.google.android.gms/org.microg.gms.nearby.core.ui.ExposureNotificationsConfirmActivity (has extras)} from uid 10221 on display 0
12-09 19:33:03.461  6835  8352 D ActivityTrigger: activityStartTrigger: Activity is Triggerred in full screen ApplicationInfo{d8014ee com.google.android.gms}
12-09 19:33:03.461  6835  8352 E ActivityTrigger: activityStartTrigger: not whiteListedcom.google.android.gms/org.microg.gms.nearby.core.ui.ExposureNotificationsConfirmActivity/204215028
12-09 19:33:03.462  6835  8352 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:33:03.462  6835  8352 D CompatibilityInfo: applicationDensity - 480
12-09 19:33:03.462  6835  8352 D CompatibilityInfo: applicationScale - 1.0
12-09 19:33:03.469  6835  8352 D ActivityTrigger: activityResumeTrigger: The activity in ApplicationInfo{d8014ee com.google.android.gms} is now in focus and seems to be in full-screen mode
12-09 19:33:03.470  6835  8352 E ActivityTrigger: activityResumeTrigger: not whiteListedcom.google.android.gms/org.microg.gms.nearby.core.ui.ExposureNotificationsConfirmActivity/204215028
12-09 19:33:03.470  6835  8352 D ActivityTrigger: ActivityTrigger activityPauseTrigger
12-09 19:33:03.478  6835 24087 D ActivityTrigger: activityResumeTrigger: The activity in ApplicationInfo{d8014ee com.google.android.gms} is now in focus and seems to be in full-screen mode
12-09 19:33:03.478  6835 24087 E ActivityTrigger: activityResumeTrigger: not whiteListedcom.google.android.gms/org.microg.gms.nearby.core.ui.ExposureNotificationsConfirmActivity/204215028
12-09 19:33:03.493  6835 24087 I ActivityManager: Start proc 20916:com.google.android.gms:ui/u0a221 for activity com.google.android.gms/org.microg.gms.nearby.core.ui.ExposureNotificationsConfirmActivity
12-09 19:33:03.493  6835 24087 W System  : ClassLoader referenced unknown path: /system/framework/QPerformance.jar
12-09 19:33:03.494  6835 24087 E BoostFramework: BoostFramework() : Exception_1 = java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.qti.Performance" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib, /vendor/lib]]
12-09 19:33:03.495  6835 24087 E BoostFramework: Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference
12-09 19:33:03.515  6835 27784 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:33:03.515  6835 27784 D CompatibilityInfo: applicationDensity - 480
12-09 19:33:03.515  6835 27784 D CompatibilityInfo: applicationScale - 1.0
12-09 19:33:03.525  6835 27784 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:33:03.525  6835 27784 D CompatibilityInfo: applicationDensity - 480
12-09 19:33:03.525  6835 27784 D CompatibilityInfo: applicationScale - 1.0
12-09 19:33:03.578  6835 20498 I Xposed  : FakeGApps: returning fake signature to com.google.android.gms
12-09 19:33:03.599 20916 20916 I MultiDex: VM with version 2.1.0 has multidex support
12-09 19:33:03.613 20916 20916 I MultiDex: Installing application
12-09 19:33:03.613 20916 20916 I MultiDex: VM has multidex support, MultiDex support library is disabled.
12-09 19:33:03.797 20916 20916 W art     : Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
12-09 19:33:03.846 20916 20916 I art     : Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
12-09 19:33:03.846 20916 20916 I art     :   at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2463)
12-09 19:33:03.846 20916 20916 I art     :   at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:938)
12-09 19:33:03.846 20916 20916 I art     :   at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:806)
12-09 19:33:03.846 20916 20916 I art     :   at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:693)
12-09 19:33:03.846 20916 20916 I art     :   at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:170)
12-09 19:33:03.846 20916 20916 I art     :   at void org.microg.gms.nearby.core.ui.ExposureNotificationsConfirmActivity.onCreate(android.os.Bundle) (ExposureNotificationsConfirmActivity.kt:35)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6723)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1119)
12-09 19:33:03.846 20916 20916 I art     :   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2619)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2727)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1478)
12-09 19:33:03.846 20916 20916 I art     :   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
12-09 19:33:03.846 20916 20916 I art     :   at void android.os.Looper.loop() (Looper.java:154)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6128)
12-09 19:33:03.846 20916 20916 I art     :   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
12-09 19:33:03.846 20916 20916 I art     :   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:889)
12-09 19:33:03.846 20916 20916 I art     :   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:779)
12-09 19:33:03.846 20916 20916 I art     :   at void de.robv.android.xposed.XposedBridge.main(java.lang.String[]) (XposedBridge.java:107)
12-09 19:33:03.846 20916 20916 I art     : Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/system/framework/com.android.location.provider.jar", zip file "/data/app/com.google.android.gms-1/base.apk"],nativeLibraryDirectories=[/data/app/com.google.android.gms-1/lib/arm, /data/app/com.google.android.gms-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
12-09 19:33:03.846 20916 20916 I art     :   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
12-09 19:33:03.846 20916 20916 I art     :   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
12-09 19:33:03.846 20916 20916 I art     :   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
12-09 19:33:03.846 20916 20916 I art     :   at void androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener(android.view.View, androidx.core.view.OnApplyWindowInsetsListener) (ViewCompat.java:2463)
12-09 19:33:03.846 20916 20916 I art     :   at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:938)
12-09 19:33:03.846 20916 20916 I art     :   at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:806)
12-09 19:33:03.846 20916 20916 I art     :   at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:693)
12-09 19:33:03.846 20916 20916 I art     :   at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:170)
12-09 19:33:03.846 20916 20916 I art     :   at void org.microg.gms.nearby.core.ui.ExposureNotificationsConfirmActivity.onCreate(android.os.Bundle) (ExposureNotificationsConfirmActivity.kt:35)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6723)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1119)
12-09 19:33:03.846 20916 20916 I art     :   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2619)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2727)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1478)
12-09 19:33:03.846 20916 20916 I art     :   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
12-09 19:33:03.846 20916 20916 I art     :   at void android.os.Looper.loop() (Looper.java:154)
12-09 19:33:03.846 20916 20916 I art     :   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6128)
12-09 19:33:03.846 20916 20916 I art     :   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
12-09 19:33:03.846 20916 20916 I art     :   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:889)
12-09 19:33:03.846 20916 20916 I art     :   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:779)
12-09 19:33:03.846 20916 20916 I art     :   at void de.robv.android.xposed.XposedBridge.main(java.lang.String[]) (XposedBridge.java:107)
12-09 19:33:03.846 20916 20916 I art     :
12-09 19:33:03.931 20916 20916 W ResourceType: ResTable_typeSpec entry count inconsistent: given 222, previously 226
12-09 19:33:03.931 20916 20916 W ResourceType: ResTable_typeSpec entry count inconsistent: given 179, previously 744
12-09 19:33:03.999 20916 20936 I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 06/17/16, f19e6a9, I9e7a63e7c4
12-09 19:33:04.005 20916 20936 I OpenGLRenderer: Initialized EGL, version 1.4
12-09 19:33:04.006 20916 20936 D OpenGLRenderer: Swap behavior 1
12-09 19:33:04.025  6835  6967 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:33:04.025  6835  6967 D CompatibilityInfo: applicationDensity - 480
12-09 19:33:04.025  6835  6967 D CompatibilityInfo: applicationScale - 1.0
12-09 19:33:04.077 20916 20921 I art     : Do partial code cache collection, code=356B, data=28KB
12-09 19:33:04.078 20916 20921 I art     : After code cache collection, code=356B, data=28KB
12-09 19:33:04.078 20916 20921 I art     : Increasing code cache capacity to 128KB
12-09 19:33:04.078  6835  6859 I ActivityManager: Displayed com.google.android.gms/org.microg.gms.nearby.core.ui.ExposureNotificationsConfirmActivity: +600ms

Then, clicking "Allow" or something in the popup:

12-09 19:33:08.325 20916 20916 W System  : ClassLoader referenced unknown path: /system/framework/QPerformance.jar
12-09 19:33:08.326 20916 20916 E BoostFramework: BoostFramework() : Exception_1 = java.lang.ClassNotFoundException: Didn't find class "com.qualcomm.qti.Performance" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib, /vendor/lib]]
12-09 19:33:08.372  6835 27200 D ActivityTrigger: ActivityTrigger activityPauseTrigger
12-09 19:33:08.380  6835 32619 D ActivityTrigger: activityResumeTrigger: The activity in ApplicationInfo{c01a1b0 nl.rijksoverheid.en} is now in focus and seems to be in full-screen mode
12-09 19:33:08.380  6835 32619 E ActivityTrigger: activityResumeTrigger: not whiteListednl.rijksoverheid.en/nl.rijksoverheid.en.MainActivity/78961
12-09 19:33:08.380  6835 32619 D ActivityTrigger: activityResumeTrigger: The activity in ApplicationInfo{c01a1b0 nl.rijksoverheid.en} is now in focus and seems to be in full-screen mode
12-09 19:33:08.380  6835 32619 E ActivityTrigger: activityResumeTrigger: not whiteListednl.rijksoverheid.en/nl.rijksoverheid.en.MainActivity/78961
12-09 19:33:08.443 20220 20253 D ExposureNotification: Created instance 50258153 of database for ExposureNotificationService
12-09 19:33:08.488  6835  6852 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:33:08.488  6835  6852 D CompatibilityInfo: applicationDensity - 480
12-09 19:33:08.489  6835  6852 D CompatibilityInfo: applicationScale - 1.0
12-09 19:33:08.490 20220 20220 D ExposureNotification: ServiceTrigger: Intent { flg=0x10 cmp=com.google.android.gms/org.microg.gms.nearby.exposurenotification.ServiceTrigger }
12-09 19:33:08.491 20220 20220 D ExposureNotification: Trigger class org.microg.gms.nearby.exposurenotification.ScannerService
12-09 19:33:08.494  6835  7503 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:33:08.494  6835  7503 D CompatibilityInfo: applicationDensity - 480
12-09 19:33:08.494  6835  7503 D CompatibilityInfo: applicationScale - 1.0
12-09 19:33:08.495 20220 20220 D ExposureNotification: Trigger class org.microg.gms.nearby.exposurenotification.AdvertiserService
12-09 19:33:08.497  6835 20498 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:33:08.497  6835 20498 D CompatibilityInfo: applicationDensity - 480
12-09 19:33:08.497  6835 20498 D CompatibilityInfo: applicationScale - 1.0
12-09 19:33:08.497 20916 20936 D OpenGLRenderer: endAllActiveAnimators on 0x94275500 (RippleDrawable) with handle 0x932d1190
12-09 19:33:08.506 20220 20220 D ExposureNotification: ScannerService.start: Intent { cmp=com.google.android.gms/org.microg.gms.nearby.exposurenotification.ScannerService }
12-09 19:33:08.509 20220 20253 D ExposureNotification: Created instance 240886437 of database for ExposureNotificationService
12-09 19:33:08.511 20220 20220 D ExposureNotification: AdvertisingService.start: Intent { cmp=com.google.android.gms/org.microg.gms.nearby.exposurenotification.AdvertiserService }
12-09 19:33:08.696  6478  6478 W SurfaceFlinger: couldn't log to binary event log: overflow.
12-09 19:33:08.711 20661 20661 I n.c.c.a.m0.a0: Provider GmsCore_OpenSSL not available

The "turn on" screen keeps showing.

Later, clicking "Turn on" again:

12-09 19:38:58.983  6835  7001 D WifiStateMachine: updateCapabilities for config:Jodocusfalse,false
12-09 19:38:59.723 20220 20253 D ExposureNotification: Created instance 262724006 of database for ExposureNotificationService
12-09 19:38:59.775 20220 20253 D ExposureNotification: Created instance 216560953 of database for ExposureNotificationService
12-09 19:38:59.799  6835  6852 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:38:59.799  6835  6852 D CompatibilityInfo: applicationDensity - 480
12-09 19:38:59.799  6835  6852 D CompatibilityInfo: applicationScale - 1.0
12-09 19:38:59.800 20220 20220 D ExposureNotification: ServiceTrigger: Intent { flg=0x10 cmp=com.google.android.gms/org.microg.gms.nearby.exposurenotification.ServiceTrigger }
12-09 19:38:59.800 20220 20220 D ExposureNotification: Trigger class org.microg.gms.nearby.exposurenotification.ScannerService
12-09 19:38:59.802  6835 24087 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:38:59.802  6835 24087 D CompatibilityInfo: applicationDensity - 480
12-09 19:38:59.802  6835 24087 D CompatibilityInfo: applicationScale - 1.0
12-09 19:38:59.803 20220 20220 D ExposureNotification: Trigger class org.microg.gms.nearby.exposurenotification.AdvertiserService
12-09 19:38:59.804  6835  8352 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:38:59.804  6835  8352 D CompatibilityInfo: applicationDensity - 480
12-09 19:38:59.804  6835  8352 D CompatibilityInfo: applicationScale - 1.0
12-09 19:38:59.811 20220 20253 D ExposureNotification: Created instance 22162421 of database for ExposureNotificationService
12-09 19:38:59.813 20220 20220 D ExposureNotification: ScannerService.start: Intent { cmp=com.google.android.gms/org.microg.gms.nearby.exposurenotification.ScannerService }
12-09 19:38:59.815 20220 20220 D ExposureNotification: AdvertisingService.start: Intent { cmp=com.google.android.gms/org.microg.gms.nearby.exposurenotification.AdvertiserService }
12-09 19:38:59.874  6835  6967 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:38:59.874  6835  6967 D CompatibilityInfo: applicationDensity - 480
12-09 19:38:59.874  6835  6967 D CompatibilityInfo: applicationScale - 1.0
12-09 19:38:59.921  6835  6967 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:38:59.921  6835  6967 D CompatibilityInfo: applicationDensity - 480
12-09 19:38:59.921  6835  6967 D CompatibilityInfo: applicationScale - 1.0
12-09 19:38:59.965  6835  6967 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:38:59.965  6835  6967 D CompatibilityInfo: applicationDensity - 480
12-09 19:38:59.965  6835  6967 D CompatibilityInfo: applicationScale - 1.0
12-09 19:38:59.996  6835  6835 D CompatibilityInfo: mCompatibilityFlags - 0
12-09 19:38:59.996  6835  6835 D CompatibilityInfo: applicationDensity - 480
12-09 19:38:59.996  6835  6835 D CompatibilityInfo: applicationScale - 1.0
12-09 19:39:00.006  7060  7060 D KeyguardUpdateMonitor: received broadcast android.intent.action.TIME_TICK
12-09 19:39:00.006  7060  7060 D KeyguardUpdateMonitor: handleTimeUpdate
hvisser commented 3 years ago

Pretty simple: bluetooth scanning requires location services to be enabled (note services so any method for location will work) and bluetooth needs to be enabled too for obvious reasons.The whole point of a GAEN app is to track encounters using bluetooth signals.

Google play services will enable bluetooth when the request is sent to enable the exposure notification framework as part of asking for consent and it will also request the user to enable location services, which is required for exposure notifications up to Android 11.

Google Play services will notify the user when either location services or bluetooth is enabled. Just enabling the framework isn't of much use. It would be good if microg would emulate what Play Services is doing here as many apps will rely on this behavior.

matthijskooijman commented 3 years ago

Pretty simple: bluetooth scanning requires location services to be enabled (note services so any method for location will work) and bluetooth needs to be enabled too for obvious reasons.The whole point of a GAEN app is to track encounters using bluetooth signals.

I understand that, but from an API design perspective it seems like that needing bluetooth and location services could be considered an implementation detail of GAEN, so that that the GAEN API should handle both enabling these and checking to see if they are enabled. But this is all theoretical, if the GAEN API was designed to only return the status of the framework itself and put the responsibility of checking (but not enabling) bluetooth and location services with the API user, then microg should probably just mimic that.

I opened https://github.com/microg/GmsCore/issues/1306 at microg, let's see what they say.

matthijskooijman commented 3 years ago

For future reference: Microg has been updated to mimic the Play Services behavior and now enables bluetooth and/or (asks to enable) location when enabling GAEN, so the experience is now smooth when using microg.