Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1e06807 authored by Sreeram Ramachandran's avatar Sreeram Ramachandran
Browse files

Hide mutable VpnService APIs to add/remove IP addresses dynamically.

These APIs were added because we thought we needed them to provide
seamless transition from one server backend to another using local IP
addresses to distinguish between the backends. I.e., connections whose
local IP address was old would be routed to the old backend; connections
whose local IP address was new would be routed to the new backend.

It turns out that's not needed. VpnService already supports seamless
re-establishment, so VPNs just need to call establish() again with a
different IP address. I've verified with a custom VPN app that this
works, and can distinguish traffic based on the old and new addresses.

Nobody is using these APIs at the moment, so we could even consider
removing them altogether, but I prefer just hiding them, just in case.

Bug: 15409819
Change-Id: I30949926a0f859c9d839981ccbc5d8e1e535a3a5
parent d6adcef9
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -17537,14 +17537,12 @@ package android.net {
  public class VpnService extends android.app.Service {
    ctor public VpnService();
    method public boolean addAddress(java.net.InetAddress, int);
    method public android.os.IBinder onBind(android.content.Intent);
    method public void onRevoke();
    method public static android.content.Intent prepare(android.content.Context);
    method public boolean protect(int);
    method public boolean protect(java.net.Socket);
    method public boolean protect(java.net.DatagramSocket);
    method public boolean removeAddress(java.net.InetAddress, int);
    field public static final java.lang.String SERVICE_INTERFACE = "android.net.VpnService";
  }
+4 −0
Original line number Diff line number Diff line
@@ -212,6 +212,8 @@ public class VpnService extends Service {
     *
     * @return {@code true} on success.
     * @see Builder#addAddress
     *
     * @hide
     */
    public boolean addAddress(InetAddress address, int prefixLength) {
        check(address, prefixLength);
@@ -240,6 +242,8 @@ public class VpnService extends Service {
     * @param prefixLength The prefix length of the address.
     *
     * @return {@code true} on success.
     *
     * @hide
     */
    public boolean removeAddress(InetAddress address, int prefixLength) {
        check(address, prefixLength);