| 1 |
/** |
| 2 |
* Copyright (c) 2020, The Android Open Source Project |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
package android.net; |
| 18 |
|
| 19 |
import android.net.Network; |
| 20 |
import android.net.VpnProfileState; |
| 21 |
|
| 22 |
import com.android.internal.net.LegacyVpnInfo; |
| 23 |
import com.android.internal.net.VpnConfig; |
| 24 |
import com.android.internal.net.VpnProfile; |
| 25 |
|
| 26 |
/** |
| 27 |
* Interface that manages VPNs. |
| 28 |
*/ |
| 29 |
/** {@hide} */ |
| 30 |
interface IVpnManager { |
| 31 |
/** VpnService APIs */ |
| 32 |
boolean prepareVpn(String oldPackage, String newPackage, int userId); |
| 33 |
void setVpnPackageAuthorization(String packageName, int userId, int vpnType); |
| 34 |
ParcelFileDescriptor establishVpn(in VpnConfig config); |
| 35 |
boolean addVpnAddress(String address, int prefixLength); |
| 36 |
boolean removeVpnAddress(String address, int prefixLength); |
| 37 |
boolean setUnderlyingNetworksForVpn(in Network[] networks); |
| 38 |
|
| 39 |
/** VpnManager APIs */ |
| 40 |
boolean provisionVpnProfile(in VpnProfile profile, String packageName); |
| 41 |
void deleteVpnProfile(String packageName); |
| 42 |
String startVpnProfile(String packageName); |
| 43 |
void stopVpnProfile(String packageName); |
| 44 |
VpnProfileState getProvisionedVpnProfileState(String packageName); |
| 45 |
boolean setAppExclusionList(int userId, String vpnPackage, in List<String> excludedApps); |
| 46 |
List<String> getAppExclusionList(int userId, String vpnPackage); |
| 47 |
|
| 48 |
/** Always-on VPN APIs */ |
| 49 |
boolean isAlwaysOnVpnPackageSupported(int userId, String packageName); |
| 50 |
boolean setAlwaysOnVpnPackage(int userId, String packageName, boolean lockdown, |
| 51 |
in List<String> lockdownAllowlist); |
| 52 |
String getAlwaysOnVpnPackage(int userId); |
| 53 |
boolean isVpnLockdownEnabled(int userId); |
| 54 |
List<String> getVpnLockdownAllowlist(int userId); |
| 55 |
boolean isCallerCurrentAlwaysOnVpnApp(); |
| 56 |
boolean isCallerCurrentAlwaysOnVpnLockdownApp(); |
| 57 |
|
| 58 |
/** Legacy VPN APIs */ |
| 59 |
void startLegacyVpn(in VpnProfile profile); |
| 60 |
LegacyVpnInfo getLegacyVpnInfo(int userId); |
| 61 |
boolean updateLockdownVpn(); |
| 62 |
|
| 63 |
/** General system APIs */ |
| 64 |
VpnConfig getVpnConfig(int userId); |
| 65 |
void factoryReset(); |
| 66 |
} |