Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Permissions not requested #1100

Closed
ploink opened this issue Jul 27, 2020 · 20 comments
Closed

Permissions not requested #1100

ploink opened this issue Jul 27, 2020 · 20 comments

Comments

@ploink
Copy link

ploink commented Jul 27, 2020

First, thank you very much for latest release! (v0.2.11.202414)
Even though I collected all the checkmarks in self-check, gmscore is still missing permissions ACCESS_FINE_LOCATION and READ_EXTERNAL_STORAGE. It does not request them.

One can check for ungranted permissions with:
$ dumpsys package com.google.android.gms | grep granted=false

For now I have granted the permissions manually:
$ pm grant com.google.android.gms android.permission.ACCESS_FINE_LOCATION
$ pm grant com.google.android.gms android.permission.READ_EXTERNAL_STORAGE

@patrickdrd
Copy link

I think I've got a similar problem,
location permission isn't granted and:

problems with google maps, after opening the app,
my location isn't detected

(I'm running google maps version 10.19.2 because of the message about google play services that needed to be updated..)

please @mar-v-in check and fix

@D3SOX
Copy link
Contributor

D3SOX commented Oct 15, 2020

For me background location is not working and granting doesn't work either. Using NanoDroid-22.9.20200910

microG permissions screen

Screenshot_20201015-094640

Terminal output

Screenshot_20201015-094621

@ploink
Copy link
Author

ploink commented Oct 16, 2020

@D3SOX I noticed you have permission flag APPLY_RESTRICTION set to the background location permission. My phone does not have that:
android.permission.ACCESS_BACKGROUND_LOCATION: granted=true, flags=[ SYSTEM_FIXED|GRANTED_BY_DEFAULT|USER_SENSITIVE_WHEN_GRANTED|USER_SENSITIVE_WHEN_DENIED|RESTRICTION_INSTALLER_EXEMPT|RESTRICTION_SYSTEM_EXEMPT|RESTRICTION_UPGRADE_EXEMPT]
Maybe your rom has some additional security features or you have some security app installed that causes this. Open app info for gmscore and see if you can change background location permissions there.
You can also try deleting data for gmscore, that will wipe all permissions for the app so you can try assign them again.

@mar-v-in
Copy link
Member

ACCESS_BACKGROUND_LOCATION is a hard restricted permission, which means that the decision if you can enable it is done by the app installing it (or if the app is part of the system image, the system decides this). Thus, this maybe is an issue of NanoDroid? @Nanolx

@drrossum
Copy link

drrossum commented Oct 16, 2020 via email

@D3SOX
Copy link
Contributor

D3SOX commented Oct 16, 2020

@ploink

I already tried changing the permission from there but it has no option for it

Screenshot_20201016-130118

When I tap on location settings it just takes me there

Screenshot_20201016-131024

The ROM is Paranoid Android, self compiled with signature spoofing patch
(patch worked but I had to adjust the paths) and without Gapps

Deleting data didn't change anything

Nevertheless, I don't think this is as big of an issue since I haven't noticed anything that doesn't work. Other Apps with background location granted work as expected.
Only the checkbox is not checked.

@Nanolx
Copy link
Contributor

Nanolx commented Oct 16, 2020

@mar-v-in likely. I've observed that installing NanoDroid directly into /system seems to always work, but depending on the ROM installing as Magisk Module may fail in this regard.

A temporary fix is to install uG as user app

pm install -r /data/adb/modules/NanoDroid/system/priv-app/GmsCore/GmsCore.apk

(or NanoDroid_microG instead of NanoDroid, depending on the module installed).

I'll investigate further, but may take a few days.

@Nanolx
Copy link
Contributor

Nanolx commented Oct 17, 2020

Yes, it's just like that. Installing NanoDroid into /system before booting the ROM the first time (just as one does with GApps; install ROM > install NanoDroid to /system > boot into ROM) solves that issue. It also properly auto-grants all permissions to GmsCore (except android.permission.FAKE_PACKAGE_SIGNATURE), which is desireable, though.

Most A/B or S-A-R devices require /data to be clean when starting the first time (observed this on OnePlus 5T and OnePlus 6), thus installing NanoDroid as Magisk Module is always "dirty flashed" (flash ROM > boot into ROM > boot into TWRP > Flash Magisk > Flash NanoDroid); "clean flash" (install ROM > install Magisk > install NanoDroid > boot into ROM) like mentioned above results in a boot loop on those devices, thus is not possible.

For one reason or another Android does deny android.permission.ACCESS_BACKGROUND_LOCATION on "dirty flashes", even though it is properly privapp-whitelisted. Also all other should-be auto-granted permission need to be manually granted, as opposed to /system mode installation.

On older devices where you can flash ROM and Magisk in one go and sucessfully boot up, this does not happen. As mentioned before pm install -r /data/adb/modules/NanoDroid/system/priv-app/GmsCore/GmsCore.apk fixes the issue for Magisk Installations aswell.

I observed this on both Android 10 (AICP 15) and Android 11 (Syberia 4.1). Tomorrow I'll update the Magisk Modules's service.sh in order to silently auto-"userify" GmsCore, to workaround the issue.

Since no Magisk GApps package exists (until now I never thought about why that's the case) and given that privapps should be available right from the very first start, I suspect that behaviour is actually on purpose, so that proposed change to service.sh is likely the ultimate best I could come up with for installing NanoDroid as Magisk Module.

Unless someone can point me into a different direction.

Nanolx added a commit to Nanolx/NanoDroid that referenced this issue Oct 18, 2020
@ploink
Copy link
Author

ploink commented Oct 18, 2020

@Nanolx

Unless someone can point me into a different direction.

One thing left to try is requesting the permission on behalf of the gmscore userId, similar to #1102

On my phone the permission is granted, but when I try to revoke the permission as root, I get:

# pm revoke com.google.android.gms android.permission.ACCESS_BACKGROUND_LOCATION                                      
Security exception: Non-System UID cannot revoke system fixed permission android.permission.ACCESS_BACKGROUND_LOCATION for package com.google.android.gms

But using the app's system user id works:

#dumpsys package com.google.android.gms | grep userId=                                          
    userId=10174
    userId=10174
#pm revoke --user 10174 com.google.android.gms android.permission.ACCESS_BACKGROUND_LOCATION

So if you grant it with the "--user" option it might work too?

The permission on my phone:

      android.permission.ACCESS_BACKGROUND_LOCATION: restricted=true
        android.permission.ACCESS_BACKGROUND_LOCATION: granted=true, flags=[ 
SYSTEM_FIXED
|GRANTED_BY_DEFAULT
|USER_SENSITIVE_WHEN_GRANTED
|USER_SENSITIVE_WHEN_DENIED
|RESTRICTION_INSTALLER_EXEMPT
|RESTRICTION_SYSTEM_EXEMPT
|RESTRICTION_UPGRADE_EXEMPT]

I suppose different roms have different permission flags, the "RESTRICTION_SYSTEM_EXEMPT" makes it work with the "--user" option and "RESTRICTION_UPGRADE_EXEMPT" allows granting the permission on upgrading the apk.

@D3SOX None of the exempt flags are set in your case, so I doubt any of these two methods work for you? Considering you rom is Paranoid Android, this may be by design.

@Nanolx
Copy link
Contributor

Nanolx commented Oct 19, 2020

@ploink I've modified the nanodroid-perm script to do so.

For reference: https://gitlab.com/Nanolx/NanoDroid/-/commit/0437a12adf71a28b370fe0d3a92b92609ef1c038

Time to roll-out NanoDroid 22.90 (23.0-beta1), because now after all this rework and fixing is almost finished, it's time to give brave users the opportunity to test. :]

@ghost
Copy link

ghost commented Dec 21, 2020

Hi, I can't grant some permissions either (They also have APPLY_RESTRICTION activated):

android.permission.RECEIVE_SMS: granted=false, flags=[ USER_SENSITIVE_WHEN_GRANTED|USER_SENSITIVE_WHEN_DENIED|APPLY_RESTRICTION]
android.permission.ACCESS_BACKGROUND_LOCATION: granted=false, flags=[ USER_SENSITIVE_WHEN_GRANTED|USER_SENSITIVE_WHEN_DENIED|APPLY_RESTRICTION]

I'm running ProtonAOSP (with Android 11) on a Pixel 5 using Magisk and the microG installer revived module.
I see that some workarounds for Nanodroid have been included, but what about other installation methods? How can I grant those permissions? Will I have to do a factory reset/wipe data?

@Nanolx
Copy link
Contributor

Nanolx commented Jan 3, 2021

The fix is to install microG not just as a priv-app, but also as a user-app, i. e. an update.

a) go to /data/adb/modules/microG_blabla/system/priv-app/GmsCore/GmsCore.apk and tap on the APK to install it as update
b) remove any runtime-permissions.xml from /data/users/*/
c) reboot
d) grant all permissions again

profit.

@xdevs23
Copy link

xdevs23 commented Feb 13, 2021

@Nanolx That's a very important step to take. I had GmsCore installed in priv-app but not as an user app and was facing the same issue. Now, being a priv-app and a user app it works.

I'll be looking into how to get location to work properly as apps don't seem to be able to get any location even though I have 3 network-based geolocation modules installed (do I need to also install address lookup modules?).

I'm using Android 11 (halogenOS)

@bugsyb
Copy link

bugsyb commented Mar 18, 2021

@Nanolx - thanks for details. Unfortunately even if did the steps, after reboot and re-opening MicroG - it shows all permissions in place and checking UI "Self-check" shows all checked (originally did check the last two remaining - Location in background and SMS access earlier, straight after installing User-level app following other steps).
runtime-permissions.xml has been removed afterwards, reboot, checked that all is still in place as allowed.

Waze still shows "Connecting to network" and nothing shows on map.

What to do now? Need to re-install MicroG or something?

The fix is to install microG not just as a priv-app, but also as a user-app, i. e. an update.

a) go to /data/adb/modules/microG_blabla/system/priv-app/GmsCore/GmsCore.apk and tap on the APK to install it as update
b) remove any runtime-permissions.xml from /data/users/*/
c) reboot
d) grant all permissions again

