Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3f5bf1f0 authored by lucaslin's avatar lucaslin Committed by Lucas Lin
Browse files

Send VPN manager event when VPN is deactivated

Bug: 191413541
Test: atest FrameworksNetTests:VpnTest
Change-Id: I35fc360204f0227a969ff2b12a4c47f701a55a9c
parent 48ed3547
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1110,6 +1110,17 @@ public class Vpn {
                if (!VpnConfig.LEGACY_VPN.equals(mPackage)) {
                    mAppOpsManager.finishOp(
                            AppOpsManager.OPSTR_ESTABLISH_VPN_MANAGER, mOwnerUID, mPackage, null);
                    // The underlying network, NetworkCapabilities and LinkProperties are not
                    // necessary to send to VPN app since the purpose of this event is to notify
                    // VPN app that VPN is deactivated by the user.
                    // TODO(b/230548427): Remove SDK check once VPN related stuff are decoupled from
                    //  ConnectivityServiceTest.
                    if (SdkLevel.isAtLeastT()) {
                        sendEventToVpnManagerApp(VpnManager.CATEGORY_EVENT_DEACTIVATED_BY_USER,
                                -1 /* errorClass */, -1 /* errorCode*/, mPackage,
                                getSessionKeyLocked(), makeVpnProfileStateLocked(),
                                null /* underlyingNetwork */, null /* nc */, null /* lp */);
                    }
                }
                // cleanupVpnStateLocked() is called from mVpnRunner.exit()
                mVpnRunner.exit();