whatawurst / android_device_sony_yoshino-common

This is the Android device configuration for the yoshino platform
10 stars 48 forks source link

overlay: location: Whitelist UnifiedNLP as location provider #53

Closed lentinj closed 2 years ago

lentinj commented 3 years ago

Copy the config_locationProviderPackageNames from base lineageOS to whitelist org.microg.nlp, as per https://review.lineageos.org/c/LineageOS/android_vendor_lineage/+/305449

With this, and installing UnifiedNLP in /system/priv-app, seems to result in a working UnifiedNLP (at least, as far as I know to test it, I get full ticks on it's self-check and seen OSMAnd+ use a cell-tower approximate location).

This said, the better solution here may well be to remove this config block entirely and use the LineageOS defaults (I think that's what it'd do? I'm still feeling my way round building Android) since with this they're the same (assuming the comment is right and order doesn't matter). Looks like at one point it was useful to enable the qualcomm location provider, but that was removed in https://github.com/whatawurst/android_device_sony_yoshino-common/commit/9719dd4909f177ac7ed063c3b2069f4a095b00e0.

derfelot commented 2 years ago

From what I can tell, the LOS default only contains com.android.location.fused , see here: https://github.com/LineageOS/android_frameworks_base/blob/lineage-18.1/core/res/res/values/config.xml#L1654

So if this works fine, I'll merge it as is.

lentinj commented 2 years ago

They appear in vendor/lineage/overlay/common/frameworks/base/core/res/res/values/config.xml, which will presumably override frameworks/base/core/res/res/values/config.xml (which as you say, only has com.android.location.fused).

derfelot commented 2 years ago

Oh right, missed that one. In that case, I think we can just remove it, that would be cleaner. Can you change your commit accordingly and see if things still work as expected? thanks!

lentinj commented 2 years ago

Seems to work. With the above commit, and installing UnifiedNLP with:-

# wget https://github.com/microg/UnifiedNlp/releases/download/v1.6.8/NetworkLocation.apk
# wget -O privapp-permissions-unifiednlp.xml https://github.com/microg/android_packages_apps_UnifiedNlp/files/4148098/privapp-permissions-unifiednlp.txt
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := UnifiedNLP
LOCAL_SRC_FILES := NetworkLocation.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_PRIVILEGED_MODULE := true
LOCAL_REQUIRED_MODULES := privapp-permissions-unifiednlp.xml

LOCAL_MODULE_SUFFIX :=  $(COMMON_ANDROID_PACKAGE_SUFFIX)

include $(BUILD_PREBUILT)

######################

include $(CLEAR_VARS)

LOCAL_MODULE := privapp-permissions-unifiednlp.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
LOCAL_SRC_FILES:= privapp-permissions-unifiednlp.xml

include $(BUILD_PREBUILT)

...I get working network-based location with Here GPS. Although the Mozilla backend needs a reboot before it registers properly.

UnifiedNLP straight from f-droid can't register, and without the additional permissions XML the phone doesn't boot.