UnifiedNLP with GApps Patch - Android Software/Hacking General [Developers Only]

This package contains a few windows batch files to help you get UnifiedNLP working with (or without) Google Play Services on your phone. Extract it anywhere and run the batch files as needed. Everything required is included in the download but you will need root ADB capabilities. Learn more about ADB here:
http://wiki.lineageos.org/adb_fastboot_guide.html
For the record, I use this on Nougat. More specifically, LineageOS 14.1 so I can't say how it will work or what is necessary on other versions or roms.
Included Batch Files
To use these scripts your phone needs to be connected to your computer.
Install.bat - Install apks and addon.d updater script
Patch.bat - Patch framework-res.apk
DisableGoogle.bat - Disable Google location services and permissions
EnableGoogle.bat - Enable Google location services and permissions
Restore.bat - Delete apks, restore stock framework, enable services and permissions
GetDiff.bat - Create new patch file.
Background
UnifiedNlp is a network location provider that can be used instead of the Google network location service that's included in Google Play Services. The version used here is the GApps version that can be used along side Google Play Services.
https://github.com/microg/android_packages_apps_UnifiedNlp
Installing the Apps
Run Install.bat
UnifiedNLP has to be installed as a system app. This script installs it in /system/app along with some backends. It also installs an addon.d script so it will survive system updates if your rom supports it. Once installed, you can find the app in your app drawer. See the thread on XDA to help set it up.
https://forum.xda-developers.com/android/apps-games/app-g-unifiednlp-floss-wi-fi-cell-tower-t2991544
Patching the Framework
Run Patch.bat
To use a location provider, it's package name has to be included in the "config_locationProviderPackageNames". This script patches framework-res.apk to include the UnifiedNLP package name. I've created a thread on the LOS subreddit asking for this to be included by default but until then we'll have to patch each update.
https://www.reddit.com/r/LineageOS/comments/5u919y/support_for_unifiednlp/#ddto2rc
If patching fails run GetDiff.bat to create a new patch file:
When prompted, open arrays.patched.xml in your text editor (Notepad++ recommended)
Find 'config_locationProviderPackageNames' section
Add a new item 'org.microg.nlp'
Save and continue
Run Patch.bat again
Disabling Googles Location Service
Run DisableGoogle.bat
When you enable network location in settings you also enable Google's location service. There's no simple way to enable one without the other... Bit of a monopoly and totally wrong if you ask me, but that's the way it is. So we have to disable a couple of Google services to get UnifiedNLP working.
So now we should have UnifiedNLP working but we still have Google Play Services stalking us and constantly checking our location. This is what gives us all those NLP related wakelocks. To prevent this we just have to revoke coarse/fine location permissions for Google Play Services. DisableGoogle.bat also does this.
Disclaimer:
Needless to say, if you try this you do so at your own risk. I take no responsibility for anything.
It's always a good idea to make a full backup before doing anything like this to your phone.
Download
nlp_patch.zip
Resources:
Everything required is included in the download but if you'd like to download full versions or find out more, checkout the links.
Apktool: https://ibotpeaches.github.io/Apktool/
UnixUtils: http://unxutils.sourceforge.net/
jPortable: http://portableapps.com/apps/utilities/java_portable
ADB: https://dl.google.com/android/repository/platform-tools-latest-windows.zip

Reserved

Download updated: There was a very silly error in Patch.bat.

I'm just posting to say that my ROM won't boot after applying this patch. Fortunately, I had a backup. I'm running Resurrection Remix on a Note 4 (N910T), which is v7.1.1 and based on a mix of LineageOS and Emotion/Emotroid (the latter is AOSP). I followed the instructions to the tee. I already had adb and fastboot installed. The patch did succeed. I also tried clearing cache and dalvik cache in TWRP, but still couldn't boot. I do have GApps installed. What could have gone wrong?
Thanks!

Hmm... Not sure why it wouldn't work for you. I can only guess that the framework didn't re-compile properly or it wasn't pushed to system properly.
One thing you could try is boot to twrp, mount system and run patch.bat from there.

No GCN push
Hey, thank you very much for your effort! I have used your Windows Batch files in an editor to translate the process to Linux. Everything works flawlessly on my LG G4 with Lineage 14.1!
Without GCM, which is sadly a dealbreaker. It seems to need permission for "com.google.android.gms android.permission.ACCESS_FINE_LOCATION", the other three adb lines in your DisableGoogle.bat can be executed and GCM still works.
So I ask: What do I lose in privacy in not revoking permission for the line above?

If location permissions are allowed then google play services will keep accessing network/gps to keep track of your location. This causes all those nlp wakelocks. I did find however that using UnifiedNLP like this caused significantly less wakelocks than using the google location services. So if that's how you need it then go for it.
BTW, what's GCN push?

