Giter Site home page Giter Site logo

wearefairphone / flashable-zip_microg Goto Github PK

View Code? Open in Web Editor NEW
28.0 12.0 6.0 37 KB

Install microG or UnifiedNlp into an Android system, plus an OTA survival addon.d script

Home Page: https://github.com/WeAreFairphone/flashable-zip_microG/releases

License: GNU General Public License v3.0

Shell 100.00%

flashable-zip_microg's Introduction

microG/UnifiedNlp Installer

Flashable ZIP to install microG or UnifiedNlp into an Android system. This also includes an OTA survival addon.d script.
You'll usually install them normally, but Google blocked userspace location providers in Android 7+, and some ROMs have not applied required patches yet, like LineageOS.

microG is a free-as-in-freedom re-implementation of Google’s proprietary Android user space apps and libraries.
Unified Network Location Provider (UnifiedNlp) is a library that provides Wi-Fi- and Cell-tower-based geolocation with configurable plugins to applications that use Google’s network location provider. It is included in GmsCore but can also run independently on most Android systems.

Install

You'll need a custom recovery installed on your device, such as TWRP.

Restart your device into recovery and start ADB sideload. Then run:

adb sideload <flashable-zip-name>

Alternatively, copy the resulting ZIP to your device storage, restart your device into recovery and use the GUI Install or Install ZIP option.

Note for UnifiedNLP on Android Oreo

In Oreo, the UnifiedNlp app is launched in a different way than before. After reboot, you need to go to "Location settings" in SettingsSecurity and PrivacyLocation Settings, or by tapping and holding the notification bar quick-setting for toggling location. Then, at the bottom ("Location services"), you can launch UnifiedNlp settings. There you need to enable at least one location backend for network location to work, as usual. If you chose the minimal ZIP flavour, you need to install your preferred location backends first, e.g. from F-Droid.

Build

Requirements

XMLStarlet is needed to parse F-Droid-like repo indexes.

On Debian/Ubuntu systems, run sudo apt install xmlstarlet

On Arch Linux, run sudo pacman -S xmlstarlet

Furthermore, on some barebones, Busybox-based systems (like Termux or Alpine Linux), the following packages need to be manually installed: bash, findutils, gawk, wget, zip

Build ZIP

Run the build-zip.sh shell script:

./build-zip.sh

This will generate a microg_YYYY-MM-DD.zip file.

ZIP Flavours

You can add you own flavour just by writing a <newflavour>_config.txt file.

build-zip.sh accepts a single <flavour> string argument. Each flavour has a <flavour>_config.txt file.

./build-zip.sh <flavour>

This will generate a <flavour>_YYYY-MM-DD.zip file.

For example, to build the unifiednlp flavour, run:

./build-zip.sh unifiednlp

This will generate a unifiednlp_YYYY-MM-DD.zip file.

flashable-zip_microg's People

Contributors

dllud avatar mulles avatar roboe avatar zaoqi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flashable-zip_microg's Issues

Update privapp permissions

I don't have the time and a testing device handy nowadays to test this with a minimal confidence.¹

So, please, lend a hand if you can!

A user had a bad time when their device bootlooped after flashing microg_2020-04-07.zip:

com.google.android.gms - not in privapp-permissions whitelist
10-10 20:57:08.893  9897  9897 I PackageManager: Un-granting permission android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST from package com.google.android.gms (protectionLevel=18 flags=0x20883e45)
10-10 20:57:08.937  9897  9897 E System  : java.lang.IllegalStateException: Signature|privileged permissions not in privapp-permissions whitelist: {com.google.android.gms: android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST}
10-10 20:57:08.938  9897  9897 E Zygote  : java.lang.IllegalStateException: Signature|privileged permissions not in privapp-permissions whitelist: {com.google.android.gms: android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST}
10-10 20:57:08.938  9897  9897 E AndroidRuntime: java.lang.IllegalStateException: Signature|privileged permissions not in privapp-permissions whitelist: {com.google.android.gms: android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST}
10-10 20:57:09.735 10213 10213 I zygote  : option[49]=-Xfingerprint:Fairphone/FP2/FP2:6.0.1/FP2-gms-18.04.1/FP2-gms-18.04.1:user/release-keys
10-10 20:57:12.831 10271 10271 W PackageManager: Privileged permission android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST for package com.google.android.gms - not in privapp-permissions whitelist
10-10 20:57:12.831 10271 10271 I PackageManager: Un-granting permission android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST from package com.google.android.gms (protectionLevel=18 flags=0x20083e45)
10-10 20:57:13.155 10271 10271 V PackageManager: Changing enabled state of com.google.android.gms/com.google.android.gms.nearby.messages.service.NearbyMessagesService to false
10-10 20:57:13.155 10271 10271 W PackageManager: Unable to change enabled state of com.google.android.gms/com.google.android.gms.nearby.messages.service.NearbyMessagesService to false
10-10 20:57:13.155 10271 10271 V PackageManager: Changing enabled state of com.google.android.gms/com.google.android.gms.nearby.discovery.service.DiscoveryService to false
10-10 20:57:13.156 10271 10271 W PackageManager: Unable to change enabled state of com.google.android.gms/com.google.android.gms.nearby.discovery.service.DiscoveryService to false
10-10 20:57:13.156 10271 10271 V PackageManager: Changing enabled state of com.google.android.gms/com.google.android.gms.update.SystemUpdateActivity to false
10-10 20:57:13.156 10271 10271 W PackageManager: Unable to change enabled state of com.google.android.gms/com.google.android.gms.update.SystemUpdateActivity to false
10-10 20:57:13.156 10271 10271 V PackageManager: Changing enabled state of com.google.android.gms/com.google.android.gms.update.SystemUpdateGcmTaskService to false
10-10 20:57:13.156 10271 10271 W PackageManager: Unable to change enabled state of com.google.android.gms/com.google.android.gms.update.SystemUpdateGcmTaskService to false
10-10 20:57:13.156 10271 10271 V PackageManager: Changing enabled state of com.google.android.gms/com.google.android.gms.update.SystemUpdateService to false
10-10 20:57:13.156 10271 10271 W PackageManager: Unable to change enabled state of com.google.android.gms/com.google.android.gms.update.SystemUpdateService to false
10-10 20:57:13.208   443  1820 W installd: Ignoring /data/data/com.google.android.gms/lib with unexpected GID 0 instead of 10157
10-10 20:57:13.210   443  1820 W installd: Ignoring /data/data/org.microg.gms.droidguard/lib with unexpected GID 0 instead of 10158

