diff --git a/Dockerfile b/Dockerfile index ef153aa5..1a77a5a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ ENV USER root ENV USE_CCACHE 1 # We need to specify the ccache binary since it is no longer packaged along with AOSP -ENV CACHE_EXEC /usr/bin/ccache +ENV CCACHE_EXEC /usr/bin/ccache # ccache maximum size. It should be a number followed by an optional suffix: k, # M, G, T (decimal), Ki, Mi, Gi or Ti (binary). The default suffix is G. Use 0 @@ -108,6 +108,9 @@ ENV LOGS_SUBDIR true # example. ENV SIGNATURE_SPOOFING "no" +# Apply the microG unifiedNLP patch +ENV SUPPORT_UNIFIEDNLP false + # Generate delta files ENV BUILD_DELTA false diff --git a/README.md b/README.md index 02697411..6ac0fa9f 100644 --- a/README.md +++ b/README.md @@ -76,11 +76,21 @@ The signature spoofing patch can be optionally included with: If in doubt, use `restricted`: note that packages that requires the FAKE_SIGNATURE permission must be embedded in the build by adding them in +### UnifiedNLP support + +If you enable signature spoofing and want to use unifiednlp from microg, the patche +to support is can be enabled using: + * `UNIFIEDNLP_SUPPORT` (false): `true` to patch in unifiednlp support + +### Custom Packages + * `CUSTOM_PACKAGES` Extra packages can be included in the tree by adding the corresponding manifest XML to the local_manifests volume. + + ### Proprietary files Some proprietary files are needed to create a LineageOS build, but they're not diff --git a/src/build.sh b/src/build.sh index 48bfa56a..950f99db 100755 --- a/src/build.sh +++ b/src/build.sh @@ -218,6 +218,25 @@ for branch in ${BRANCH_NAME//,/ }; do fi fi + if [ "$SUPPORT_UNIFIEDNLP" = "true" ]; then + # Determine which patch should be applied to the current Android source tree + patch_name="" + case $android_version in + 10* ) patch_name="android_frameworks_base-Q.patch" ;; + esac + + if ! [ -z $patch_name ]; then + cd frameworks/base + echo ">> [$(date)] Applying location services patch" + patch --quiet -p1 -i "/root/location_services_patches/$patch_name" + git clean -q -f + cd ../.. + else + echo ">> [$(date)] ERROR: can't find a unifiednlp support patch for the current Android version ($android_version)" + exit 1 + fi + fi + echo ">> [$(date)] Setting \"$RELEASE_TYPE\" as release type" sed -i "/\$(filter .*\$(${vendor^^}_BUILDTYPE)/,+2d" "vendor/$vendor/config/common.mk" diff --git a/src/location_services_patches/android_frameworks_base-N.patch b/src/location_services_patches/android_frameworks_base-N.patch new file mode 100644 index 00000000..df410e07 --- /dev/null +++ b/src/location_services_patches/android_frameworks_base-N.patch @@ -0,0 +1,14 @@ +diff --git a/services/core/java/com/android/server/ServiceWatcher.java b/services/core/java/com/android/server/ServiceWatcher.java +index 383e25a..31ae918 100644 +--- a/services/core/java/com/android/server/ServiceWatcher.java ++++ b/services/core/java/com/android/server/ServiceWatcher.java +@@ -92,8 +92,7 @@ public class ServiceWatcher implements ServiceConnection { + String pkg = initialPackageNames.get(i); + try { + HashSet set = new HashSet(); +- Signature[] sigs = pm.getPackageInfo(pkg, PackageManager.MATCH_SYSTEM_ONLY +- | PackageManager.GET_SIGNATURES).signatures; ++ Signature[] sigs = pm.getPackageInfo(pkg, PackageManager.GET_SIGNATURES).signatures; + set.addAll(Arrays.asList(sigs)); + sigSets.add(set); + } catch (NameNotFoundException e) { diff --git a/src/location_services_patches/android_frameworks_base-Q.patch b/src/location_services_patches/android_frameworks_base-Q.patch new file mode 100644 index 00000000..30a956b7 --- /dev/null +++ b/src/location_services_patches/android_frameworks_base-Q.patch @@ -0,0 +1,16 @@ +diff --git a/services/core/java/com/android/server/ServiceWatcher.java b/services/core/java/com/android/server/ServiceWatcher.java +index e3dc3b7a984..d72fc64dbcd 100644 +--- a/services/core/java/com/android/server/ServiceWatcher.java ++++ b/services/core/java/com/android/server/ServiceWatcher.java +@@ -87,9 +87,8 @@ public class ServiceWatcher implements ServiceConnection { + ArrayList> signatureSets = new ArrayList<>(packageNames.length); + for (String packageName : packageNames) { + try { +- Signature[] signatures = pm.getPackageInfo(packageName, +- PackageManager.MATCH_SYSTEM_ONLY +- | PackageManager.GET_SIGNATURES).signatures; ++ Signature[] signatures = pm.getPackageInfo(packageName, PackageManager.GET_SIGNATURES).signatures; ++ + + HashSet set = new HashSet<>(); + Collections.addAll(set, signatures);