Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +3 −0 Original line number Diff line number Diff line Loading @@ -2931,6 +2931,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (mZenModeController != null) { mZenModeController.setUserId(mCurrentUserId); } if (mSecurityController != null) { mSecurityController.onUserSwitched(mCurrentUserId); } } private void resetUserSetupObserver() { Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java +13 −6 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public class SecurityControllerImpl implements SecurityController { private SparseArray<VpnConfig> mCurrentVpns = new SparseArray<>(); private int mCurrentUserId; private int mVpnUserId; public SecurityControllerImpl(Context context) { mContext = context; Loading @@ -78,7 +79,7 @@ public class SecurityControllerImpl implements SecurityController { // TODO: re-register network callback on user change. mConnectivityManager.registerNetworkCallback(REQUEST, mNetworkCallback); mCurrentUserId = ActivityManager.getCurrentUser(); onUserSwitched(ActivityManager.getCurrentUser()); } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { Loading Loading @@ -123,9 +124,9 @@ public class SecurityControllerImpl implements SecurityController { @Override public String getPrimaryVpnName() { VpnConfig cfg = mCurrentVpns.get(mCurrentUserId); VpnConfig cfg = mCurrentVpns.get(mVpnUserId); if (cfg != null) { return getNameForVpnConfig(cfg, new UserHandle(mCurrentUserId)); return getNameForVpnConfig(cfg, new UserHandle(mVpnUserId)); } else { return null; } Loading @@ -133,8 +134,8 @@ public class SecurityControllerImpl implements SecurityController { @Override public String getProfileVpnName() { for (UserInfo profile : mUserManager.getProfiles(mCurrentUserId)) { if (profile.id == mCurrentUserId) { for (UserInfo profile : mUserManager.getProfiles(mVpnUserId)) { if (profile.id == mVpnUserId) { continue; } VpnConfig cfg = mCurrentVpns.get(profile.id); Loading @@ -147,7 +148,7 @@ public class SecurityControllerImpl implements SecurityController { @Override public boolean isVpnEnabled() { for (UserInfo profile : mUserManager.getProfiles(mCurrentUserId)) { for (UserInfo profile : mUserManager.getProfiles(mVpnUserId)) { if (mCurrentVpns.get(profile.id) != null) { return true; } Loading @@ -172,6 +173,12 @@ public class SecurityControllerImpl implements SecurityController { @Override public void onUserSwitched(int newUserId) { mCurrentUserId = newUserId; if (mUserManager.getUserInfo(newUserId).isRestricted()) { // VPN for a restricted profile is routed through its owner user mVpnUserId = UserHandle.USER_OWNER; } else { mVpnUserId = mCurrentUserId; } fireCallbacks(); } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +3 −0 Original line number Diff line number Diff line Loading @@ -2931,6 +2931,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, if (mZenModeController != null) { mZenModeController.setUserId(mCurrentUserId); } if (mSecurityController != null) { mSecurityController.onUserSwitched(mCurrentUserId); } } private void resetUserSetupObserver() { Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java +13 −6 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public class SecurityControllerImpl implements SecurityController { private SparseArray<VpnConfig> mCurrentVpns = new SparseArray<>(); private int mCurrentUserId; private int mVpnUserId; public SecurityControllerImpl(Context context) { mContext = context; Loading @@ -78,7 +79,7 @@ public class SecurityControllerImpl implements SecurityController { // TODO: re-register network callback on user change. mConnectivityManager.registerNetworkCallback(REQUEST, mNetworkCallback); mCurrentUserId = ActivityManager.getCurrentUser(); onUserSwitched(ActivityManager.getCurrentUser()); } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { Loading Loading @@ -123,9 +124,9 @@ public class SecurityControllerImpl implements SecurityController { @Override public String getPrimaryVpnName() { VpnConfig cfg = mCurrentVpns.get(mCurrentUserId); VpnConfig cfg = mCurrentVpns.get(mVpnUserId); if (cfg != null) { return getNameForVpnConfig(cfg, new UserHandle(mCurrentUserId)); return getNameForVpnConfig(cfg, new UserHandle(mVpnUserId)); } else { return null; } Loading @@ -133,8 +134,8 @@ public class SecurityControllerImpl implements SecurityController { @Override public String getProfileVpnName() { for (UserInfo profile : mUserManager.getProfiles(mCurrentUserId)) { if (profile.id == mCurrentUserId) { for (UserInfo profile : mUserManager.getProfiles(mVpnUserId)) { if (profile.id == mVpnUserId) { continue; } VpnConfig cfg = mCurrentVpns.get(profile.id); Loading @@ -147,7 +148,7 @@ public class SecurityControllerImpl implements SecurityController { @Override public boolean isVpnEnabled() { for (UserInfo profile : mUserManager.getProfiles(mCurrentUserId)) { for (UserInfo profile : mUserManager.getProfiles(mVpnUserId)) { if (mCurrentVpns.get(profile.id) != null) { return true; } Loading @@ -172,6 +173,12 @@ public class SecurityControllerImpl implements SecurityController { @Override public void onUserSwitched(int newUserId) { mCurrentUserId = newUserId; if (mUserManager.getUserInfo(newUserId).isRestricted()) { // VPN for a restricted profile is routed through its owner user mVpnUserId = UserHandle.USER_OWNER; } else { mVpnUserId = mCurrentUserId; } fireCallbacks(); } Loading