Sorry, I meant GCM, Google Cloud Messaging (not Notification).
The main question would be if Google still collects and tracks Wi-Fis, cell towers etc. when I don't revoke this permission. If so, the whole enterprise to get the Mozilla Location Provider to work would be rather pointless. No push notifications for Signal, Tweetings etc. is sadly not acceptable for me.

Ah, I can't comment on GCM as I've never used it but third party app's I use push ok. But that being said, you use GCM so that's what you need to work.
The whole point of this really is to stop google from stalking you (whether for privacy, battery or both). So yeah, I'd have to agree that using this and allowing those google location permissions would be pretty pointless.

Works great on my op3t thanks a million

microG's built in unified nlp and this are same?

vegoja said:
Works great on my op3t thanks a million
Click to expand...
Click to collapse
Good to know, cheers.
sohamsen said:
microG's built in unified nlp and this are same?
Click to expand...
Click to collapse
Yes. If you're using MicroG then this isn't useful for you.

Hi,
This method works if i disabled google play services only.
Disablepatch disabled my gps lock.
any idea?

The download is dead, can you reupload?

Hi. With some little changes (updating java and apktool) I managed to get Patch.bat working on LOS 15.1 *but* my device did not boot anymore once the patched framework-res.apk was in place (and booted again once I piut back the original apk). Did I miss a step? Thks in advance for your help.

@Nyakov: the download isnt dead, try again.
@Julien Faure: You probably didnt do anything wrong. I tried this same patch on Resurrection Remix Nougat many months ago, ROM wouldnt boot. I suspect that you need to disable Android's signature verification for this to work. Check out Smali Patcher.

Thansk a lot for the quick answer! If possible, I would like to avoid rooting (and thus avoid Magisk): is there a way to disable signature verification w/o it? Something to be done, applied, installed from TWRP for instance.

@Julien Faure: Smali patcher doesnt need root. It doesnt even need Magisk, despite being listed as a Magisk module on XDA.
Follow the steps in the SP thread. Since all you want is signature verification disabled, only check that box. Once it is successful, it will create a zip file. Extract the services.jar from that, boot into TWRP, replace your services.jar with the new one, set permissions on this file to 0644.
In the zip SP produces, there will also be zero byte (0 in size) files. These are placemarkers that tell Magisk to systemlessly delete these files. But since you wont be using Magisk, you need to look in /system/framework and manually delete these files. So just find the ones that match the paths and names of the zero byte files in the zip, delete them. If you cant find all of them, just skip the ones not present.
Because you are modifying the system partition, you may also need to disable dm-verity and/or Verified Boot (AVB). But since you're patching LOS, i dont believe it will be necessary.

AnonVendetta said:
@Julien Faure: Smali patcher doesnt need root. It doesnt even need Magisk, despite being listed as a Magisk module on XDA.
Follow the steps in the SP thread. Since all you want is signature verification disabled, only check that box. Once it is successful, it will create a zip file. Extract the services.jar from that, boot into TWRP, replace your services.jar with the new one, set permissions on this file to 0644.
In the zip SP produces, there will also be zero byte (0 in size) files. These are placemarkers that tell Magisk to systemlessly delete these files. But since you wont be using Magisk, you need to look in /system/framework and manually delete these files. So just find the ones that match the paths and names of the zero byte files in the zip, delete them. If you cant find all of them, just skip the ones not present.
Because you are modifying the system partition, you may also need to disable dm-verity and/or Verified Boot (AVB). But since you're patching LOS, i dont believe it will be necessary.
Click to expand...
Click to collapse
Wow thanks a lot again. Will report here once I will have tested that.

