VpnService

Class of android.net · VpnService.java · Android's reference

public class VpnService extends android.app.Service

VpnService ← Service ← ContextWrapper ← Context

A VPN app's service (Off in docs/android/INTERFACES.md: the device makes no TUN interface). prepare gives no consent screen to show, as for an app the user already allowed, and a Builder's establish fails as Android's does when the interface can't be made: null. Sockets need no protecting, as no VPN routes them.

Nested types

Fields

public static final String SERVICE_INTERFACE = "android.net.VpnService" source
public static final String SERVICE_META_DATA_SUPPORTS_ALWAYS_ON = "android.net.VpnService.SUPPORTS_ALWAYS_ON" source

Constructors

public VpnService() empty body source

Methods

public static Intent prepare(Context context) source
public boolean protect(int socket) source
public boolean protect(java.net.Socket socket) source
public boolean protect(java.net.DatagramSocket socket) source
public boolean addAddress(InetAddress address, int prefixLength) source
public boolean removeAddress(InetAddress address, int prefixLength) source
public boolean setUnderlyingNetworks(Network[] networks) source
public final boolean isAlwaysOn() source
public final boolean isLockdownEnabled() source
public IBinder onBind(Intent intent) source
public void onRevoke() source

Made from ScarletNX's Sail at 166ad3910f80. The framework is ScarletNX's (GPL-3.0-or-later); the parts that follow the Android Open Source Project's sources (Apache-2.0) say so in their files.