https://forum.fairphone.com/t/bootloop-after-trying-to-remove-unifiednlp-fixed-but-how-to-switch-to-microg/65774/3

He proposed to add this privapp permission to the privapp-permissions-microg.xml file (similar to #13):

<permission name="android.permission.CHANGE_DEVICE_IDLE_TEMP_WHITELIST"/>

Other privapp permissions might be lacking too.


¹ On a personal note, I'm in the process of moving out of Android or even mobile technology altogether. So I'll probably stop updating these projects and mark them as unmaintained if noone steps up.

microG flashable ZIP

Moved from WeAreFairphone/flashable-zips#1

@Roboe, 21 jun. 2017 20:14 CEST:

This is just an idea I think about sometimes. A flashable ZIP to integrate @microg apps into the system, for those AOSP-based OSes that refuse to apply the required patches.

What the ZIP should do:

  1. Install official APKs from microg.org to /system/app, or /system/priv-app whether necessary.
  2. Install at least one ready-to-use UnifiedNLP backend to userspace, maybe MozillaNlpBackend and NominatimGeocoderBackend (APKs from F-Droid)
  3. Install an OTA survival script (addon.d), like:

I can't find docs about addon.d backup (bulletpoint 3). Help needed with this. The script is well-documented in its first commit (it's just a script with life-cycle methods to implement), and LineageOS 50-cm.sh script is a reference implementation.

P.S.: Signature spoofing is not included because it seems to be hard to achieve from inside the phone.

@Roboe, 25 jun. 2017 20:19 CEST:

I've been doing some research for how to retrieve official APKs from microG's F-Droid repo:

  • F-Droid repo URL is: https://microg.org/fdroid/repo/
  • Repo index is a XML file located here: https://microg.org/fdroid/repo/index.xml
  • Root XML tag is fdroid and have an application tag child for each app.
  • application has a child marketvercode whose value equals the latest stable release for the app (which IMHO should be the one we should install).
  • application has multiple package childs, one per version.
  • package has a child versioncode with the version code value.
  • package has a child apkname with the full name of the APK file (which follows the pattern <appid>-<versioncode>.apk)
  • Appending the apkname value to the repo URL we get the download URL for each app.

This could be automated in a bash script, I need to figure a way to easily parse XML (XPath?) without dependencies, ideally

Edit:
With python-lxml (Bash wrapper, kinda verbose, but preinstalled on most GNU/Linux distros):

python2 -c "from lxml.etree import parse; from sys import stdin; print '\n'.join(parse(stdin).xpath('/fdroid/application/@id'))" < index.xml

With xmlstarlet:

$ VERSION_CODE=$(xmlstarlet select -t -v "/fdroid/application[@id = 'com.google.android.gms']/marketvercode" index.xml)
$ xmlstarlet select -t -v "/fdroid/application[@id = 'com.google.android.gms']/package[versioncode = '$VERSION_CODE']/apkname" index.xml
com.google.android.gms-9258259.apk

UnifiedNlp not working on LineageOS 17.0 Beta

Steps to reproduce:
Flash UnifiedNlp_2018-08-17.img via TWRP 3.3.1
Long press on location icon in pulldown menu
start osmand with Battery Saving location activated

Expected behaviour:
In location setting should be a link into UnifiedNlp-App.
Osmand~ should find location via Cell Network.

Actual behaviour:
App does not show up.
Osmand~ does not find location.

Does the UnifiedNlp work under LineageOS 17?
What adjustments need to be made to make it work?

Cannot build ZIP on Ubuntu 18.04 or 19.10 (awk positional specifiers syntax)

Hope it is okay, to ask question not concerning the Fairphone plattform. As I am using lineageOS as well I run into the same problem as you, as I need to install UnifiedNLP.apk es well through as .zip file.

The prebuild https://github.com/WeAreFairphone/flashable-zip_microG/releases/tag/2018-08-17 does not work when flashing on my nexus 4 ( apps shows app as installed, but I can not open it)

I tried to use build-zip.sh to build for lineages OS 15.1 nexus 4 but the terminal just closes after displaying "Making OTA Survival Script". Their is no ZIP being generated (or it might be in a different folder?)

Any hints

Uninstall unifiednlp-minimal_2018-08-17.zip

Can "unifiednlp-minimal_2018-08-17.zip" be uninstalled again, as I flashed it on Nexus 4, I fear that I will get throuble with upcoming LineageOS System updates when not removing it.

Update: As I have got UnifiedNLP running, no need for uninstalling it anymore.

See #4 for fix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.