microg / GmsCore

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

Granting the permissions required for EN does not work on Android 11 #1519

Closed cgrigis closed 2 years ago

cgrigis commented 3 years ago

Describe the bug Granting the permissions required for EN does not work on Android 11

To Reproduce Steps to reproduce the behavior:

  1. Install an EN-using app such as CCTG or LibreCHovid
  2. Go through the onboarding
  3. When the "Turn on Exposure Notifications" popup shows, click on "GRANT"
  4. Nothing happens

Expected behavior The permissions for the app show up and the user can grant permissions.

System Android Version: 11 Custom ROM: LineageOS 18.1

Additional context The problem has been verified with both CCTG and LibreCHovid on LineageOS 18.1, and for LibreCHovid on a stock Android 11 (Samsung A40). For some reason, CCTG does not exhibit the problem on stock Android 11.

When the problem happens, the device log shows:

107-15 13:13:22.761  3562  3562 E GrantPermissionsActivity: Apps targeting 30 must have foreground permission before requesting background and must request background on its own.

Not sure if it is related to #1440

fynngodau commented 3 years ago

Further reading:

residuum commented 3 years ago

Updating GmsCore to the latest version does not restore the behaviour with the exposure notification API, at least for the Corona Contract Tracing Germany App.

https://developer.android.com/about/versions/11/behavior-changes-all#exposure-notifications https://f-droid.org/de/packages/de.corona.tracing/

ale5000-git commented 3 years ago

The permission granting is fixed inside microG, about the other apps you should wait new versions of themself.

lgommans commented 3 years ago

