Complete tutorial how to create smali patcher (modified services.jar) that works on android 13. That can be use to spoof mock location
Tested on Samsung, Xiaomi, Realme, and other android phone. Stock ROM and also custom ROM.
Table of Contents
- Prerequisite
- Video Tutorial To Create Smali Patcher For Android 13
- File Needed To Create Smali Patcher For Android 13
- Instruction To Create Smali Patcher For Android 13
- For Android 12
Prerequisite
- Use at your own risk! I am not responsible for your actions
- Make sure to enable USB debugging, if something wrong you can disable the module using this command
- Back sure you have backup the original services.jar
- You can can use the modified services.jar from magisk modul or direcly copy it the system/framework folder
Video Tutorial To Create Smali Patcher For Android 13
File Needed To Create Smali Patcher For Android 13
- MT Manager for Android 13 & 12
- Blank smali patcher module (this is just to test your smali using magisk)
Instruction To Create Smali Patcher For Android 13
- Copy services.jar to a folder
- Open MT Manager
- open services jar >> class2.dex > dex editor plus
- Go to go to com.android > Server > location
Provider > MockLocationProvider
- Search SetProviderLocation
- replace .registers 4 to .register 6
- find .line 56
- add new line before invoke virtual
- add new line >
.local v0, "location":Landroid/location/Location;
- add new line >
const/4 v1, 0x1
- add new line >
const/4 v3, 0x0
- edit invoke virtual from p1/v1 to v3

Code
.method public setProviderLocation(Landroid/location/Location;)V
.registers 6
.line 55
new-instance v0, Landroid/location/Location;
invoke-direct {v0, p1}, Landroid/location/Location;->(Landroid/location/Location;)V
.line 56.local v0, "location":Landroid/location/Location;
const/4 v1, 0x1
const/4 v3, 0x0
invoke-virtual {v0, v3
}, Landroid/location/Location;->setIsFromMockProvider(Z)V
Injector > SystemAppOpsHelper
- Search SystemAppOpsHelper
- Seach noteOP
- Block all line from below regis to until up end of method
- type new line
const/4 v0, 0x1
return v0
- save & exit > compile
- update > ok
- copy the modified services.jar info blank smali zip file
- flash it using magisk

Code
.method public noteOp(ILandroid/location/util/identity/CallerIdentity;)Z
.registers 14
const/4 v0, 0x1
return v0
.end method
For Android 12
Tested on Pixel Experience Android 12