Loading services/java/com/android/server/connectivity/Vpn.java +17 −2 Original line number Diff line number Diff line Loading @@ -95,7 +95,8 @@ public class Vpn extends BaseNetworkStateTracker { private Connection mConnection; private LegacyVpnRunner mLegacyVpnRunner; private PendingIntent mStatusIntent; private boolean mEnableNotif = true; private volatile boolean mEnableNotif = true; private volatile boolean mEnableTeardown = true; private final IConnectivityManager mConnService; public Vpn(Context context, VpnCallback callback, INetworkManagementService netService, Loading @@ -113,10 +114,23 @@ public class Vpn extends BaseNetworkStateTracker { } } /** * Set if this object is responsible for showing its own notifications. When * {@code false}, notifications are handled externally by someone else. */ public void setEnableNotifications(boolean enableNotif) { mEnableNotif = enableNotif; } /** * Set if this object is responsible for watching for {@link NetworkInfo} * teardown. When {@code false}, teardown is handled externally by someone * else. */ public void setEnableTeardown(boolean enableTeardown) { mEnableTeardown = enableTeardown; } @Override protected void startMonitoringInternal() { // Ignored; events are sent through callbacks for now Loading Loading @@ -647,6 +661,8 @@ public class Vpn extends BaseNetworkStateTracker { private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (!mEnableTeardown) return; if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) { if (intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, ConnectivityManager.TYPE_NONE) == mOuterConnection.get()) { Loading Loading @@ -688,7 +704,6 @@ public class Vpn extends BaseNetworkStateTracker { IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mContext.registerReceiver(mBroadcastReceiver, filter); } public void check(String interfaze) { Loading services/java/com/android/server/net/LockdownVpnTracker.java +6 −1 Original line number Diff line number Diff line Loading @@ -128,7 +128,10 @@ public class LockdownVpnTracker { mAcceptedEgressIface = null; mVpn.stopLegacyVpn(); } if (egressDisconnected) return; if (egressDisconnected) { hideNotification(); return; } final int egressType = egressInfo.getType(); if (vpnInfo.getDetailedState() == DetailedState.FAILED) { Loading Loading @@ -192,6 +195,7 @@ public class LockdownVpnTracker { Slog.d(TAG, "initLocked()"); mVpn.setEnableNotifications(false); mVpn.setEnableTeardown(false); final IntentFilter resetFilter = new IntentFilter(ACTION_LOCKDOWN_RESET); mContext.registerReceiver(mResetReceiver, resetFilter, CONNECTIVITY_INTERNAL, null); Loading Loading @@ -235,6 +239,7 @@ public class LockdownVpnTracker { mContext.unregisterReceiver(mResetReceiver); mVpn.setEnableNotifications(true); mVpn.setEnableTeardown(true); } public void reset() { Loading Loading
services/java/com/android/server/connectivity/Vpn.java +17 −2 Original line number Diff line number Diff line Loading @@ -95,7 +95,8 @@ public class Vpn extends BaseNetworkStateTracker { private Connection mConnection; private LegacyVpnRunner mLegacyVpnRunner; private PendingIntent mStatusIntent; private boolean mEnableNotif = true; private volatile boolean mEnableNotif = true; private volatile boolean mEnableTeardown = true; private final IConnectivityManager mConnService; public Vpn(Context context, VpnCallback callback, INetworkManagementService netService, Loading @@ -113,10 +114,23 @@ public class Vpn extends BaseNetworkStateTracker { } } /** * Set if this object is responsible for showing its own notifications. When * {@code false}, notifications are handled externally by someone else. */ public void setEnableNotifications(boolean enableNotif) { mEnableNotif = enableNotif; } /** * Set if this object is responsible for watching for {@link NetworkInfo} * teardown. When {@code false}, teardown is handled externally by someone * else. */ public void setEnableTeardown(boolean enableTeardown) { mEnableTeardown = enableTeardown; } @Override protected void startMonitoringInternal() { // Ignored; events are sent through callbacks for now Loading Loading @@ -647,6 +661,8 @@ public class Vpn extends BaseNetworkStateTracker { private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (!mEnableTeardown) return; if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) { if (intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, ConnectivityManager.TYPE_NONE) == mOuterConnection.get()) { Loading Loading @@ -688,7 +704,6 @@ public class Vpn extends BaseNetworkStateTracker { IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mContext.registerReceiver(mBroadcastReceiver, filter); } public void check(String interfaze) { Loading
services/java/com/android/server/net/LockdownVpnTracker.java +6 −1 Original line number Diff line number Diff line Loading @@ -128,7 +128,10 @@ public class LockdownVpnTracker { mAcceptedEgressIface = null; mVpn.stopLegacyVpn(); } if (egressDisconnected) return; if (egressDisconnected) { hideNotification(); return; } final int egressType = egressInfo.getType(); if (vpnInfo.getDetailedState() == DetailedState.FAILED) { Loading Loading @@ -192,6 +195,7 @@ public class LockdownVpnTracker { Slog.d(TAG, "initLocked()"); mVpn.setEnableNotifications(false); mVpn.setEnableTeardown(false); final IntentFilter resetFilter = new IntentFilter(ACTION_LOCKDOWN_RESET); mContext.registerReceiver(mResetReceiver, resetFilter, CONNECTIVITY_INTERNAL, null); Loading Loading @@ -235,6 +239,7 @@ public class LockdownVpnTracker { mContext.unregisterReceiver(mResetReceiver); mVpn.setEnableNotifications(true); mVpn.setEnableTeardown(true); } public void reset() { Loading