[Xperia Z2 General] shaiya87:
for editing we need apk tool or batch apk tool or mt manager. We decompile framework.jar and look for a method in smali along the path android / net / wifi / WifiManager.smali

and we are looking for a method

.method public setCountryCode(Ljava/lang/String;Z)V

then we add one register or locale, if you had ".registers5" then you need to change it to ".registers6", if it was ".locals1", then you need to change it to ".locals2". I think this is all clear

Now consider the transition variables for the correct application of the constant

Consider a piece of code in order to understand how to add a constant

:try_start_2

iget-object v1, p0, Landroid/net/wifi/WifiManager;->mService:Landroid/net/wifi/IWifiManager;

invoke-interface {v1, p1, p2}, Landroid/net/wifi/IWifiManager;->setCountryCode(Ljava/lang/String;Z)V

:try_end_7

.catch Landroid/os/RemoteException; {:try_start_2 .. :try_end_7} :catch_8

in my case, the variables start with "v1"; you can have it differently, for example, with "v0". That is, the added constant I will have with "v2", that is, you need to add one meaning for the new constant that looks like "const-string v2,"US""

and put the constant "const-string v2,"US"" between the ".line 1729" (this value will most likely be different for you) and ": try_start_2 " (your value may differ)

then replace "p1" in a piece of code

invoke-interface {v1, p1, p2}

to the value "v2" (this is the value of our new constant)

Below you can see how it was and how it became. After all the manipulations, you need to recompile framework.jar

As it was

.method public setCountryCode(Ljava/lang/String;Z)V

.registers 5

.param p1, "country" # Ljava/lang/String;

.param p2, "persist" # Z

.prologue

.line 1729

:try_start_2

iget-object v1, p0, Landroid/net/wifi/WifiManager;->mService:Landroid/net/wifi/IWifiManager;

invoke-interface {v1, p1, p2}, Landroid/net/wifi/IWifiManager;->setCountryCode(Ljava/lang/String;Z)V

:try_end_7

.catch Landroid/os/RemoteException; {:try_start_2 .. :try_end_7} :catch_8

.line 1733

return-void

.line 1730

:catch_8

move-exception v0

.line 1731

.local v0, "e":Landroid/os/RemoteException;

invoke-virtual {v0}, Landroid/os/RemoteException;->rethrowFromSystemServer()Ljava/lang/RuntimeException;

move-result-object v1

throw v1

.end method

As it became

.method public setCountryCode(Ljava/lang/String;Z)V

.registers 6

.param p1, "country" # Ljava/lang/String;

.param p2, "persist" # Z

.prologue

.line 1729

const-string v2, "US"

:try_start_2

iget-object v1, p0, Landroid/net/wifi/WifiManager;->mService:Landroid/net/wifi/IWifiManager;

invoke-interface {v1, v2, p2}, Landroid/net/wifi/IWifiManager;->setCountryCode(Ljava/lang/String;Z)V

:try_end_7

.catch Landroid/os/RemoteException; {:try_start_2 .. :try_end_7} :catch_8

.line 1733

return-void

.line 1730

:catch_8

move-exception v0

.line 1731

.local v0, "e":Landroid/os/RemoteException;

invoke-virtual {v0}, Landroid/os/RemoteException;->rethrowFromSystemServer()Ljava/lang/RuntimeException;

move-result-object v1

throw v1

.end method

you may need to replace "p1" with "v1" or "v0" (which is starting in variables) in the following blocks "move-exception p1", "invoke-virtual {p1}", "move-result-object p1", "throw p1".

I hope this instruction will help