Merge "Add API for VPN apps to query always-on and lockdown."

am: 479c0769f1

Change-Id: Icb11cdd5c7384eacf1df9b7a0c42e451641f0e04
This commit is contained in:
Pavel Grafov
2019-01-22 07:00:53 -08:00
committed by android-build-merger
6 changed files with 94 additions and 14 deletions

View File

@@ -187,4 +187,6 @@ interface IConnectivityManager
byte[] getNetworkWatchlistConfigHash();
int getConnectionOwnerUid(in ConnectionInfo connectionInfo);
boolean isCallerCurrentAlwaysOnVpnApp();
boolean isCallerCurrentAlwaysOnVpnLockdownApp();
}

View File

@@ -367,6 +367,29 @@ public class VpnService extends Service {
}
}
/**
* Returns whether the service is running in always-on VPN mode.
*/
public final boolean isAlwaysOn() {
try {
return getService().isCallerCurrentAlwaysOnVpnApp();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
* Returns whether the service is running in always-on VPN mode blocking connections without
* VPN.
*/
public final boolean isLockdownEnabled() {
try {
return getService().isCallerCurrentAlwaysOnVpnLockdownApp();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
* Return the communication interface to the service. This method returns
* {@code null} on {@link Intent}s other than {@link #SERVICE_INTERFACE}