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

Commit 5a684c63 authored by lucaslin's avatar lucaslin
Browse files

Skip sending VpnManager events for Settings VPNs

This change early-exits from the sendEventToVpnManagerApp()
method if the profile was not a VPN app.

Otherwise the sendEventToVpnManagerApp() will call
getRedactedNetworkCapabilities() which will call
AppOpsManager#checkPackage() eventually.
And AppOpsManager#checkPackage() will check if the given package
is the same as the given uid. In this case, VPN sends
"[Legacy VPN]" as the package and sends 1000 as the uid, but
there is no package named "[Legacy VPN], so the SecurityException
is thrown.

Bug: 236315805
Test: atest FrameworksNetTests:VpnTest
Change-Id: I228f62a5e09017dbf985a614f2e42434238a220c
parent 9795cfad
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3337,7 +3337,7 @@ public class Vpn {

                // TODO(b/230548427): Remove SDK check once VPN related stuff are
                //  decoupled from ConnectivityServiceTest.
                if (SdkLevel.isAtLeastT() && category != null) {
                if (SdkLevel.isAtLeastT() && category != null && isVpnApp(mPackage)) {
                    sendEventToVpnManagerApp(category, errorClass, errorCode,
                            getPackage(), mSessionKey, makeVpnProfileStateLocked(),
                            mActiveNetwork,