-
Install Android Development Kit on your machine (
androidsdkon nixos). -
Root your OnePlus.
-
Plug your phone into your machine.
-
Open
adb shell. -
Mount
/systemas read-write,% mount -o remount,rw /system -
Exit
adb shell -
Create a file called
hostson your machine. -
Add entries of IP address to hostname in that
hostsfile e.g.127.0.0.1 localhost ::1 ip6-localhost -
Add an entry specifically for
open.oneplus.netto give this hostname a new address. For example, set the address ofopen.oneplus.netto the phone itself, so that the network traffic goes nowhere127.0.0.1 open.oneplus.net -
Copy this file to your phone somehow e.g. using
rsyncor however you copy files to your phone. -
Using
adbcopy this file to the correct place on your phone with this command% cp /path/to/hosts /system/etc -
Close everything.
-
Unplug everything.
-
Enjoy freedom.
I set the address of open.oneplus.net to a different location. If you get a terminal to the phone and type cat /system/etc/hosts, you should see output similar to this:
