Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Unable to install on Android 9 (LineageOS 16) #181

Open
sirtoobii opened this issue Dec 11, 2019 · 14 comments · May be fixed by #187
Open

Unable to install on Android 9 (LineageOS 16) #181

sirtoobii opened this issue Dec 11, 2019 · 14 comments · May be fixed by #187

Comments

@sirtoobii
Copy link

sirtoobii commented Dec 11, 2019

The described method in the readme (copying the apk to /priv-app) does not work anymore on Android 9 due the permission-whitelist enforcing ASOP docs. As a result of this, your phone won't boot if you just copy the apk to priv-app!
As far as I understand, the issue should be solvable by creating a matching priv-app-permission.xml file in /etc/permissions.

I'm willing to contribute the required changes to the readme - however since I'm pretty unfamiliar with the android stack a need a bit more information:

  • What would be the package name(s) and their required permissions
  • Is there any kind of signature stuff involved?
@SOwOphie
Copy link

SOwOphie commented Dec 15, 2019

For anybody who found themselves here after following the README instructions and discovering their device no longer boots correctly (-.-"), here is how to unbrick it again (using TWRP):

  1. Boot into Recovery.
  2. Select "Mount".
  3. Tick the box "System", make sure "Mount system partition read-only" is disabled.
  4. Don't touch any of the buttons below. Your system is already mounted by ticking the box.
  5. Go back to the main menu, select "Advanced", "File Manager".
  6. Navigate to /system/priv-app.
  7. Select NetworkLocation.apk, then "Delete".
  8. Go back to the main menu, select "Reboot", "System".

Leaving this here as "just delete the file again" is obvious, but how to mount the right thing was not for me.

@SOwOphie
Copy link

I've used Stanley to extract the manifest of NetworkLocation.apk. It lists the app's name and permissions.

<?xml version="1.0" encoding="UTF-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="20187" android:versionName="1.6.8" package="com.google.android.gms" platformBuildVersionCode="24" platformBuildVersionName="7.0">
  <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="24"/>
  <permission android:label="@id/0x7F070020" android:name="org.microg.permission.FORCE_COARSE_LOCATION" android:protectionLevel="1" android:permissionGroup="android.permission-group.LOCATION" android:description="@id/0x7F07001F"/>
  <uses-permission android:name="android.permission.INSTALL_LOCATION_PROVIDER"/>
  <uses-permission android:name="android.permission.ACCESS_COARSE_UPDATES"/>
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
  <uses-permission android:name="org.microg.permission.FORCE_COARSE_LOCATION"/>
  <uses-permission android:name="com.android.settings.INJECT_SETTINGS"/>
  <application android:label="@id/0x7F07001D" android:icon="@id/0x7F030000" android:allowBackup="true">
    <activity android:label="@id/0x7F07001D" android:icon="@id/0x7F030001" android:name="org.microg.nlp.ui.SettingsLauncherActivity">
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
    </activity>
    <uses-library android:name="com.android.location.provider"/>
    <service android:name="org.microg.nlp.location.LocationServiceV1" android:permission="android.permission.ACCESS_COARSE_LOCATION" android:exported="true">
      <intent-filter>
        <action android:name="com.android.location.service.NetworkLocationProvider"/>
        <action android:name="com.google.android.location.NetworkLocationProvider"/>
      </intent-filter>
      <meta-data android:name="serviceVersion" android:value="1"/>
      <meta-data android:name="version" android:value="1"/>
    </service>
    <service android:name="org.microg.nlp.location.LocationServiceV2" android:permission="android.permission.ACCESS_COARSE_LOCATION" android:exported="true">
      <intent-filter>
        <action android:name="com.android.location.service.v3.NetworkLocationProvider"/>
        <action android:name="com.android.location.service.v2.NetworkLocationProvider"/>
      </intent-filter>
      <meta-data android:name="serviceVersion" android:value="2"/>
      <meta-data android:name="serviceIsMultiuser" android:value="false"/>
    </service>
    <service android:name="org.microg.nlp.geocode.GeocodeServiceV1" android:exported="true">
      <intent-filter>
        <action android:name="com.android.location.service.GeocodeProvider"/>
        <action android:name="com.google.android.location.GeocodeProvider"/>
      </intent-filter>
      <meta-data android:name="serviceVersion" android:value="2"/>
      <meta-data android:name="serviceIsMultiuser" android:value="false"/>
    </service>
    <service android:name="org.microg.nlp.ui.SettingInjectorService">
      <intent-filter>
        <action android:name="android.location.SettingInjectorService"/>
      </intent-filter>
      <meta-data android:name="android.location.SettingInjectorService" android:resource="@id/0x7F060001"/>
    </service>
    <activity android:theme="@id/0x7F090138" android:label="@id/0x7F07001E" android:icon="@id/0x7F030001" android:name="org.microg.nlp.ui.SettingsActivity"/>
    <receiver android:name="org.microg.nlp.PackageReceiver">
      <intent-filter>
        <action android:name="android.intent.action.PACKAGE_CHANGED"/>
        <action android:name="android.intent.action.PACKAGE_UPGRADED"/>
        <action android:name="android.intent.action.PACKAGE_REMOVED"/>
        <action android:name="android.intent.action.PACKAGE_REPLACED"/>
        <action android:name="android.intent.action.PACKAGE_RESTARTED"/>
        <data android:scheme="package"/>
      </intent-filter>
    </receiver>
    <meta-data android:name="org.microg.nlp.API_VERSION" android:value="@id/0x7F070057"/>
    <activity android:theme="@id/0x01030010" android:name="org.microg.nlp.api.MPermissionHelperActivity" android:exported="true"/>
  </application>
</manifest>

Stanley also shows the certificate used to sign the .apk:

(NOGAPPS Project)
O=NOGAPPS Project,C=DE
SHA-1:10321BD893F69AF97F7573AAFE9DE1DC0901F3A1

@pedrxd
Copy link

pedrxd commented Feb 3, 2020

I build a magisk module and work correctly.
The permission file I use:
privapp-permissions-unifiednlp.txt

@sirtoobii
Copy link
Author

@pedrxd Thank you for your input. However, If you install UnifiedNlp as location provider without the "gms-core" there is no need to spoof the signature (as far as I understand) and therefore the permissions should be something like <package="org.microg.*">

@pedrxd
Copy link

pedrxd commented Feb 4, 2020

Yes, that was strange for me. But I check the name that unifiedNLP package have and was the same as the google one. So when i made the permission file I use the same. Probably I use the wrong apk when installing unifiedNLP.

@sirtoobii
Copy link
Author

Ah ok. I'll check it on Thursday and update this comment accordingly.

@bboyDmT
Copy link

bboyDmT commented May 9, 2020

As of today it seems not to be possible to install standalone Unified NLP with Lineage OS 16? Or is there some workaround?

@pedrxd
Copy link

pedrxd commented May 9, 2020

Copy this apk to /system/priv-app/UnifiedNLP/ and this permission file to /system/etc/permissions/ (remember use the .xml extension) .
Working for me without Gapps.

@k4ps
Copy link

k4ps commented May 10, 2020

So I tried these two files and did
adb push NetworkLocation.apk /system/priv-app/UnifiedNLP/NetwortkLocation.apk
and
adb push privapp-permissions-unifiednlp.txt /system/etc/permissions/privapp-permissions-unifiednlp.txt
and my phone won't boot. Do I have to rename them some specific way?

Edit: Renamed the apk to UnifiedNLP.apk and the permission file to privapp-permissions-unifiednlp.xml. Now its booting again.

@SOwOphie
Copy link

The name of the .apk is irrelevant, but the permissions file needs to be a .xml. Can confirm it also works for me.

@bboyDmT
Copy link

bboyDmT commented May 10, 2020

Thank you! Can confirm working with .xml.

No magisk microG module was needed (which broke all gsf dependant apps).

Is it possible to update the description, it seems like legit workaround?

Tested on LG G4, Lineage OS 16.0, Android 9. System without GApps.

@sirtoobii sirtoobii linked a pull request May 14, 2020 that will close this issue
@TontyTon
Copy link

TontyTon commented Jun 7, 2020

Can anybody explain how to use it with gapps?

@sirtoobii
Copy link
Author

@TontyTon As far as I understand this implementation this is not possible since this is a replacement of a Google Play Services component.

@TontyTon
Copy link

TontyTon commented Jun 8, 2020

@sirtoobii I was talking about this (org.microg.nlp) -

UnifiedNlp.apk – for Android WITH Gapps

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

Successfully merging a pull request may close this issue.

6 participants