@AnonVendetta: BTW, are you aware of any ROM (not necessarily for the 5X) which supports the UNLP + GApps configuration "out-of-the-box" w/o having to apply those patches (OP's one + Smali)? Seems to me that a lot of ROMs (if not all) decided to support the "microG as a gmscore replacement" scenario only.

Related

[MODULE] Signature Spoof & Update Location Services (Stock 34.4.A.2.85 Customized_DE)

[MODULE] Signature Spoof & Update Location Services (Stock 34.4.A.2.85 Customized_DE)
Magisk Module to Signature Spoof & Update Location Services (Stock 34.4.A.2.85 Customized_DE)
!!!!DISCLAIMER: Please know what you are doing. I take no responsibility for breaking your device you are doing this on your own accord and take full responsibility for whatever happens to your device. This has been tested on my daily phone which has Stock firmware 34.4.A.2.85 (Customized_DE). I also take no responsibility for any other related or unrelated issues in your life that may happen after looking at this disclaimer.
Prerequisites:
Sony Xperia X Compact (F5321)
Magisk 16.0 (may work with 16+ but not tested)
Stock Customized_DE Firmware (v34.4.A.2.85) but may work with other Customized_XX version
TWRP (any version that can flash Magisk Module Scripts)
Install Instructions:
Reboot into TWRP
Flash Magisk Module Script
What To Do If It Didn't Work:
Dont panic. The best part of Magisk is there is low risk with systemless modules.
1.) Reboot into TWRP (with phone off hold power button and volume down)
2.) adb push the Magisk Mount Script (link)
3.) flash Magisk Mount Script
3.) delete the f5321_sigspoof folder
4.) reboot back to previous
Q&A
What does this do?
This module updates the framework.jar, services.jar, ext.jar, and framework-res.apk files through systemless interface to save stock functionality.
How was this accomplished
1.) Latest stock firmware flashed to Sony device F5321 version 34.4.A.2.85 Customized_DE
2.) /system/framework was downloaded and dodexed using Fulmics Deodexer (link)
3.) Deodexed services.jar, framework.jar, ext.jar, some other jars were used in processing with Haystack (link) to create signature spoofing.
4.) Framework-res-overlay was created to support the modifications needed for Location Services to work with MicroG (ref1) (ref2)
5.) Magisk Module template was downloaded and all the files were added to be replaced.
6.) ...
7.) profit
Why would you want this?
Honestly I don't know why you want this but I want this so that I can control and limit the exposure for location based service tracking that happens on my device on a minute by minute basis. MicroG (and by extension) UnifiedNlp allows this through locally stored location service backends. Also, MicroG allows the use of basic google services without sucking my battery dry. Can go ~3 days with light/moderate use. So thats also good.
Why use stock rom and not other custom rom (like OMNIRom)?
OMNIRom is great and amazing but I often find myself addicted to flashing the next best ROM. I also find that the one feature that is fixed in one ROM has two other unstable features that render the phone just barely stable enough for daily use.
reserved ...
JenItols said:
Magisk Module to Signature Spoof & Update Location Services (Stock 34.4.A.2.85 Customized_DE)
.
Click to expand...
Click to collapse
Don't know much about this stuff, but question - flashing module succeeded in checking unlp boxes in Microg settings, but still get no location fix when in battery-saving mode, and GPS apps show 'GPS disabled' . Any ideas? Thanks (latest stock fw... 85)
levone1 said:
Don't know much about this stuff, but question - flashing module succeeded in checking unlp boxes in Microg settings, but still get no location fix when in battery-saving mode, and GPS apps show 'GPS disabled' . Any ideas? Thanks (latest stock fw... 85)
Click to expand...
Click to collapse
Are you using UnifiedNlp.apk or NetworkLocation.apk?
UnifiedNlp.apk package is com.microg.nlp
NetworkLocation.apk package is com.google.android.gms
This fix specifies com.google.android.gms as the network location provider. This means UnifiedNlp isn't specified. I can make a separate version with UnifiedNlp but UnifiedNlp was meant to be used with true GApps like normal google services. One would argue that if you are wanting to use regular google apps then you would use MicroG which allows the use of google apps. MicroG is com.google.android.gms also and provides the UnifiedNlp package built in.
If needed I can create a version of this with UnifiedNlp.apk (com.microg.nlp) as the location provider but I would highly recommend using MicroG if you want to use the location provider along with normal google apps.
Have you configured a location provider backend?
You have to also download and install an additional location provider backend. Additional information/packages can be found here
JenItols said:
Are you using UnifiedNlp.apk or NetworkLocation.apk?
UnifiedNlp.apk package is com.microg.nlp
NetworkLocation.apk package is com.google.android.gms
This fix specifies com.google.android.gms as the network location provider. This means UnifiedNlp isn't specified. I can make a separate version with UnifiedNlp but UnifiedNlp was meant to be used with true GApps like normal google services. One would argue that if you are wanting to use regular google apps then you would use MicroG which allows the use of google apps. MicroG is com.google.android.gms also and provides the UnifiedNlp package built in.
If needed I can create a version of this with UnifiedNlp.apk (com.microg.nlp) as the location provider but I would highly recommend using MicroG if you want to use the location provider along with normal google apps.
Have you configured a location provider backend?
You have to also download and install an additional location provider backend. Additional information/packages can be found here
Click to expand...
Click to collapse
Thanks - I do know enough to configure backend, (I've used microG since a few years ago, but I don't know much technical stuff), but I didn't catch the difference between the two providers. Indeed, mine is org.microg.nlp. Don't go making a new one for me - I can just change it.
Thanks again
JenItols said:
Are you using UnifiedNlp.apk or NetworkLocation.apk?
UnifiedNlp.apk package is com.microg.nlp
NetworkLocation.apk package is com.google.android.gms
This fix specifies com.google.android.gms as the network location provider. This means UnifiedNlp isn't specified. I can make a separate version with UnifiedNlp but UnifiedNlp was meant to be used with true GApps like normal google services. One would argue that if you are wanting to use regular google apps then you would use MicroG which allows the use of google apps. MicroG is com.google.android.gms also and provides the UnifiedNlp package built in.
If needed I can create a version of this with UnifiedNlp.apk (com.microg.nlp) as the location provider but I would highly recommend using MicroG if you want to use the location provider along with normal google apps.
Have you configured a location provider backend?
You have to also download and install an additional location provider backend. Additional information/packages can be found here
Click to expand...
Click to collapse
Seems like the issue is that GMScore has unlp built in, so when installing apps for MicroG, there's no apktool needed for location provider, and trying to install NetworkLocation apktool as an update fails.
(sorry, I just got back around to this...)
JenItols said:
Are you using UnifiedNlp.apk or NetworkLocation.apk?
Click to expand...
Click to collapse
figured it out. ..

