package com.android.settings;
+import com.android.internal.telephony.TelephonyIntents;
+import com.android.internal.telephony.TelephonyProperties;
+import com.android.settings.bluetooth.BluetoothEnabler;
+import com.android.settings.wifi.WifiEnabler;
++import com.android.settings.nfc.NfcEnabler;
+
+import android.app.Activity;
+import android.app.admin.DevicePolicyManager;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
private static final String KEY_BT_SETTINGS = "bt_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";
+
public static final String EXIT_ECM_RESULT = "exit_ecm_result";
public static final int REQUEST_CODE_EXIT_ECM = 1;
CheckBoxPreference airplane = (CheckBoxPreference) findPreference(KEY_TOGGLE_AIRPLANE);
CheckBoxPreference wifi = (CheckBoxPreference) findPreference(KEY_TOGGLE_WIFI);
CheckBoxPreference bt = (CheckBoxPreference) findPreference(KEY_TOGGLE_BLUETOOTH);
+ CheckBoxPreference nfc = (CheckBoxPreference) findPreference(KEY_TOGGLE_NFC);
- mAirplaneModeEnabler = new AirplaneModeEnabler(this, airplane);
+ mAirplaneModeEnabler = new AirplaneModeEnabler(activity, airplane);
mAirplaneModePreference = (CheckBoxPreference) findPreference(KEY_TOGGLE_AIRPLANE);
- mWifiEnabler = new WifiEnabler(this, wifi);
- mBtEnabler = new BluetoothEnabler(this, bt);
- mNfcEnabler = new NfcEnabler(this, nfc);
+ mWifiEnabler = new WifiEnabler(activity, wifi);
+ mBtEnabler = new BluetoothEnabler(activity, bt);
++ mNfcEnabler = new NfcEnabler(activity, nfc);
- String toggleable = Settings.System.getString(getContentResolver(),
+ String toggleable = Settings.System.getString(activity.getContentResolver(),
Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS);
// Manually set dependencies for Wifi when not toggleable.
findPreference(KEY_BT_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
}
- // Disable Bluetooth Settings if Bluetooth service is not available.
+ // Remove Bluetooth Settings if Bluetooth service is not available.
if (ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE) == null) {
- findPreference(KEY_BT_SETTINGS).setEnabled(false);
+ getPreferenceScreen().removePreference(bt);
+ }
+
+ // Remove NFC if its not available
+ if (ServiceManager.getService(Context.NFC_SERVICE) == null) {
+ getPreferenceScreen().removePreference(nfc);
}
+ // Enable Proxy selector settings if allowed.
+ Preference mGlobalProxy = findPreference(KEY_PROXY_SETTINGS);
+ DevicePolicyManager mDPM = (DevicePolicyManager)
+ activity.getSystemService(Context.DEVICE_POLICY_SERVICE);
+ mGlobalProxy.setEnabled(mDPM.getGlobalProxyAdmin() == null);
+
// Disable Tethering if it's not allowed
ConnectivityManager cm =
- (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
+ (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
if (!cm.isTetheringSupported()) {
getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS));
} else {