Merge "Hide VPNs from users that are hidden" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
f2c66a8a83
@@ -61,6 +61,7 @@ import com.android.internal.net.LegacyVpnInfo;
|
|||||||
import com.android.internal.net.VpnConfig;
|
import com.android.internal.net.VpnConfig;
|
||||||
import com.android.internal.net.VpnProfile;
|
import com.android.internal.net.VpnProfile;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
import com.android.settings.dashboard.RestrictedDashboardFragment;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.widget.GearPreference;
|
import com.android.settings.widget.GearPreference;
|
||||||
@@ -592,6 +593,9 @@ public class VpnSettings extends RestrictedDashboardFragment implements
|
|||||||
// Mark connected third-party services
|
// Mark connected third-party services
|
||||||
Set<AppVpnInfo> connections = new ArraySet<>();
|
Set<AppVpnInfo> connections = new ArraySet<>();
|
||||||
for (UserHandle profile : mUserManager.getUserProfiles()) {
|
for (UserHandle profile : mUserManager.getUserProfiles()) {
|
||||||
|
if (Utils.shouldHideUser(profile, mUserManager)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
VpnConfig config = mVpnManager.getVpnConfig(profile.getIdentifier());
|
VpnConfig config = mVpnManager.getVpnConfig(profile.getIdentifier());
|
||||||
if (config != null && !config.legacy) {
|
if (config != null && !config.legacy) {
|
||||||
connections.add(new AppVpnInfo(profile.getIdentifier(), config.user));
|
connections.add(new AppVpnInfo(profile.getIdentifier(), config.user));
|
||||||
@@ -604,6 +608,9 @@ public class VpnSettings extends RestrictedDashboardFragment implements
|
|||||||
private Set<AppVpnInfo> getAlwaysOnAppVpnInfos() {
|
private Set<AppVpnInfo> getAlwaysOnAppVpnInfos() {
|
||||||
Set<AppVpnInfo> result = new ArraySet<>();
|
Set<AppVpnInfo> result = new ArraySet<>();
|
||||||
for (UserHandle profile : mUserManager.getUserProfiles()) {
|
for (UserHandle profile : mUserManager.getUserProfiles()) {
|
||||||
|
if (Utils.shouldHideUser(profile, mUserManager)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
final int profileId = profile.getIdentifier();
|
final int profileId = profile.getIdentifier();
|
||||||
final String packageName = mVpnManager.getAlwaysOnVpnPackageForUser(profileId);
|
final String packageName = mVpnManager.getAlwaysOnVpnPackageForUser(profileId);
|
||||||
if (packageName != null) {
|
if (packageName != null) {
|
||||||
@@ -627,7 +634,11 @@ public class VpnSettings extends RestrictedDashboardFragment implements
|
|||||||
final Set<Integer> profileIds;
|
final Set<Integer> profileIds;
|
||||||
if (includeProfiles) {
|
if (includeProfiles) {
|
||||||
profileIds = new ArraySet<>();
|
profileIds = new ArraySet<>();
|
||||||
for (UserHandle profile : UserManager.get(context).getUserProfiles()) {
|
UserManager userManager = UserManager.get(context);
|
||||||
|
for (UserHandle profile : userManager.getUserProfiles()) {
|
||||||
|
if (Utils.shouldHideUser(profile, userManager)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
profileIds.add(profile.getIdentifier());
|
profileIds.add(profile.getIdentifier());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user