I see the same behavior as described by OP, but on stock Samsung without microG. (I'd love µG but also I want the stock camera and ui so... afaict there is no way to patch sig spoofing onto stock android since android 10 :/) It seems that this problem is not (only) on µG's side.

fynngodau commented 3 years ago

For CCTG, please update to 2.8.0.0 from our repo: https://bubu1.eu/cctg

residuum commented 3 years ago

Not sure, if it is a problem with CCTG or GmsCore, but exposure notification is not working using the latest build from LineageOS for MicroG (Lineage build: lineage_FP3-userdebug 11 RQ3A.210805.001.A1 eng.root.20210903.215601 dev-keys, microG Services Code Version 0.2.22.212658) and CCTG (version 2.8.0.0).

When I try to turn on contact tracing, a modal dialog appears to activate exposure notification. When I try to give the additional rights to microG Services Core, nothing happens in the UI. In logcat I see result 5 for GrantPermissionsActivity.

Here is an excerpt from logcat:

09-07 10:58:35.297 14933 14956 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) }
09-07 10:58:35.298 14933 14956 D ExposureNotification: Pending: PendingIntent{abdbcf: android.os.BinderProxy@73fd95c}
09-07 10:58:35.303  1261  5287 I ActivityTaskManager: 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 10116
09-07 10:58:35.307   809   809 I android.hardware.power-service-qti: Power setMode: 5 to: 1
09-07 10:58:35.315  1261 16026 W ActivityTaskManager: Tried to set launchTime (0) < mLastActivityLaunchTime (13808054)
09-07 10:58:35.421   809   809 I android.hardware.power-service-qti: Power setMode: 5 to: 0
09-07 10:58:35.425  1261  1538 I ActivityTaskManager: Displayed com.google.android.gms/org.microg.gms.nearby.core.ui.ExposureNotificationsConfirmActivity: +110ms
09-07 10:58:36.804 16281 16281 W im.vector.app: type=1400 audit(0.0:2309): avc: denied { search } for name="/" dev="cgroup2" ino=1 scontext=u:r:untrusted_app:s0:c216,c256,c512,c768 tcontext=u:object_r:cgroup_bpf:s0 tclass=dir permissive=0 app=im.vector.app
09-07 10:58:37.412  1261  5287 I ActivityTaskManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.permissioncontroller cmp=com.android.permissioncontroller/.permission.ui.GrantPermissionsActivity (has extras)} from uid 10116
09-07 10:58:36.807 16281 16281 W im.vector.app: type=1400 audit(0.0:2310): avc: denied { search } for name="/" dev="cgroup2" ino=1 scontext=u:r:untrusted_app:s0:c216,c256,c512,c768 tcontext=u:object_r:cgroup_bpf:s0 tclass=dir permissive=0 app=im.vector.app
09-07 10:58:37.415   809   809 I android.hardware.power-service-qti: Power setMode: 5 to: 1
09-07 10:58:37.422  1261  5287 W ActivityTaskManager: Tried to set launchTime (0) < mLastActivityLaunchTime (13809129)
09-07 10:58:37.447  2565  2833 E PhoneInterfaceManager: [PhoneIntfMgr] getCarrierPackageNamesForIntentAndPhone: No UICC
09-07 10:58:37.484  3482  3518 V ULocation: onSetRequest: ProviderRequest[interval=+1h0m0s0ms] by WorkSource{1000 android}
09-07 10:58:37.484  3482  3518 V ULocation: using autoUpdate=true autoTime=3600000
09-07 10:58:37.485  3482  3642 D ULocClient: Set update interval to 3600000
09-07 10:58:37.486  3482  3642 D ULocService: setUpdateInterval[com.google.android.gms] interval: 3600000
09-07 10:58:37.486  3482  3642 D ULocClient: updateBinding - current: true, refs: 2, reqs: 1, avail: true
09-07 10:58:37.494  3482  3518 V ULocation: onSetRequest: ProviderRequest[interval=+1h0m0s0ms] by WorkSource{1000 android}
09-07 10:58:37.494  3482  3518 V ULocation: using autoUpdate=true autoTime=3600000
09-07 10:58:37.495  3482  3642 D ULocClient: Set update interval to 3600000
09-07 10:58:37.496  3482  3642 D ULocService: setUpdateInterval[com.google.android.gms] interval: 3600000
09-07 10:58:37.496  3482  3642 D ULocClient: updateBinding - current: true, refs: 2, reqs: 1, avail: true
09-07 10:58:37.503 16407 16407 V GrantPermissionsActivity: Permission grant result requestId=7605172671873221162 callingUid=10116 callingPackage=com.google.android.gms permission=android.permission.ACCESS_COARSE_LOCATION isImplicit=false result=5
09-07 10:58:37.508  3482  3518 V ULocation: onSetRequest: ProviderRequest[interval=+1h0m0s0ms] by WorkSource{1000 android}
09-07 10:58:37.509  3482  3518 V ULocation: using autoUpdate=true autoTime=3600000
09-07 10:58:37.511  3482  3642 D ULocClient: Set update interval to 3600000
09-07 10:58:37.512  3482  3642 D ULocService: setUpdateInterval[com.google.android.gms] interval: 3600000
09-07 10:58:37.512  3482  3642 D ULocClient: updateBinding - current: true, refs: 2, reqs: 1, avail: true
09-07 10:58:37.513  3482  3518 V ULocation: onSetRequest: ProviderRequest[interval=+1h0m0s0ms] by WorkSource{1000 android}
09-07 10:58:37.513  3482  3518 V ULocation: using autoUpdate=true autoTime=3600000
09-07 10:58:37.514  3482  3642 D ULocClient: Set update interval to 3600000
09-07 10:58:37.515  3482  3642 D ULocService: setUpdateInterval[com.google.android.gms] interval: 3600000
09-07 10:58:37.515  3482  3642 D ULocClient: updateBinding - current: true, refs: 2, reqs: 1, avail: true
09-07 10:58:37.524 16407 16407 V GrantPermissionsActivity: Permission grant result requestId=7605172671873221162 callingUid=10116 callingPackage=com.google.android.gms permission=android.permission.ACCESS_FINE_LOCATION isImplicit=false result=5
09-07 10:58:37.531  3482  3518 V ULocation: onSetRequest: ProviderRequest[interval=+1h0m0s0ms] by WorkSource{1000 android}
09-07 10:58:37.531  3482  3518 V ULocation: using autoUpdate=true autoTime=3600000
09-07 10:58:37.532  3482  3642 D ULocClient: Set update interval to 3600000
09-07 10:58:37.533  3482  3642 D ULocService: setUpdateInterval[com.google.android.gms] interval: 3600000
09-07 10:58:37.534  3482  3642 D ULocClient: updateBinding - current: true, refs: 2, reqs: 1, avail: true
09-07 10:58:37.535  3482  3518 V ULocation: onSetRequest: ProviderRequest[interval=+1h0m0s0ms] by WorkSource{1000 android}
09-07 10:58:37.535  3482  3518 V ULocation: using autoUpdate=true autoTime=3600000
09-07 10:58:37.536  3482  3642 D ULocClient: Set update interval to 3600000
09-07 10:58:37.536  3482  3642 D ULocService: setUpdateInterval[com.google.android.gms] interval: 3600000
09-07 10:58:37.537  3482  3642 D ULocClient: updateBinding - current: true, refs: 2, reqs: 1, avail: true
09-07 10:58:37.544 16407 16407 V GrantPermissionsActivity: Permission grant result requestId=7605172671873221162 callingUid=10116 callingPackage=com.google.android.gms permission=android.permission.ACCESS_COARSE_LOCATION isImplicit=false result=5
09-07 10:58:37.605  1261  9816 I ActivityTaskManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.permissioncontroller cmp=com.android.permissioncontroller/.permission.ui.GrantPermissionsActivity (has extras)} from uid 10116

I have checked permissions in the permission manager, and microG Services Core has location access only during usage. but I cannot change that to always, because it acts as a location provider. Maybe this is related.

residuum commented 3 years ago

I have managed to fix it by calling adb shell pm grant com.google.android.gms android.permission.ACCESS_BACKGROUND_LOCATION from the computer.

MartinX3 commented 2 years ago

I can't enable the Exposure Notifications. Even after reinstalling the german covid warn app.

ale5000-git commented 2 years ago

Everything should already be fixed on the latest version of microG GmsCore (v0.2.23.214816 or later) so I close it for now. Open a new issue if needed.