From 3cc9ba48ef635f2e0a3e08f9ab57229adaaa55a9 Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Wed, 4 May 2016 16:38:06 +0100 Subject: [PATCH] Start VPN as early as possible during startup - Switch from USER_STARTING to USER_STARTED which is the foreground version of the broadcast - Set the new VPN network as CONNECTING initially to avoid spamming apps with useless notifications ahead of the network being fully available Bug: 26694104 Fix: 28335277 Change-Id: I31d5260dda62ff440c31c44eb0aa5c891e2717e5 --- .../core/java/com/android/server/ConnectivityService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 5530143370..ea573194db 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -729,7 +729,7 @@ public class ConnectivityService extends IConnectivityManager.Stub //set up the listener for user state for creating user VPNs IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(Intent.ACTION_USER_STARTING); + intentFilter.addAction(Intent.ACTION_USER_STARTED); intentFilter.addAction(Intent.ACTION_USER_STOPPED); intentFilter.addAction(Intent.ACTION_USER_ADDED); intentFilter.addAction(Intent.ACTION_USER_REMOVED); @@ -3663,7 +3663,7 @@ public class ConnectivityService extends IConnectivityManager.Stub final int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL); if (userId == UserHandle.USER_NULL) return; - if (Intent.ACTION_USER_STARTING.equals(action)) { + if (Intent.ACTION_USER_STARTED.equals(action)) { onUserStart(userId); } else if (Intent.ACTION_USER_STOPPED.equals(action)) { onUserStop(userId);