[MOD] Google Phone -Manual Install-Not for beginners

**CONTINUE AT YOUR OWN RISK**
**I ASSUME YOU KNOW HOW TO SAFELY NAVIGATE /SYSTEM & ADJUST FILES AND THEIR PERMISSIONS**
This is a write up on how to install and use the stock Google Phone app.
Yes there are simpler ways to achieve something similar. There are a few developers on xda who have patched the Google Phone app so you don't have to do the following.
I personally enjoys the harder things in life. Along with just jumping on Apkmirror and installing any new updates to the phone app without waiting for someone to patch it.
Google Play Store won't allow you to find or update (as far as I know) the Google Phone app unless your phones identifies itself to the store as a pixel. If you did manage to get your hands on the apk it'll fail to install.
(I've seen a few magisk modules that will work)
However thanks to Apkmirror and the opengapps GitHub you could get around this.
First you need to get the files that the Google Phone app requires to be within the /system partition.
com.google.android.dialer.support.xml
com.google.android.dialer.support.jar (I use API 27)
The .xml goes in /system/etc/permissions with root permissions and the .jar goes in /system/Framework also with root permissions.
So either use your favorite root file manager, TWRP, adb, and place the files in their respective location and adjust the permissions. I personally either use TWRP or adb and adjust the permissions via the chmod 0644 command on the files.
Once you have verified the files are where they belong and have the correct permissions. Install the apk, set it as the default phone app and enjoy. (Adjust all permissions to your liking)
https://github.com/opengapps/all/tree/master/
View the code and find the files.
Thank you GitHub, Opengapps, and who ever uploads the files to Apkmirror.
Information I gathered over the years and random old xda threads. Also serves as a post I can reflect back on two months from now when I forget again.
ENJOY and don't do something if you don't understand, accept responsibility for your own actions because I won't for you. Go explore the wonders of learning Linux, and have plenty of backups to fix your non fatal mistakes.
It works great, thanks!
Tachi91 said:
**CONTINUE AT YOUR OWN RISK**
**I ASSUME YOU KNOW HOW TO SAFELY NAVIGATE /SYSTEM & ADJUST FILES AND THEIR PERMISSIONS**
This is a write up on how to install and use the stock Google Phone app.
Yes there are simpler ways to achieve something similar. There are a few developers on xda who have patched the Google Phone app so you don't have to do the following.
I personally enjoys the harder things in life. Along with just jumping on Apkmirror and installing any new updates to the phone app without waiting for someone to patch it.
Google Play Store won't allow you to find or update (as far as I know) the Google Phone app unless your phones identifies itself to the store as a pixel. If you did manage to get your hands on the apk it'll fail to install.
(I've seen a few magisk modules that will work)
However thanks to Apkmirror and the opengapps GitHub you could get around this.
First you need to get the files that the Google Phone app requires to be within the /system partition.
com.google.android.dialer.support.xml
com.google.android.dialer.support.jar (I use API 27)
The .xml goes in /system/etc/permissions with root permissions and the .jar goes in /system/Framework also with root permissions.
So either use your favorite root file manager, TWRP, adb, and place the files in their respective location and adjust the permissions. I personally either use TWRP or adb and adjust the permissions via the chmod 0644 command on the files.
Once you have verified the files are where they belong and have the correct permissions. Install the apk, set it as the default phone app and enjoy. (Adjust all permissions to your liking)
https://github.com/opengapps/all/tree/master/
View the code and find the files.
Thank you GitHub, Opengapps, and who ever uploads the files to Apkmirror.
Information I gathered over the years and random old xda threads. Also serves as a post I can reflect back on two months from now when I forget again.
ENJOY and don't do something if you don't understand, accept responsibility for your own actions because I won't for you. Go explore the wonders of learning Linux, and have plenty of backups to fix your non fatal mistakes.
Click to expand...
Click to collapse
You could use Magisk an PIX3LIFY module, it should do all that for you...
Anyway, does Google Phone work just fine without any crash? Because I have Android Oreo 8.0 on my HTC 10 and I've tried to get Google Phone working but it crashes when you give contacts permissions and access your call history or the dialer keypad. Do you not have these problems on your U12+ with Android Oreo 8.0?
rfgamaral said:
You could use Magisk an PIX3LIFY module, it should do all that for you...
Anyway, does Google Phone work just fine without any crash? Because I have Android Oreo 8.0 on my HTC 10 and I've tried to get Google Phone working but it crashes when you give contacts permissions and access your call history or the dialer keypad. Do you not have these problems on your U12+ with Android Oreo 8.0?
Click to expand...
Click to collapse
Works fine for me, no issues.
In the past ive seen it crash from either wrong file permissions or incorrect framework or xml file.
I changed phone and It works great on the Rog Phone too. No crashes at all.
Hi. Newbie here. Want to install the Google dialer on wife's HTC U12+ but the link is dead? Any assistance would be greatly appreciated. Happy wife happy life?

System file modification

I've been using Pixel 3 only for two weeks, and haven't understood its security mechanism fully yet.
Usually on other phones, I simply run TWRP and modify hosts to avoid ads. After doing the same on Pixel 3 and booting into system, ads are still there, which means hosts modification didn't work properly.
So I installed Magisk from TWRP, and did the same modification on Android, and I confirmed ads were all gone as usual. Then, I uninstalled Magisk with the modified hosts left in /system/etc, and reboot the system to find ads were all back...
It looks like you need Magisk installed on Pixel 3 to keep system file modifications working. I haven't tried font modifications, but I assume the result would be the same.
Could someone explain to me what causes this system file modifications fail without Magisk installed? A new Pixel-unique system security mechanism?? Thanks in advance!
QT
Does Pixel 3 checks whether system files are signed by Google or not??
qtotter said:
Does Pixel 3 checks whether system files are signed by Google or not??
Click to expand...
Click to collapse
It is my understanding that this mod requires root.
Yes, system files have checks. That's why when you edit system files you use the original signature.
Tulsadiver said:
Yes, system files have checks. That's why when you edit system files you use the original signature.
Click to expand...
Click to collapse
Thanks for your info. Google's security policy is getting tighter...

Adding android.uid.system apps with Magisk

I'm working on porting "CIT test" application from MIUI to custom Android 11 ROMs (for calibrating proximity and fingerprint sensors), with end goal of creating a Magisk module. I'm stuck now with the application calling android.os.ServiceManager/addService, which fails with SecurityException -- I presume because I removed android:sharedUserId="android.uid.system" from its manifest, so it doesn't run with system app permissions. Currently I place it in /system/priv-app instead, which allows me to give it at least all the manifest permissions that it requires.
AFAIU, there is no way for me to simply use android.uid.system, as it requires one to sign the package with the same keys that were used for the ROM itself. As my idea is to have a general Magisk module, this is out of the question. However, because obviously I expect devices to be rooted (and can require Xposed), I want to find some way of circumventing signature check for this one package. Say, using Xposed to patch signature check, and to allow my public key to be used for android.uid.system apps. I don't want to completely disable signature checks, as this greatly compromises security.
I also thought of somehow using su to run this application as root, but apparently this is also not possible.
Is there a way to do this or something similar? Maybe I miss another way of implementing what I want? Any help or links are greatly appreciated.
I am curious about this too. It would help install the nReal nebula service on non-carrier devices and use nRreal Light AR glasses with the Nebula app.
Re-add the android.uid.system line
disable your Android Signature Verification
install with magisk to /system/app or priv-app

[GUIDE] How to get SafetyNet working with MicroG

This is a tutorial on how to set up your phone so that you can consistently pass SafetyNet. Note that all this is from my own experience, and if what works on one device blows up another, that's not my problem and I'm not responsible for that. I will attempt to keep this tutorial as clean and simple as possible, but if you have any further questions that are more specific you are welcome to ask.
In order to be as simple as possible to understand, this guide assumes the following:
- You have a PC. Windows, Mac, the almighty Linux, it makes no difference.
- You have the android platform tools on your PC
- Your device has an unlocked bootloader.
- Your device does not have support for signature spoofing.
- Your device does not have Google's official play services on it.
- You have a working brain.
If one or more of the above is incorrect, you'll have to make more use of the last item on the list.
If the last item on the list is incorrect, you're beyond hope.
Now, the guide:
Step 1: Get some magisk on your phone
Setting up magisk is incredibly simple, and I won't be going into detail here. I would recommend installing the regular magisk app and patching your boot image, as that is what I've done.
Note that you do not need the magisk manager app for this guide at all.
I've attached the magisk app I used to this post. You'll need to install the app and make use of the "install" section of the home page.
Once magisk is installed and set up, you'll need to enable zygisk in the magisk settings. Then reboot.
Step 2: Installing MicroG
I am not going to list through all the possible way you can install microG. Instead, have a link to microG's wiki:
index - MicroG
r/MicroG: Subreddit about microG, a free-as-in-freedom re-implementation of Google’s proprietary Android user space apps and libraries. This …
www.reddit.com
Now here comes the important bit:
From everything I have seen, it appears clear that google stores information about each device that registers with it, and that this in turn will affect SafetyNet.
Therefore, the best way to prevent this leading to SafetyNet failing is to prevent connection with google completely - till the phone is ready.
Before you install microG, make sure your phone has both wifi and data turned off. Leave these off till the setup is complete. Note that only the phone needs to be disconnected, nothing else matters.
In essence, this means that google sees nothing till your device is setup correctly, and then SafetyNet has nothing to complain about.
Now that you've read every word of the above paragraph, go ahead and install microG on your phone.
Make sure you've got all the different components: Core, GSF Framework, FakeStore, and DroidGuard helper. If your installation method does not handle all of this for you, then it sucks, and you shouldn't have used it. Regardless, you can find apks for all of these at https://microg.org/
Step 3: Don't touch
As I've already made clear above, do not change any microG settings at this point. Don't enable device registration (if it's disabled), don't enable safetynet, and just generally leave microG settings alone for now. Oh yeah, and don't turn on wifi or data.
Step 4: Tricking SafetyNet
Everything up till now has just been preparation for actually tricking SafetyNet. So now that we've got all that out the way, let's get down to details:
First, downloads:
Download the latest zip: https://themagisk.com/magiskhide-props-config/
Download the latest zygisk zip: https://themagisk.com/universal-safetynet-fix/
Move these over to your phone and install them both as magisk modules.
Once these modules are installed and you've rebooted, connect your phone to your pc.
Open a terminal/command prompt in your platform tools folder, and type "adb shell props". You may need to grant the superuser permission from your phone.
Then choose option 1.
You'll then need to choose a device from the list available.
The key here is that we need to spoof our device fingerprint, so google thinks the device is certified, even if it actually isn't.
If your device is approved by google, then simply select your device model.
If not, things get a bit more unclear. Not every fingerprint will work for every device - If your device is vastly different from the one you are trying to spoof things may not always work correctly. The best advice I can give here is to choose a device that matches yours as closely as possible. As an example: if your device is made by Xiaomi but is not approved by google, I would select a fingerprint belonging to a Xiaomi device.
Keep in mind that if you try a fingerprint that does not work, you cannot simply switch it to something else and try again, as the SafetyNet history for the device has to be clean.
Once you've spoofed your device fingerprint and rebooted, you're almost ready to test out SafetyNet and google sign in. But first:
Step 5: Do you need signature spoofing?
To ensure things work as smoothly as possible, it's important to make sure you have signature spoofing working before you test SafetyNet. If you've got your own solution to that great. If not:
The first thing I have to point out is that a lot of sigspoof methods on google nowadays are outdated and semi-functional at best, working for a handful of devices. As this guide is intended to be a universal solution regardless of your device, the only answer is lsposed and fakegapps.
Download the latest zygisk zip: https://themagisk.com/lsposed/
Transfer it to your phone and install it as a magisk module.
I've attached the full lsposed manager apk to this post, as the parasitic one sucks. Install it and the fakegapps apk which I've also attached to this post.
You'll now need to enable fakegapps, and turn it on for anything that might need access to spoofing. This includes the system framework, all the microG stuff, and any app that needs to be fooled by microg. Then reboot.
Step 6: Ready to test
Everything should now be set up correctly.
Check the microG settings to make sure signatures are correctly being spoofed.
Enable device registration (if disabled).
Enable SafetyNet attestation.
At this point your phone should still be completely disconnected from the internet.
If you're happy everything is set up correctly, turn on your wifi or data, and test SafetyNet attestation.
Step 7: Done.
Hopefully you now have working SafetyNet and google sign in. If this does work for you, it means that safetynet is now stable on your device, and you are free to install whatever you want on it.
If it didn't work, keep in mind that this hasn't been tested on every device in existence. All I know is that this consistently works for me.
If your phone doesn't turn on, you probably need to charge it.
If your phone has exploded, you probably have a Samsung.
Thanks everyone for reading my guide, I hope you enjoyed! (Maybe it even worked)
RESERVED FOR STUFF
Your guide is well made but I have some things I would change.
1) Since everything has to be done offline and adb is used in linux installation at least I would recommend adding an tip with adb push ~/Downloads/safetynet-tools.zip /storage/emulated/0/Downloads.
Furthermore cause of it I recommend attaching a single zip with
tools so they can be moved easily to the device.
2) there is missing Information: you said in the guide that safety net trips extremely easily. During the entire process the device cant be connected to the internet but what if you want to install another app. For example what if you want to install another app later lets say Netflix for example. I know for a fact it requires safetynet. It would be configured automatically will it? This would conclude to permanetley lock safety net till its reinstalled.
hypethetime said:
Your guide is well made but I have some things I would change.
1) Since everything has to be done offline and adb is used in linux installation at least I would recommend adding an tip with adb push ~/Downloads/safetynet-tools.zip /storage/emulated/0/Downloads.
Furthermore cause of it I recommend attaching a single zip with
tools so they can be moved easily to the device.
Click to expand...
Click to collapse
Hi, I think you may have misunderstood slightly. Only the phone has to be offline, you can still connect it to a PC and download the files on the PC. The only important thing is that the device doesn't communicate with google till you are ready for it to.
hypethetime said:
2) there is missing Information: you said in the guide that safety net trips extremely easily. During the entire process the device cant be connected to the internet but what if you want to install another app. For example what if you want to install another app later lets say Netflix for example. I know for a fact it requires safetynet. It would be configured automatically will it? This would conclude to permanetley lock safety net till its reinstalled.
Click to expand...
Click to collapse
Once the process is complete, you can install whatever else you want and safetynet will not stop working. The main thing is that the process of setting up the device so that it can be approved is very easy to mess up, so that part has to be done carefully.
I'll edit the guide to make these points more clear.
Sense_101 said:
Hi, I think you may have misunderstood slightly. Only the phone has to be offline, you can still connect it to a PC and download the files on the PC. The only important thing is that the device doesn't communicate with google till you are ready for it to.
Click to expand...
Click to collapse
I knew you always were able to use pc and you miss understood me. I at least often had the problem with transferring files for some reseason and for this adb push is extremey helpful.
Regarding instaling more apps thank you for the answer and how quickly it came.
Sense_101 said:
This is a tutorial on how to set up your phone so that you can consistently pass SafetyNet. Note that all this is from my own experience, and if what works on one device blows up another, that's not my problem and I'm not responsible for that. I will attempt to keep this tutorial as clean and simple as possible, but if you have any further questions that are more specific you are welcome to ask.
In order to be as simple as possible to understand, this guide assumes the following:
- You have a PC. Windows, Mac, the almighty Linux, it makes no difference.
- You have the android platform tools on your PC
- Your device has an unlocked bootloader.
- Your device does not have support for signature spoofing.
- Your device does not have Google's official play services on it.
- You have a working brain.
If one or more of the above is incorrect, you'll have to make more use of the last item on the list.
If the last item on the list is incorrect, you're beyond hope.
Now, the guide:
Step 1: Get some magisk on your phone
Setting up magisk is incredibly simple, and I won't be going into detail here. I would recommend installing the regular magisk app and patching your boot image, as that is what I've done.
Note that you do not need the magisk manager app for this guide at all.
I've attached the magisk app I used to this post. You'll need to install the app and make use of the "install" section of the home page.
Once magisk is installed and set up, you'll need to enable zygisk in the magisk settings. Then reboot.
Step 2: Installing MicroG
I am not going to list through all the possible way you can install microG. Instead, have a link to microG's wiki:
index - MicroG
r/MicroG: Subreddit about microG, a free-as-in-freedom re-implementation of Google’s proprietary Android user space apps and libraries. This …
www.reddit.com
Now here comes the important bit:
From everything I have seen, it appears clear that google stores information about each device that registers with it, and that this in turn will affect SafetyNet.
Therefore, the best way to prevent this leading to SafetyNet failing is to prevent connection with google completely - till the phone is ready.
Before you install microG, make sure your phone has both wifi and data turned off. Leave these off till the setup is complete. Note that only the phone needs to be disconnected, nothing else matters.
In essence, this means that google sees nothing till your device is setup correctly, and then SafetyNet has nothing to complain about.
Now that you've read every word of the above paragraph, go ahead and install microG on your phone.
Make sure you've got all the different components: Core, GSF Framework, FakeStore, and DroidGuard helper. If your installation method does not handle all of this for you, then it sucks, and you shouldn't have used it. Regardless, you can find apks for all of these at https://microg.org/
Step 3: Don't touch
As I've already made clear above, do not change any microG settings at this point. Don't enable device registration (if it's disabled), don't enable safetynet, and just generally leave microG settings alone for now. Oh yeah, and don't turn on wifi or data.
Step 4: Tricking SafetyNet
Everything up till now has just been preparation for actually tricking SafetyNet. So now that we've got all that out the way, let's get down to details:
First, downloads:
Download the latest zip: https://themagisk.com/magiskhide-props-config/
Download the latest zygisk zip: https://themagisk.com/universal-safetynet-fix/
Move these over to your phone and install them both as magisk modules.
Once these modules are installed and you've rebooted, connect your phone to your pc.
Open a terminal/command prompt in your platform tools folder, and type "adb shell props". You may need to grant the superuser permission from your phone.
Then choose option 1.
You'll then need to choose a device from the list available.
The key here is that we need to spoof our device fingerprint, so google thinks the device is certified, even if it actually isn't.
If your device is approved by google, then simply select your device model.
If not, things get a bit more unclear. Not every fingerprint will work for every device - If your device is vastly different from the one you are trying to spoof things may not always work correctly. The best advice I can give here is to choose a device that matches yours as closely as possible. As an example: if your device is made by Xiaomi but is not approved by google, I would select a fingerprint belonging to a Xiaomi device.
Keep in mind that if you try a fingerprint that does not work, you cannot simply switch it to something else and try again, as the SafetyNet history for the device has to be clean.
Once you've spoofed your device fingerprint and rebooted, you're almost ready to test out SafetyNet and google sign in. But first:
Step 5: Do you need signature spoofing?
To ensure things work as smoothly as possible, it's important to make sure you have signature spoofing working before you test SafetyNet. If you've got your own solution to that great. If not:
The first thing I have to point out is that a lot of sigspoof methods on google nowadays are outdated and semi-functional at best, working for a handful of devices. As this guide is intended to be a universal solution regardless of your device, the only answer is lsposed and fakegapps.
Download the latest zygisk zip: https://themagisk.com/lsposed/
Transfer it to your phone and install it as a magisk module.
I've attached the full lsposed manager apk to this post, as the parasitic one sucks. Install it and the fakegapps apk which I've also attached to this post.
You'll now need to enable fakegapps, and turn it on for anything that might need access to spoofing. This includes the system framework, all the microG stuff, and any app that needs to be fooled by microg. Then reboot.
Step 6: Ready to test
Everything should now be set up correctly.
Check the microG settings to make sure signatures are correctly being spoofed.
Enable device registration (if disabled).
Enable SafetyNet attestation.
At this point your phone should still be completely disconnected from the internet.
If you're happy everything is set up correctly, turn on your wifi or data, and test SafetyNet attestation.
Step 7: Done.
Hopefully you now have working SafetyNet and google sign in. If this does work for you, it means that safetynet is now stable on your device, and you are free to install whatever you want on it.
If it didn't work, keep in mind that this hasn't been tested on every device in existence. All I know is that this consistently works for me.
If your phone doesn't turn on, you probably need to charge it.
If your phone has exploded, you probably have a Samsung.
Thanks everyone for reading my guide, I hope you enjoyed! (Maybe it even worked)
Click to expand...
Click to collapse
I have a Samsung galaxy note 10 plus running LineageOS 19.1. I'ts unlocked, and rooted with Magisk. Is there something about Samsung phones that are more likely to "explode" trying to install MicroG?
WheelingPigeon said:
I have a Samsung galaxy note 10 plus running LineageOS 19.1. I'ts unlocked, and rooted with Magisk. Is there something about Samsung phones that are more likely to "explode" trying to install MicroG?
Click to expand...
Click to collapse
Yeah, that's a joke
WheelingPigeon said:
I have a Samsung galaxy note 10 plus running LineageOS 19.1. I'ts unlocked, and rooted with Magisk. Is there something about Samsung phones that are more likely to "explode" trying to install MicroG?
Click to expand...
Click to collapse
Samsung phones have a history of "blowing" up. First they were actually dangerous in very few cases but now they can expand and pop of the back of your phone. As long as you switch the battery then your safe to use it.
AOSP Rom (signature spoofing unsupported, without MicroG installer)
After Root install patch for spoofing via NanoDroid Patcher
Open Magisk settings -> Enable Zygisk + Enforce DenyList, install module MagiskHide Props Config -> reboot
Open Termux or ADB, type su to set root permission then type props (option 1)
Install MicroG via APK or offical F-Droid app, grant Signature spoofing permission
If you want using play store, install patched version (F-Droid add repo NanoDroid)
Open MicroG Settings -> Self-Check -> make sure all box checked
Turn on Google device registration, Google SafetyNet, if CTS fail then install Universal SafetyNet Fix
Install magisk module App Systemizer, Busybox for Android NDK to change MicroG to system app

Categories

Resources