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

Commit 14777d78 authored by Paul Hu's avatar Paul Hu Committed by Markus S
Browse files

Add check to prevent resetting VPN always-on setting in safe mode

This change prevents the VPN always-on setting from being reset
in safe mode, where third-party VPNs may have limited
functionality in safe mode and can be deemed unsupported for
always-on use.

Bug: 397215751
Bug: 303408193
Test: manual, VpnTest
(cherry picked from https://android-review.googlesource.com/q/commit:cabbb7da639520633ad318655d1b5fe1c685c78e)
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:4c59110136e61b2d2e2251355bd70eefeb0d874f
Merged-In: I03399c7c258ce5db67e81b4e51f25f2cb37700c9
Change-Id: I03399c7c258ce5db67e81b4e51f25f2cb37700c9
parent 17df8b75
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -605,7 +605,11 @@ public class Vpn {
            }
            // Remove always-on VPN if it's not supported.
            if (!isAlwaysOnPackageSupported(alwaysOnPackage)) {
                // Do not remove the always-on setting due to the restricted ability in safe mode.
                // The always-on VPN can then start after the device reboots to normal mode.
                if (!mContext.getPackageManager().isSafeMode()) {
                    setAlwaysOnPackage(null, false);
                }
                return false;
            }
            // Skip if the service is already established. This isn't bulletproof: it's not bound