diff options
author | Christopher Tate <ctate@google.com> | 2012-09-10 15:39:05 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2012-09-10 15:46:17 -0700 |
commit | 6a5929b086a61a955a4a2f43f5fa251e8754ff4a (patch) | |
tree | 14f7dcf6986e314c29660d36f20b69e32ea6dc7c /src/com/android/settings | |
parent | 955f3477a910f56132f341f6679c9157b0cd515c (diff) | |
download | packages_apps_Settings-6a5929b086a61a955a4a2f43f5fa251e8754ff4a.tar.gz packages_apps_Settings-6a5929b086a61a955a4a2f43f5fa251e8754ff4a.tar.bz2 packages_apps_Settings-6a5929b086a61a955a4a2f43f5fa251e8754ff4a.zip |
Update Settings app to use new namespace for airplane-mode settings
Bug 7132230
Change-Id: I0253637e6d464afc229cf11ffe69852bf44fe261
Diffstat (limited to 'src/com/android/settings')
-rw-r--r-- | src/com/android/settings/AirplaneModeEnabler.java | 11 | ||||
-rw-r--r-- | src/com/android/settings/CryptKeeper.java | 5 | ||||
-rw-r--r-- | src/com/android/settings/WirelessSettings.java | 16 | ||||
-rw-r--r-- | src/com/android/settings/wifi/WifiApEnabler.java | 4 |
4 files changed, 19 insertions, 17 deletions
diff --git a/src/com/android/settings/AirplaneModeEnabler.java b/src/com/android/settings/AirplaneModeEnabler.java index 94ba5a1d5..d1c591e1d 100644 --- a/src/com/android/settings/AirplaneModeEnabler.java +++ b/src/com/android/settings/AirplaneModeEnabler.java @@ -22,6 +22,7 @@ import android.database.ContentObserver; import android.os.Handler; import android.os.Message; import android.os.SystemProperties; +import android.os.UserHandle; import android.preference.CheckBoxPreference; import android.preference.Preference; import android.provider.Settings; @@ -75,7 +76,7 @@ public class AirplaneModeEnabler implements Preference.OnPreferenceChangeListene mPhoneStateReceiver.registerIntent(); mCheckBoxPref.setOnPreferenceChangeListener(this); mContext.getContentResolver().registerContentObserver( - Settings.System.getUriFor(Settings.System.AIRPLANE_MODE_ON), true, + Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON), true, mAirplaneModeObserver); } @@ -86,13 +87,13 @@ public class AirplaneModeEnabler implements Preference.OnPreferenceChangeListene } public static boolean isAirplaneModeOn(Context context) { - return Settings.System.getInt(context.getContentResolver(), - Settings.System.AIRPLANE_MODE_ON, 0) != 0; + return Settings.Global.getInt(context.getContentResolver(), + Settings.Global.AIRPLANE_MODE_ON, 0) != 0; } private void setAirplaneModeOn(boolean enabling) { // Change the system setting - Settings.System.putInt(mContext.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, + Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, enabling ? 1 : 0); // Update the UI to reflect system setting mCheckBoxPref.setChecked(enabling); @@ -100,7 +101,7 @@ public class AirplaneModeEnabler implements Preference.OnPreferenceChangeListene // Post the intent Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", enabling); - mContext.sendBroadcast(intent); + mContext.sendBroadcastAsUser(intent, UserHandle.ALL); } /** diff --git a/src/com/android/settings/CryptKeeper.java b/src/com/android/settings/CryptKeeper.java index 4cab767a1..5872a0559 100644 --- a/src/com/android/settings/CryptKeeper.java +++ b/src/com/android/settings/CryptKeeper.java @@ -32,6 +32,7 @@ import android.os.PowerManager; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemProperties; +import android.os.UserHandle; import android.os.storage.IMountService; import android.provider.Settings; import android.telephony.TelephonyManager; @@ -641,10 +642,10 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList TelephonyManager.getDefault().getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE; if (!isLteDevice) { Log.d(TAG, "Going into airplane mode."); - Settings.System.putInt(getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 1); + Settings.Global.putInt(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1); final Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); intent.putExtra("state", true); - sendBroadcast(intent); + sendBroadcastAsUser(intent, UserHandle.ALL); } } diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java index 347315a05..c2a3f19e6 100644 --- a/src/com/android/settings/WirelessSettings.java +++ b/src/com/android/settings/WirelessSettings.java @@ -85,8 +85,8 @@ public class WirelessSettings extends SettingsPreferenceFragment { return true; } // Here we use the same logic in onCreate(). - String toggleable = Settings.System.getString(context.getContentResolver(), - Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS); + String toggleable = Settings.Global.getString(context.getContentResolver(), + Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS); return toggleable != null && toggleable.contains(type); } @@ -109,8 +109,8 @@ public class WirelessSettings extends SettingsPreferenceFragment { getPreferenceScreen().removePreference(nsd); //mNsdEnabler = new NsdEnabler(activity, nsd); - String toggleable = Settings.System.getString(activity.getContentResolver(), - Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS); + String toggleable = Settings.Global.getString(activity.getContentResolver(), + Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS); //enable/disable wimax depending on the value in config.xml boolean isWimaxEnabled = this.getResources().getBoolean( @@ -120,24 +120,24 @@ public class WirelessSettings extends SettingsPreferenceFragment { Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS); if (ps != null) root.removePreference(ps); } else { - if (toggleable == null || !toggleable.contains(Settings.System.RADIO_WIMAX ) + if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIMAX ) && isWimaxEnabled) { Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS); ps.setDependency(KEY_TOGGLE_AIRPLANE); } } // Manually set dependencies for Wifi when not toggleable. - if (toggleable == null || !toggleable.contains(Settings.System.RADIO_WIFI)) { + if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIFI)) { findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE); } // Manually set dependencies for Bluetooth when not toggleable. - if (toggleable == null || !toggleable.contains(Settings.System.RADIO_BLUETOOTH)) { + 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. - if (toggleable == null || !toggleable.contains(Settings.System.RADIO_NFC)) { + if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_NFC)) { findPreference(KEY_TOGGLE_NFC).setDependency(KEY_TOGGLE_AIRPLANE); findPreference(KEY_ANDROID_BEAM_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE); } diff --git a/src/com/android/settings/wifi/WifiApEnabler.java b/src/com/android/settings/wifi/WifiApEnabler.java index f3fd5661e..9a3b49d8f 100644 --- a/src/com/android/settings/wifi/WifiApEnabler.java +++ b/src/com/android/settings/wifi/WifiApEnabler.java @@ -98,8 +98,8 @@ public class WifiApEnabler { } private void enableWifiCheckBox() { - boolean isAirplaneMode = Settings.System.getInt(mContext.getContentResolver(), - Settings.System.AIRPLANE_MODE_ON, 0) != 0; + boolean isAirplaneMode = Settings.Global.getInt(mContext.getContentResolver(), + Settings.Global.AIRPLANE_MODE_ON, 0) != 0; if(!isAirplaneMode) { mCheckBox.setEnabled(true); } else { |