Add PreferenceControllers to Network page.
- Also made tiles refresh more efficient: when category changes, only refresh dynamic tiles. Static tiles from xml will not change due to category change. Bug: 31799836 Test: RunSettingsRoboTests Change-Id: I1e4c85f2c122c65ec99729e43a66c80acdd863c8
This commit is contained in:
@@ -25,7 +25,6 @@ import android.content.ActivityNotFoundException;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
@@ -33,7 +32,6 @@ import android.net.Uri;
|
|||||||
import android.nfc.NfcAdapter;
|
import android.nfc.NfcAdapter;
|
||||||
import android.nfc.NfcManager;
|
import android.nfc.NfcManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.SystemProperties;
|
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.SearchIndexableResource;
|
import android.provider.SearchIndexableResource;
|
||||||
@@ -48,7 +46,10 @@ import android.util.Log;
|
|||||||
import com.android.ims.ImsManager;
|
import com.android.ims.ImsManager;
|
||||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||||
import com.android.internal.telephony.TelephonyIntents;
|
import com.android.internal.telephony.TelephonyIntents;
|
||||||
import com.android.internal.telephony.TelephonyProperties;
|
import com.android.settings.network.AirplaneModePreferenceController;
|
||||||
|
import com.android.settings.network.MobileNetworkPreferenceController;
|
||||||
|
import com.android.settings.network.TetherPreferenceController;
|
||||||
|
import com.android.settings.network.VpnPreferenceController;
|
||||||
import com.android.settings.nfc.NfcEnabler;
|
import com.android.settings.nfc.NfcEnabler;
|
||||||
import com.android.settings.search.BaseSearchIndexProvider;
|
import com.android.settings.search.BaseSearchIndexProvider;
|
||||||
import com.android.settings.search.Indexable;
|
import com.android.settings.search.Indexable;
|
||||||
@@ -63,35 +64,30 @@ import java.util.List;
|
|||||||
public class WirelessSettings extends SettingsPreferenceFragment implements Indexable {
|
public class WirelessSettings extends SettingsPreferenceFragment implements Indexable {
|
||||||
private static final String TAG = "WirelessSettings";
|
private static final String TAG = "WirelessSettings";
|
||||||
|
|
||||||
private static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane";
|
|
||||||
private static final String KEY_TOGGLE_NFC = "toggle_nfc";
|
private static final String KEY_TOGGLE_NFC = "toggle_nfc";
|
||||||
private static final String KEY_WIMAX_SETTINGS = "wimax_settings";
|
private static final String KEY_WIMAX_SETTINGS = "wimax_settings";
|
||||||
private static final String KEY_ANDROID_BEAM_SETTINGS = "android_beam_settings";
|
private static final String KEY_ANDROID_BEAM_SETTINGS = "android_beam_settings";
|
||||||
private static final String KEY_VPN_SETTINGS = "vpn_settings";
|
|
||||||
private static final String KEY_TETHER_SETTINGS = "tether_settings";
|
|
||||||
private static final String KEY_PROXY_SETTINGS = "proxy_settings";
|
private static final String KEY_PROXY_SETTINGS = "proxy_settings";
|
||||||
private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings";
|
|
||||||
private static final String KEY_MANAGE_MOBILE_PLAN = "manage_mobile_plan";
|
private static final String KEY_MANAGE_MOBILE_PLAN = "manage_mobile_plan";
|
||||||
private static final String KEY_WFC_SETTINGS = "wifi_calling_settings";
|
private static final String KEY_WFC_SETTINGS = "wifi_calling_settings";
|
||||||
private static final String KEY_NETWORK_RESET = "network_reset";
|
private static final String KEY_NETWORK_RESET = "network_reset";
|
||||||
|
|
||||||
public static final String EXIT_ECM_RESULT = "exit_ecm_result";
|
|
||||||
public static final int REQUEST_CODE_EXIT_ECM = 1;
|
|
||||||
|
|
||||||
private AirplaneModeEnabler mAirplaneModeEnabler;
|
|
||||||
private SwitchPreference mAirplaneModePreference;
|
|
||||||
private NfcEnabler mNfcEnabler;
|
private NfcEnabler mNfcEnabler;
|
||||||
private NfcAdapter mNfcAdapter;
|
private NfcAdapter mNfcAdapter;
|
||||||
|
|
||||||
private ConnectivityManager mCm;
|
private ConnectivityManager mCm;
|
||||||
private TelephonyManager mTm;
|
private TelephonyManager mTm;
|
||||||
private PackageManager mPm;
|
|
||||||
private UserManager mUm;
|
private UserManager mUm;
|
||||||
|
|
||||||
private static final int MANAGE_MOBILE_PLAN_DIALOG_ID = 1;
|
private static final int MANAGE_MOBILE_PLAN_DIALOG_ID = 1;
|
||||||
private static final String SAVED_MANAGE_MOBILE_PLAN_MSG = "mManageMobilePlanMessage";
|
private static final String SAVED_MANAGE_MOBILE_PLAN_MSG = "mManageMobilePlanMessage";
|
||||||
|
|
||||||
private PreferenceScreen mButtonWfc;
|
private PreferenceScreen mButtonWfc;
|
||||||
|
private AirplaneModePreferenceController mAirplaneModePreferenceController;
|
||||||
|
private TetherPreferenceController mTetherPreferenceController;
|
||||||
|
private MobileNetworkPreferenceController mMobileNetworkPreferenceController;
|
||||||
|
private VpnPreferenceController mVpnPreferenceController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked on each preference click in this hierarchy, overrides
|
* Invoked on each preference click in this hierarchy, overrides
|
||||||
@@ -101,14 +97,10 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceTreeClick(Preference preference) {
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
log("onPreferenceTreeClick: preference=" + preference);
|
log("onPreferenceTreeClick: preference=" + preference);
|
||||||
if (preference == mAirplaneModePreference && Boolean.parseBoolean(
|
if (mAirplaneModePreferenceController.handlePreferenceTreeClick(preference)) {
|
||||||
SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) {
|
|
||||||
// In ECM mode launch ECM app dialog
|
|
||||||
startActivityForResult(
|
|
||||||
new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS, null),
|
|
||||||
REQUEST_CODE_EXIT_ECM);
|
|
||||||
return true;
|
return true;
|
||||||
} else if (preference == findPreference(KEY_MANAGE_MOBILE_PLAN)) {
|
}
|
||||||
|
if (preference == findPreference(KEY_MANAGE_MOBILE_PLAN)) {
|
||||||
onManageMobilePlanClick();
|
onManageMobilePlanClick();
|
||||||
}
|
}
|
||||||
// Let the intents be launched by the Preference manager
|
// Let the intents be launched by the Preference manager
|
||||||
@@ -222,6 +214,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
if (savedInstanceState != null) {
|
if (savedInstanceState != null) {
|
||||||
mManageMobilePlanMessage = savedInstanceState.getString(SAVED_MANAGE_MOBILE_PLAN_MSG);
|
mManageMobilePlanMessage = savedInstanceState.getString(SAVED_MANAGE_MOBILE_PLAN_MSG);
|
||||||
}
|
}
|
||||||
@@ -229,7 +222,6 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
|
|
||||||
mCm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
mCm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
mTm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
mTm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
mPm = getPackageManager();
|
|
||||||
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
|
mUm = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||||
|
|
||||||
addPreferencesFromResource(R.xml.wireless_settings);
|
addPreferencesFromResource(R.xml.wireless_settings);
|
||||||
@@ -237,13 +229,22 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
final boolean isAdmin = mUm.isAdminUser();
|
final boolean isAdmin = mUm.isAdminUser();
|
||||||
|
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
mAirplaneModePreference = (SwitchPreference) findPreference(KEY_TOGGLE_AIRPLANE);
|
|
||||||
|
final PreferenceScreen screen = getPreferenceScreen();
|
||||||
|
mAirplaneModePreferenceController = new AirplaneModePreferenceController(activity, this);
|
||||||
|
mTetherPreferenceController = new TetherPreferenceController(activity);
|
||||||
|
mMobileNetworkPreferenceController = new MobileNetworkPreferenceController(activity);
|
||||||
|
mVpnPreferenceController = new VpnPreferenceController(activity);
|
||||||
|
|
||||||
|
mAirplaneModePreferenceController.displayPreference(screen);
|
||||||
|
mTetherPreferenceController.displayPreference(screen);
|
||||||
|
mMobileNetworkPreferenceController.displayPreference(screen);
|
||||||
|
mVpnPreferenceController.displayPreference(screen);
|
||||||
|
|
||||||
SwitchPreference nfc = (SwitchPreference) findPreference(KEY_TOGGLE_NFC);
|
SwitchPreference nfc = (SwitchPreference) findPreference(KEY_TOGGLE_NFC);
|
||||||
RestrictedPreference androidBeam = (RestrictedPreference) findPreference(
|
RestrictedPreference androidBeam = (RestrictedPreference) findPreference(
|
||||||
KEY_ANDROID_BEAM_SETTINGS);
|
KEY_ANDROID_BEAM_SETTINGS);
|
||||||
|
|
||||||
mAirplaneModeEnabler = new AirplaneModeEnabler(activity, mAirplaneModePreference,
|
|
||||||
mMetricsFeatureProvider);
|
|
||||||
mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam);
|
mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam);
|
||||||
|
|
||||||
mButtonWfc = (PreferenceScreen) findPreference(KEY_WFC_SETTINGS);
|
mButtonWfc = (PreferenceScreen) findPreference(KEY_WFC_SETTINGS);
|
||||||
@@ -263,30 +264,16 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIMAX )
|
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIMAX )
|
||||||
&& isWimaxEnabled) {
|
&& isWimaxEnabled) {
|
||||||
Preference ps = findPreference(KEY_WIMAX_SETTINGS);
|
Preference ps = findPreference(KEY_WIMAX_SETTINGS);
|
||||||
ps.setDependency(KEY_TOGGLE_AIRPLANE);
|
ps.setDependency(AirplaneModePreferenceController.KEY_TOGGLE_AIRPLANE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually set dependencies for Wifi when not toggleable.
|
|
||||||
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIFI)) {
|
|
||||||
findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
|
|
||||||
}
|
|
||||||
// Disable VPN.
|
|
||||||
// TODO: http://b/23693383
|
|
||||||
if (!isAdmin || RestrictedLockUtils.hasBaseUserRestriction(activity,
|
|
||||||
UserManager.DISALLOW_CONFIG_VPN, UserHandle.myUserId())) {
|
|
||||||
removePreference(KEY_VPN_SETTINGS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Manually set dependencies for Bluetooth when not toggleable.
|
|
||||||
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_BLUETOOTH)) {
|
|
||||||
// No bluetooth-dependent items in the list. Code kept in case one is added later.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Manually set dependencies for NFC when not toggleable.
|
// Manually set dependencies for NFC when not toggleable.
|
||||||
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_NFC)) {
|
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_NFC)) {
|
||||||
findPreference(KEY_TOGGLE_NFC).setDependency(KEY_TOGGLE_AIRPLANE);
|
findPreference(KEY_TOGGLE_NFC).setDependency(
|
||||||
findPreference(KEY_ANDROID_BEAM_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
|
AirplaneModePreferenceController.KEY_TOGGLE_AIRPLANE);
|
||||||
|
findPreference(KEY_ANDROID_BEAM_SETTINGS).setDependency(
|
||||||
|
AirplaneModePreferenceController.KEY_TOGGLE_AIRPLANE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove NFC if not available
|
// Remove NFC if not available
|
||||||
@@ -302,7 +289,6 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
if (!isAdmin || Utils.isWifiOnly(getActivity()) ||
|
if (!isAdmin || Utils.isWifiOnly(getActivity()) ||
|
||||||
RestrictedLockUtils.hasBaseUserRestriction(activity,
|
RestrictedLockUtils.hasBaseUserRestriction(activity,
|
||||||
UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS, UserHandle.myUserId())) {
|
UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS, UserHandle.myUserId())) {
|
||||||
removePreference(KEY_MOBILE_NETWORK_SETTINGS);
|
|
||||||
removePreference(KEY_MANAGE_MOBILE_PLAN);
|
removePreference(KEY_MANAGE_MOBILE_PLAN);
|
||||||
}
|
}
|
||||||
// Remove Mobile Network Settings and Manage Mobile Plan
|
// Remove Mobile Network Settings and Manage Mobile Plan
|
||||||
@@ -316,11 +302,6 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove Airplane Mode settings if it's a stationary device such as a TV.
|
|
||||||
if (mPm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
|
|
||||||
removePreference(KEY_TOGGLE_AIRPLANE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable Proxy selector settings if allowed.
|
// Enable Proxy selector settings if allowed.
|
||||||
Preference mGlobalProxy = findPreference(KEY_PROXY_SETTINGS);
|
Preference mGlobalProxy = findPreference(KEY_PROXY_SETTINGS);
|
||||||
final DevicePolicyManager mDPM = (DevicePolicyManager)
|
final DevicePolicyManager mDPM = (DevicePolicyManager)
|
||||||
@@ -329,25 +310,6 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
getPreferenceScreen().removePreference(mGlobalProxy);
|
getPreferenceScreen().removePreference(mGlobalProxy);
|
||||||
mGlobalProxy.setEnabled(mDPM.getGlobalProxyAdmin() == null);
|
mGlobalProxy.setEnabled(mDPM.getGlobalProxyAdmin() == null);
|
||||||
|
|
||||||
// Disable Tethering if it's not allowed or if it's a wifi-only device
|
|
||||||
final ConnectivityManager cm =
|
|
||||||
(ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
|
|
||||||
final boolean adminDisallowedTetherConfig = RestrictedLockUtils.checkIfRestrictionEnforced(
|
|
||||||
activity, UserManager.DISALLOW_CONFIG_TETHERING, UserHandle.myUserId()) != null;
|
|
||||||
if ((!cm.isTetheringSupported() && !adminDisallowedTetherConfig) ||
|
|
||||||
RestrictedLockUtils.hasBaseUserRestriction(activity,
|
|
||||||
UserManager.DISALLOW_CONFIG_TETHERING, UserHandle.myUserId())) {
|
|
||||||
getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS));
|
|
||||||
} else if (!adminDisallowedTetherConfig) {
|
|
||||||
Preference p = findPreference(KEY_TETHER_SETTINGS);
|
|
||||||
p.setTitle(com.android.settingslib.Utils.getTetheringLabel(cm));
|
|
||||||
|
|
||||||
// Grey out if provisioning is not available.
|
|
||||||
p.setEnabled(!TetherSettings
|
|
||||||
.isProvisioningNeededButUnavailable(getActivity()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove network reset if not allowed
|
// Remove network reset if not allowed
|
||||||
if (RestrictedLockUtils.hasBaseUserRestriction(activity,
|
if (RestrictedLockUtils.hasBaseUserRestriction(activity,
|
||||||
UserManager.DISALLOW_NETWORK_RESET, UserHandle.myUserId())) {
|
UserManager.DISALLOW_NETWORK_RESET, UserHandle.myUserId())) {
|
||||||
@@ -359,7 +321,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
mAirplaneModeEnabler.resume();
|
mAirplaneModePreferenceController.onResume();
|
||||||
if (mNfcEnabler != null) {
|
if (mNfcEnabler != null) {
|
||||||
mNfcEnabler.resume();
|
mNfcEnabler.resume();
|
||||||
}
|
}
|
||||||
@@ -389,8 +351,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
mAirplaneModePreferenceController.onPause();
|
||||||
mAirplaneModeEnabler.pause();
|
|
||||||
if (mNfcEnabler != null) {
|
if (mNfcEnabler != null) {
|
||||||
mNfcEnabler.pause();
|
mNfcEnabler.pause();
|
||||||
}
|
}
|
||||||
@@ -398,12 +359,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (requestCode == REQUEST_CODE_EXIT_ECM) {
|
mAirplaneModePreferenceController.onActivityResult(requestCode, resultCode, data);
|
||||||
Boolean isChoiceYes = data.getBooleanExtra(EXIT_ECM_RESULT, false);
|
|
||||||
// Set Airplane mode based on the return value and checkbox state
|
|
||||||
mAirplaneModeEnabler.setAirplaneModeInECM(isChoiceYes,
|
|
||||||
mAirplaneModePreference.isChecked());
|
|
||||||
}
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,9 +398,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
result.add(KEY_WIMAX_SETTINGS);
|
result.add(KEY_WIMAX_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSecondaryUser) { // Disable VPN
|
new VpnPreferenceController(context).updateNonIndexableKeys(result);
|
||||||
result.add(KEY_VPN_SETTINGS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove NFC if not available
|
// Remove NFC if not available
|
||||||
final NfcManager manager = (NfcManager)
|
final NfcManager manager = (NfcManager)
|
||||||
@@ -459,9 +413,9 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
|
|
||||||
// Remove Mobile Network Settings and Manage Mobile Plan if it's a wifi-only device.
|
// Remove Mobile Network Settings and Manage Mobile Plan if it's a wifi-only device.
|
||||||
if (isSecondaryUser || Utils.isWifiOnly(context)) {
|
if (isSecondaryUser || Utils.isWifiOnly(context)) {
|
||||||
result.add(KEY_MOBILE_NETWORK_SETTINGS);
|
|
||||||
result.add(KEY_MANAGE_MOBILE_PLAN);
|
result.add(KEY_MANAGE_MOBILE_PLAN);
|
||||||
}
|
}
|
||||||
|
new MobileNetworkPreferenceController(context).updateNonIndexableKeys(result);
|
||||||
|
|
||||||
// Remove Mobile Network Settings and Manage Mobile Plan
|
// Remove Mobile Network Settings and Manage Mobile Plan
|
||||||
// if config_show_mobile_plan sets false.
|
// if config_show_mobile_plan sets false.
|
||||||
@@ -470,23 +424,15 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
|
|||||||
if (!isMobilePlanEnabled) {
|
if (!isMobilePlanEnabled) {
|
||||||
result.add(KEY_MANAGE_MOBILE_PLAN);
|
result.add(KEY_MANAGE_MOBILE_PLAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
final PackageManager pm = context.getPackageManager();
|
|
||||||
|
|
||||||
// Remove Airplane Mode settings if it's a stationary device such as a TV.
|
// Remove Airplane Mode settings if it's a stationary device such as a TV.
|
||||||
if (pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
|
new AirplaneModePreferenceController(context, null /* fragment */)
|
||||||
result.add(KEY_TOGGLE_AIRPLANE);
|
.updateNonIndexableKeys(result);
|
||||||
}
|
|
||||||
|
|
||||||
// proxy UI disabled until we have better app support
|
// proxy UI disabled until we have better app support
|
||||||
result.add(KEY_PROXY_SETTINGS);
|
result.add(KEY_PROXY_SETTINGS);
|
||||||
|
|
||||||
// Disable Tethering if it's not allowed or if it's a wifi-only device
|
new TetherPreferenceController(context)
|
||||||
ConnectivityManager cm = (ConnectivityManager)
|
.updateNonIndexableKeys(result);
|
||||||
context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
if (isSecondaryUser || !cm.isTetheringSupported()) {
|
|
||||||
result.add(KEY_TETHER_SETTINGS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ImsManager.isWfcEnabledByPlatform(context) ||
|
if (!ImsManager.isWfcEnabledByPlatform(context) ||
|
||||||
!ImsManager.isWfcProvisionedOnDevice(context)) {
|
!ImsManager.isWfcProvisionedOnDevice(context)) {
|
||||||
|
@@ -22,6 +22,7 @@ import android.support.v7.preference.Preference;
|
|||||||
import android.support.v7.preference.PreferenceScreen;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
|
import android.util.ArraySet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
@@ -35,6 +36,7 @@ import com.android.settingslib.drawer.Tile;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base fragment for dashboard style UI containing a list of static and dynamic setting items.
|
* Base fragment for dashboard style UI containing a list of static and dynamic setting items.
|
||||||
@@ -45,6 +47,7 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private final Map<Class, PreferenceController> mPreferenceControllers =
|
private final Map<Class, PreferenceController> mPreferenceControllers =
|
||||||
new ArrayMap<>();
|
new ArrayMap<>();
|
||||||
|
private final Set<String> mDashboardTilePrefKeys = new ArraySet<>();
|
||||||
|
|
||||||
protected DashboardFeatureProvider mDashboardFeatureProvider;
|
protected DashboardFeatureProvider mDashboardFeatureProvider;
|
||||||
private boolean mListeningToCategoryChange;
|
private boolean mListeningToCategoryChange;
|
||||||
@@ -72,7 +75,7 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
|||||||
if (category == null) {
|
if (category == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
refreshAllPreferences(getLogTag());
|
refreshDashboardTiles(getLogTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -221,6 +224,7 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
|||||||
Log.d(TAG, "tile does not contain a key, skipping " + tile);
|
Log.d(TAG, "tile does not contain a key, skipping " + tile);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
mDashboardTilePrefKeys.add(key);
|
||||||
final Preference pref = new DashboardTilePreference(context);
|
final Preference pref = new DashboardTilePreference(context);
|
||||||
pref.setTitle(tile.title);
|
pref.setTitle(tile.title);
|
||||||
pref.setKey(key);
|
pref.setKey(key);
|
||||||
@@ -251,18 +255,36 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh preference items using system category dashboard items.
|
* Refresh all preference items, including both static prefs from xml, and dynamic items from
|
||||||
|
* DashboardCategory.
|
||||||
*/
|
*/
|
||||||
private void refreshAllPreferences(final String TAG) {
|
private void refreshAllPreferences(final String TAG) {
|
||||||
// First remove old preferences.
|
// First remove old preferences.
|
||||||
PreferenceScreen screen = getPreferenceScreen();
|
final PreferenceScreen screen = getPreferenceScreen();
|
||||||
if (screen != null) {
|
if (screen != null) {
|
||||||
screen.removeAll();
|
screen.removeAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add resource based tiles.
|
// Add resource based tiles.
|
||||||
displayResourceTiles();
|
displayResourceTiles();
|
||||||
|
|
||||||
// Add dashboard tiles.
|
refreshDashboardTiles(TAG);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh preference items backed by DashboardCategory.
|
||||||
|
*/
|
||||||
|
private void refreshDashboardTiles(final String TAG) {
|
||||||
|
final PreferenceScreen screen = getPreferenceScreen();
|
||||||
|
for (String key : mDashboardTilePrefKeys) {
|
||||||
|
final Preference pref = screen.findPreference(key);
|
||||||
|
if (pref != null) {
|
||||||
|
screen.removePreference(pref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mDashboardTilePrefKeys.clear();
|
||||||
displayDashboardTiles(TAG, getPreferenceScreen());
|
displayDashboardTiles(TAG, getPreferenceScreen());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.settings.network;
|
||||||
|
|
||||||
|
import android.app.Fragment;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.SystemProperties;
|
||||||
|
import android.support.v14.preference.SwitchPreference;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
|
|
||||||
|
import com.android.internal.telephony.TelephonyIntents;
|
||||||
|
import com.android.internal.telephony.TelephonyProperties;
|
||||||
|
import com.android.settings.AirplaneModeEnabler;
|
||||||
|
import com.android.settings.core.PreferenceController;
|
||||||
|
import com.android.settings.core.instrumentation.MetricsFeatureProvider;
|
||||||
|
import com.android.settings.core.lifecycle.LifecycleObserver;
|
||||||
|
import com.android.settings.core.lifecycle.events.OnPause;
|
||||||
|
import com.android.settings.core.lifecycle.events.OnResume;
|
||||||
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
|
|
||||||
|
public class AirplaneModePreferenceController extends PreferenceController
|
||||||
|
implements LifecycleObserver, OnResume, OnPause {
|
||||||
|
|
||||||
|
public static final int REQUEST_CODE_EXIT_ECM = 1;
|
||||||
|
|
||||||
|
public static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane";
|
||||||
|
|
||||||
|
private static final String EXIT_ECM_RESULT = "exit_ecm_result";
|
||||||
|
|
||||||
|
private final Fragment mFragment;
|
||||||
|
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||||
|
private final PackageManager mPackageManager;
|
||||||
|
private AirplaneModeEnabler mAirplaneModeEnabler;
|
||||||
|
private SwitchPreference mAirplaneModePreference;
|
||||||
|
|
||||||
|
|
||||||
|
public AirplaneModePreferenceController(Context context, Fragment hostFragment) {
|
||||||
|
super(context);
|
||||||
|
mFragment = hostFragment;
|
||||||
|
mPackageManager = context.getPackageManager();
|
||||||
|
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||||
|
if (KEY_TOGGLE_AIRPLANE.equals(preference.getKey()) && Boolean.parseBoolean(
|
||||||
|
SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) {
|
||||||
|
// In ECM mode launch ECM app dialog
|
||||||
|
if (mFragment != null) {
|
||||||
|
mFragment.startActivityForResult(
|
||||||
|
new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS, null),
|
||||||
|
REQUEST_CODE_EXIT_ECM);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void displayPreference(PreferenceScreen screen) {
|
||||||
|
if (isAvailable()) {
|
||||||
|
mAirplaneModePreference = (SwitchPreference) screen.findPreference(getPreferenceKey());
|
||||||
|
if (mAirplaneModePreference != null) {
|
||||||
|
mAirplaneModeEnabler = new AirplaneModeEnabler(mContext, mAirplaneModePreference,
|
||||||
|
mMetricsFeatureProvider);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
removePreference(screen, getPreferenceKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isAvailable() {
|
||||||
|
return !mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEVISION);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPreferenceKey() {
|
||||||
|
return KEY_TOGGLE_AIRPLANE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResume() {
|
||||||
|
mAirplaneModeEnabler.resume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
mAirplaneModeEnabler.pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (requestCode == REQUEST_CODE_EXIT_ECM) {
|
||||||
|
Boolean isChoiceYes = data.getBooleanExtra(EXIT_ECM_RESULT, false);
|
||||||
|
// Set Airplane mode based on the return value and checkbox state
|
||||||
|
mAirplaneModeEnabler.setAirplaneModeInECM(isChoiceYes,
|
||||||
|
mAirplaneModePreference.isChecked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.settings.network;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.UserManager;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
|
|
||||||
|
import com.android.settings.Utils;
|
||||||
|
import com.android.settings.core.PreferenceController;
|
||||||
|
|
||||||
|
import static android.os.UserHandle.myUserId;
|
||||||
|
import static android.os.UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS;
|
||||||
|
import static com.android.settingslib.RestrictedLockUtils.hasBaseUserRestriction;
|
||||||
|
|
||||||
|
public class MobileNetworkPreferenceController extends PreferenceController {
|
||||||
|
|
||||||
|
private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings";
|
||||||
|
|
||||||
|
private final UserManager mUserManager;
|
||||||
|
private final boolean mIsSecondaryUser;
|
||||||
|
|
||||||
|
public MobileNetworkPreferenceController(Context context) {
|
||||||
|
super(context);
|
||||||
|
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||||
|
mIsSecondaryUser = !mUserManager.isAdminUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isAvailable() {
|
||||||
|
return mIsSecondaryUser
|
||||||
|
|| Utils.isWifiOnly(mContext)
|
||||||
|
|| hasBaseUserRestriction(mContext, DISALLOW_CONFIG_MOBILE_NETWORKS, myUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPreferenceKey() {
|
||||||
|
return KEY_MOBILE_NETWORK_SETTINGS;
|
||||||
|
}
|
||||||
|
}
|
@@ -22,6 +22,7 @@ import com.android.settings.core.PreferenceController;
|
|||||||
import com.android.settings.dashboard.DashboardFragment;
|
import com.android.settings.dashboard.DashboardFragment;
|
||||||
import com.android.settingslib.drawer.CategoryKey;
|
import com.android.settingslib.drawer.CategoryKey;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class NetworkDashboardFragment extends DashboardFragment {
|
public class NetworkDashboardFragment extends DashboardFragment {
|
||||||
@@ -50,6 +51,15 @@ public class NetworkDashboardFragment extends DashboardFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<PreferenceController> getPreferenceControllers(Context context) {
|
protected List<PreferenceController> getPreferenceControllers(Context context) {
|
||||||
return null;
|
final AirplaneModePreferenceController airplaneModePreferenceController =
|
||||||
|
new AirplaneModePreferenceController(context, this /* fragment */);
|
||||||
|
getLifecycle().addObserver(airplaneModePreferenceController);
|
||||||
|
|
||||||
|
final List<PreferenceController> controllers = new ArrayList<>();
|
||||||
|
controllers.add(airplaneModePreferenceController);
|
||||||
|
controllers.add(new TetherPreferenceController(context));
|
||||||
|
controllers.add(new MobileNetworkPreferenceController(context));
|
||||||
|
controllers.add(new VpnPreferenceController(context));
|
||||||
|
return controllers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.settings.network;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.ConnectivityManager;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
import android.os.UserManager;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
|
|
||||||
|
import com.android.settings.TetherSettings;
|
||||||
|
import com.android.settings.core.PreferenceController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static android.os.UserManager.DISALLOW_CONFIG_TETHERING;
|
||||||
|
import static com.android.settingslib.RestrictedLockUtils.checkIfRestrictionEnforced;
|
||||||
|
import static com.android.settingslib.RestrictedLockUtils.hasBaseUserRestriction;
|
||||||
|
|
||||||
|
public class TetherPreferenceController extends PreferenceController {
|
||||||
|
|
||||||
|
private static final String KEY_TETHER_SETTINGS = "tether_settings";
|
||||||
|
|
||||||
|
private final boolean mAdminDisallowedTetherConfig;
|
||||||
|
private final ConnectivityManager mConnectivityManager;
|
||||||
|
private final UserManager mUserManager;
|
||||||
|
|
||||||
|
public TetherPreferenceController(Context context) {
|
||||||
|
super(context);
|
||||||
|
mAdminDisallowedTetherConfig = checkIfRestrictionEnforced(
|
||||||
|
context, DISALLOW_CONFIG_TETHERING, UserHandle.myUserId()) != null;
|
||||||
|
mConnectivityManager =
|
||||||
|
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void displayPreference(PreferenceScreen screen) {
|
||||||
|
super.displayPreference(screen);
|
||||||
|
final Preference preference = screen.findPreference(KEY_TETHER_SETTINGS);
|
||||||
|
if (preference != null && !mAdminDisallowedTetherConfig) {
|
||||||
|
preference.setTitle(
|
||||||
|
com.android.settingslib.Utils.getTetheringLabel(mConnectivityManager));
|
||||||
|
|
||||||
|
// Grey out if provisioning is not available.
|
||||||
|
preference.setEnabled(!TetherSettings.isProvisioningNeededButUnavailable(mContext));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isAvailable() {
|
||||||
|
final boolean isBlocked =
|
||||||
|
(!mConnectivityManager.isTetheringSupported() && !mAdminDisallowedTetherConfig)
|
||||||
|
|| hasBaseUserRestriction(mContext, DISALLOW_CONFIG_TETHERING,
|
||||||
|
UserHandle.myUserId());
|
||||||
|
return !isBlocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateNonIndexableKeys(List<String> keys) {
|
||||||
|
if (!mUserManager.isAdminUser() || !mConnectivityManager.isTetheringSupported()) {
|
||||||
|
keys.add(KEY_TETHER_SETTINGS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPreferenceKey() {
|
||||||
|
return KEY_TETHER_SETTINGS;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.android.settings.network;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
import android.os.UserManager;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.support.v7.preference.Preference;
|
||||||
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
|
|
||||||
|
import com.android.settings.core.PreferenceController;
|
||||||
|
import com.android.settingslib.RestrictedLockUtils;
|
||||||
|
|
||||||
|
|
||||||
|
public class VpnPreferenceController extends PreferenceController {
|
||||||
|
|
||||||
|
private static final String KEY_VPN_SETTINGS = "vpn_settings";
|
||||||
|
|
||||||
|
private final String mToggleable;
|
||||||
|
private final boolean mIsSecondaryUser;
|
||||||
|
|
||||||
|
public VpnPreferenceController(Context context) {
|
||||||
|
super(context);
|
||||||
|
mToggleable = Settings.Global.getString(context.getContentResolver(),
|
||||||
|
Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
|
||||||
|
mIsSecondaryUser = !UserManager.get(context).isAdminUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void displayPreference(PreferenceScreen screen) {
|
||||||
|
super.displayPreference(screen);
|
||||||
|
// Manually set dependencies for Wifi when not toggleable.
|
||||||
|
if (mToggleable == null || !mToggleable.contains(Settings.Global.RADIO_WIFI)) {
|
||||||
|
final Preference pref = screen.findPreference(KEY_VPN_SETTINGS);
|
||||||
|
if (pref != null) {
|
||||||
|
pref.setDependency(AirplaneModePreferenceController.KEY_TOGGLE_AIRPLANE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isAvailable() {
|
||||||
|
// TODO: http://b/23693383
|
||||||
|
return mIsSecondaryUser || RestrictedLockUtils.hasBaseUserRestriction(mContext,
|
||||||
|
UserManager.DISALLOW_CONFIG_VPN, UserHandle.myUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getPreferenceKey() {
|
||||||
|
return KEY_VPN_SETTINGS;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user