Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -25507,6 +25507,7 @@ package android.net { public class VpnManager { method public void deleteProvisionedVpnProfile(); method @Nullable public android.net.VpnProfileState getProvisionedVpnProfileState(); method @Nullable public android.content.Intent provisionVpnProfile(@NonNull android.net.PlatformVpnProfile); method @Deprecated public void startProvisionedVpnProfile(); method @NonNull public String startProvisionedVpnProfileSession(); core/java/android/net/IVpnManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.net; import android.net.Network; import android.net.VpnProfileState; import com.android.internal.net.LegacyVpnInfo; import com.android.internal.net.VpnConfig; Loading @@ -40,6 +41,7 @@ interface IVpnManager { void deleteVpnProfile(String packageName); String startVpnProfile(String packageName); void stopVpnProfile(String packageName); VpnProfileState getProvisionedVpnProfileState(String packageName); /** Always-on VPN APIs */ boolean isAlwaysOnVpnPackageSupported(int userId, String packageName); Loading core/java/android/net/VpnManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -419,6 +419,21 @@ public class VpnManager { } } /** * Retrieve the VpnProfileState for the profile provisioned by the calling package. * * @return the VpnProfileState with current information, or null if there was no profile * provisioned by the calling package. */ @Nullable public VpnProfileState getProvisionedVpnProfileState() { try { return mService.getProvisionedVpnProfileState(mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Resets all VPN settings back to factory defaults. * @hide Loading services/core/java/com/android/server/VpnManagerService.java +19 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.net.NetworkStack; import android.net.UnderlyingNetworkInfo; import android.net.Uri; import android.net.VpnManager; import android.net.VpnProfileState; import android.net.VpnService; import android.net.util.NetdService; import android.os.Binder; Loading Loading @@ -373,6 +374,24 @@ public class VpnManagerService extends IVpnManager.Stub { } } /** * Retrieve the VpnProfileState for the profile provisioned by the given package. * * @return the VpnProfileState with current information, or null if there was no profile * provisioned by the given package. * @hide */ @Override @Nullable public VpnProfileState getProvisionedVpnProfileState(@NonNull String packageName) { final int callingUid = Binder.getCallingUid(); verifyCallingUidAndPackage(packageName, callingUid); final int user = UserHandle.getUserId(callingUid); synchronized (mVpns) { return mVpns.get(user).getProvisionedVpnProfileState(packageName); } } /** * Start legacy VPN, controlling native daemons as needed. Creates a * secondary thread to perform connection work, returning quickly. Loading services/core/java/com/android/server/connectivity/Vpn.java +40 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ import android.net.RouteInfo; import android.net.UidRangeParcel; import android.net.UnderlyingNetworkInfo; import android.net.VpnManager; import android.net.VpnProfileState; import android.net.VpnService; import android.net.VpnTransportInfo; import android.net.ipsec.ike.ChildSessionCallback; Loading Loading @@ -3438,6 +3439,45 @@ public class Vpn { } } private @VpnProfileState.State int getStateFromLegacyState(int legacyState) { switch (legacyState) { case LegacyVpnInfo.STATE_CONNECTING: return VpnProfileState.STATE_CONNECTING; case LegacyVpnInfo.STATE_CONNECTED: return VpnProfileState.STATE_CONNECTED; case LegacyVpnInfo.STATE_DISCONNECTED: return VpnProfileState.STATE_DISCONNECTED; case LegacyVpnInfo.STATE_FAILED: return VpnProfileState.STATE_FAILED; default: Log.wtf(TAG, "Unhandled state " + legacyState + ", treat it as STATE_DISCONNECTED"); return VpnProfileState.STATE_DISCONNECTED; } } private VpnProfileState makeVpnProfileState() { // TODO: mSessionKey will be moved to Ikev2VpnRunner once aosp/2007077 is merged, so after // merging aosp/2007077, here should check Ikev2VpnRunner is null or not. Session key will // be null if Ikev2VpnRunner is null. return new VpnProfileState(getStateFromLegacyState(mLegacyState), mSessionKey, mAlwaysOn, mLockdown); } /** * Retrieve the VpnProfileState for the profile provisioned by the given package. * * @return the VpnProfileState with current information, or null if there was no profile * provisioned by the given package. */ @Nullable public synchronized VpnProfileState getProvisionedVpnProfileState( @NonNull String packageName) { requireNonNull(packageName, "No package name provided"); enforceNotRestrictedUser(); return isCurrentIkev2VpnLocked(packageName) ? makeVpnProfileState() : null; } /** * Proxy to allow testing * Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -25507,6 +25507,7 @@ package android.net { public class VpnManager { method public void deleteProvisionedVpnProfile(); method @Nullable public android.net.VpnProfileState getProvisionedVpnProfileState(); method @Nullable public android.content.Intent provisionVpnProfile(@NonNull android.net.PlatformVpnProfile); method @Deprecated public void startProvisionedVpnProfile(); method @NonNull public String startProvisionedVpnProfileSession();
core/java/android/net/IVpnManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.net; import android.net.Network; import android.net.VpnProfileState; import com.android.internal.net.LegacyVpnInfo; import com.android.internal.net.VpnConfig; Loading @@ -40,6 +41,7 @@ interface IVpnManager { void deleteVpnProfile(String packageName); String startVpnProfile(String packageName); void stopVpnProfile(String packageName); VpnProfileState getProvisionedVpnProfileState(String packageName); /** Always-on VPN APIs */ boolean isAlwaysOnVpnPackageSupported(int userId, String packageName); Loading
core/java/android/net/VpnManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -419,6 +419,21 @@ public class VpnManager { } } /** * Retrieve the VpnProfileState for the profile provisioned by the calling package. * * @return the VpnProfileState with current information, or null if there was no profile * provisioned by the calling package. */ @Nullable public VpnProfileState getProvisionedVpnProfileState() { try { return mService.getProvisionedVpnProfileState(mContext.getOpPackageName()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Resets all VPN settings back to factory defaults. * @hide Loading
services/core/java/com/android/server/VpnManagerService.java +19 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.net.NetworkStack; import android.net.UnderlyingNetworkInfo; import android.net.Uri; import android.net.VpnManager; import android.net.VpnProfileState; import android.net.VpnService; import android.net.util.NetdService; import android.os.Binder; Loading Loading @@ -373,6 +374,24 @@ public class VpnManagerService extends IVpnManager.Stub { } } /** * Retrieve the VpnProfileState for the profile provisioned by the given package. * * @return the VpnProfileState with current information, or null if there was no profile * provisioned by the given package. * @hide */ @Override @Nullable public VpnProfileState getProvisionedVpnProfileState(@NonNull String packageName) { final int callingUid = Binder.getCallingUid(); verifyCallingUidAndPackage(packageName, callingUid); final int user = UserHandle.getUserId(callingUid); synchronized (mVpns) { return mVpns.get(user).getProvisionedVpnProfileState(packageName); } } /** * Start legacy VPN, controlling native daemons as needed. Creates a * secondary thread to perform connection work, returning quickly. Loading
services/core/java/com/android/server/connectivity/Vpn.java +40 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ import android.net.RouteInfo; import android.net.UidRangeParcel; import android.net.UnderlyingNetworkInfo; import android.net.VpnManager; import android.net.VpnProfileState; import android.net.VpnService; import android.net.VpnTransportInfo; import android.net.ipsec.ike.ChildSessionCallback; Loading Loading @@ -3438,6 +3439,45 @@ public class Vpn { } } private @VpnProfileState.State int getStateFromLegacyState(int legacyState) { switch (legacyState) { case LegacyVpnInfo.STATE_CONNECTING: return VpnProfileState.STATE_CONNECTING; case LegacyVpnInfo.STATE_CONNECTED: return VpnProfileState.STATE_CONNECTED; case LegacyVpnInfo.STATE_DISCONNECTED: return VpnProfileState.STATE_DISCONNECTED; case LegacyVpnInfo.STATE_FAILED: return VpnProfileState.STATE_FAILED; default: Log.wtf(TAG, "Unhandled state " + legacyState + ", treat it as STATE_DISCONNECTED"); return VpnProfileState.STATE_DISCONNECTED; } } private VpnProfileState makeVpnProfileState() { // TODO: mSessionKey will be moved to Ikev2VpnRunner once aosp/2007077 is merged, so after // merging aosp/2007077, here should check Ikev2VpnRunner is null or not. Session key will // be null if Ikev2VpnRunner is null. return new VpnProfileState(getStateFromLegacyState(mLegacyState), mSessionKey, mAlwaysOn, mLockdown); } /** * Retrieve the VpnProfileState for the profile provisioned by the given package. * * @return the VpnProfileState with current information, or null if there was no profile * provisioned by the given package. */ @Nullable public synchronized VpnProfileState getProvisionedVpnProfileState( @NonNull String packageName) { requireNonNull(packageName, "No package name provided"); enforceNotRestrictedUser(); return isCurrentIkev2VpnLocked(packageName) ? makeVpnProfileState() : null; } /** * Proxy to allow testing * Loading