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 */ prepareVpn(String oldPackage, String newPackage, int userId)32 boolean prepareVpn(String oldPackage, String newPackage, int userId); setVpnPackageAuthorization(String packageName, int userId, int vpnType)33 void setVpnPackageAuthorization(String packageName, int userId, int vpnType); establishVpn(in VpnConfig config)34 ParcelFileDescriptor establishVpn(in VpnConfig config); addVpnAddress(String address, int prefixLength)35 boolean addVpnAddress(String address, int prefixLength); removeVpnAddress(String address, int prefixLength)36 boolean removeVpnAddress(String address, int prefixLength); setUnderlyingNetworksForVpn(in Network[] networks)37 boolean setUnderlyingNetworksForVpn(in Network[] networks); 38 39 /** VpnManager APIs */ provisionVpnProfile(in VpnProfile profile, String packageName)40 boolean provisionVpnProfile(in VpnProfile profile, String packageName); deleteVpnProfile(String packageName)41 void deleteVpnProfile(String packageName); startVpnProfile(String packageName)42 String startVpnProfile(String packageName); stopVpnProfile(String packageName)43 void stopVpnProfile(String packageName); getProvisionedVpnProfileState(String packageName)44 VpnProfileState getProvisionedVpnProfileState(String packageName); setAppExclusionList(int userId, String vpnPackage, in List<String> excludedApps)45 boolean setAppExclusionList(int userId, String vpnPackage, in List<String> excludedApps); getAppExclusionList(int userId, String vpnPackage)46 List<String> getAppExclusionList(int userId, String vpnPackage); 47 48 /** Always-on VPN APIs */ isAlwaysOnVpnPackageSupported(int userId, String packageName)49 boolean isAlwaysOnVpnPackageSupported(int userId, String packageName); setAlwaysOnVpnPackage(int userId, String packageName, boolean lockdown, in List<String> lockdownAllowlist)50 boolean setAlwaysOnVpnPackage(int userId, String packageName, boolean lockdown, 51 in List<String> lockdownAllowlist); getAlwaysOnVpnPackage(int userId)52 String getAlwaysOnVpnPackage(int userId); isVpnLockdownEnabled(int userId)53 boolean isVpnLockdownEnabled(int userId); getVpnLockdownAllowlist(int userId)54 List<String> getVpnLockdownAllowlist(int userId); isCallerCurrentAlwaysOnVpnApp()55 boolean isCallerCurrentAlwaysOnVpnApp(); isCallerCurrentAlwaysOnVpnLockdownApp()56 boolean isCallerCurrentAlwaysOnVpnLockdownApp(); 57 58 /** Legacy VPN APIs */ startLegacyVpn(in VpnProfile profile)59 void startLegacyVpn(in VpnProfile profile); getLegacyVpnInfo(int userId)60 LegacyVpnInfo getLegacyVpnInfo(int userId); updateLockdownVpn()61 boolean updateLockdownVpn(); 62 63 /** General system APIs */ getVpnConfig(int userId)64 VpnConfig getVpnConfig(int userId); factoryReset()65 void factoryReset(); 66 } 67