profit.

@bugsyb
Copy link

bugsyb commented Mar 18, 2021

Reinstalled Waze, on launch got question about location access with only two options:

  • when running
  • deny

Nothing to select in background.

After accepting the only positive option of when running ap, got message "microG DroidGuard Helper keeps stopping".

Am on Android 10 (Unihertz Jelly 2).

@xdevs23
Copy link

xdevs23 commented Mar 18, 2021

Coming back to the location issue, I have been told (and observed) that simply waiting for a while (like 1-2 days) will help get location working. For me, now it works perfectly fine.
I have multiple location modules installed, although I don't know the exact usefulness of every single one of them.

Network-based geolocation modules:

  • Déjà Vu Location Service
  • GSM Location Service
  • Mozilla Location Service
  • Radiocells.org Unified Network Location Provider Backend
  • WiFi Location Service

Address lookup modules:

  • Nominatim

All of these are obtainable through F-Droid.

@bugsyb
Copy link

bugsyb commented Mar 18, 2021

Many thanks for swift answer!

Found a workaround by logging in to old Waze account with email via notifications and then all worked all of the sudden. Miserably it is gmail account :-O :-(

Second observation is that at the time when problem persists, no search for places works well, first page of results shows up, but not extended ("Around you", after typing name and then "Search") where "Google, FourSquare" and others are.

Also additional observation is that there was no Terms & Conditions shown as normally is. Some something around some Google Services is going on or other sort of registration.

@ploink
Copy link
Author

ploink commented Mar 18, 2021

I have multiple location modules installed, although I don't know the exact usefulness of every single one of them.

Network-based geolocation modules:

  • Déjà Vu Location Service
  • GSM Location Service
  • Mozilla Location Service
  • Radiocells.org Unified Network Location Provider Backend
  • WiFi Location Service

Some of those may be outdated and I am not sure if they interfere with each other. I suggest you start with only one that is known to work before you try others, for example the GSM Location Service fork from devee. He continued the original work from n76 and included some of the code from my fork to make it work with Android 10 and 4G/5G. Remember to go into the backend config and download the appropriate database for your region.

Nominatim is good, keep that.

@xdevs23
Copy link

xdevs23 commented Mar 18, 2021

@ploink thanks for your suggestion!

[...] I suggest you start with only one that is known to work before you try others [...]

From my understanding, they do different things in different ways allowing combined location (WiFi, radio, etc.)

I will start disabling one after the other, seeing if they worsen location accuracy or speed.

EDIT: I'm already using the GSM Location Service fork you suggested.

@ale5000-git
Copy link
Member

Everything should already be fixed on the latest version so I close it for now.
Open a new issue if needed.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants