Sorry if I ask something obvious, but I didn't find anything in the issues.
I compiled android 7 applying the patch for android 6 (it applied cleanly).
I can grant the signature spoofing right to GMS after installation, but the unified NLP provider doesn't work
GMS works well in AOSP 7, unified NLP doesn't. This is confirmed by the self-check activity.
After a reboot I see in the logs:
3159 3159 W PackageManager: Not granting permission android.permission.INSTALL_LOCATION_PROVIDER to package com.google.android.gms (protectionLevel=18 flags=0x38083e44)
Afterwards the nlp cannot start:
6009 6023 E NlpLocationProvider: Exception
6009 6023 E NlpLocationProvider: java.lang.SecurityException: need INSTALL_LOCATION_PROVIDER permission, or UID of a currently bound location provider
6009 6023 E NlpLocationProvider: at android.os.Parcel.readException(Parcel.java:1683)
6009 6023 E NlpLocationProvider: at android.os.Parcel.readException(Parcel.java:1636)
6009 6023 E NlpLocationProvider: at android.location.ILocationManager$Stub$Proxy.reportLocation(ILocationManager.java:1306)
6009 6023 E NlpLocationProvider: at com.android.location.provider.LocationProviderBase.reportLocation(LocationProviderBase.java:136)
6009 6023 E NlpLocationProvider: at org.microg.nlp.location.BackendFuser.updateLocation(BackendFuser.java:101)
6009 6023 E NlpLocationProvider: at org.microg.nlp.location.BackendFuser.reportLocation(BackendFuser.java:132)
6009 6023 E NlpLocationProvider: at org.microg.nlp.location.BackendHelper$Callback.report(BackendHelper.java:157)
6009 6023 E NlpLocationProvider: at org.microg.nlp.api.LocationCallback$Stub.onTransact(LocationCallback.java:55)
6009 6023 E NlpLocationProvider: at android.os.Binder.execTransact(Binder.java:565)
Am I missing something obvious? The protectionlevel in the manifest are signature|privileged hence it should be working from what I understand.
Some people reported that in some ROM it works only when it is a system app but I'm not sure.
It used to work fine in aosp 6.0 and 6.0.1, I wasn't expecting the same patch to work on android 7 but it did.
I noticed something weird though: on android 6 the gms app was listed as such in fdroid, now it's listed as 'ug unifiedNlp (noGapps)'. Could this be a symptom that some other system app was compiled and is interfering with microg?
It is a bug/missing features in F-Droid (it cannot detect correctly apps with signature spoofing), it has nothing to do with the Android version.
Sorry if I insist, but I went from a self compiled aosp 6.0 source tree (with signature spoofing patch) to a self compiled 6.0.1 source tree (with signature patch) and fdroid could detect the app just fine.
Then I self compiled aosp 7.0 source tree (with signature spoofing patch from android 6) and fdroid misdetects the app.
It seems to me it depends on the android version.
It's definitely something that changes in android 7. I get the warning
W PackageManager: Not granting permission android.permission.INSTALL_LOCATION_PROVIDER to package com.google.android.gms (protectionLevel=18 flags=0x38083e44)
even when using pm to install the package:
pm install-create -g -i com.google.android.gms
pm install-write <session> app /path/to/apk
pm install-commit <session>
every permission is granted (as it should happen with flag -g) beside INSTALL_LOCATION_PROVIDER
How I have alread said it is possible that this permission is granted only to apps in /system/priv-app although I'm not sure.
Have you tried just in case?
If you read over the internet a lot of people have the "detection" problem before Android 7 even exist.
I appreciate the fact that you mention a possible workaround, but I would like to help the project finding a solution instead.
First: this issue would usually belong to the UnifiedNlp repo.
As you build AOSP from source, the problem is probably somewhere else: AOSP is not compatible with network location providers (neither original version nor microG). Please check the details of microg/android_packages_apps_UnifiedNlp#55 for details on how to fix AOSP (this is for the AOSP-based Fairphone OS, but the requirements are the same). To my knowledge there haven't been any relevant changes between Android 6 and Android 7 in regard of network location providers.
The behaviour of INSTALL_LOCATION_PROVIDER not being granted is intentionally on current Android versions and was the case on Android 6.0 as well, you can safely ignore the message.
The issue with F-Droid is a known problem and has nothing to do with the Android version (it's not completely random, but you can safely consider it as such).
Alright, closing this and going to check https://github.com/microg/android_packages_apps_UnifiedNlp/issues/55 . Anyway on android 6 I did no further modifications to AOSP tree besides applying the patch provided in this repo.
Just to confirm, I've moved microg to /system/priv-app/, and location now works.
@pejakm how did you move it, just with mv as root? Or something more complex?
I booted into TWRP, mounted /system read-write, then ran mv /data/app/com.google.android.gms* /system/priv-app and rebooted, looks like it's working now.
Most helpful comment
I booted into TWRP, mounted
/systemread-write, then ranmv /data/app/com.google.android.gms* /system/priv-appand rebooted, looks like it's working now.