am 6c084141
: Merge "Update Settings app to manipulate now-global settings properly" into jb-mr1-dev
* commit '6c0841412e3ddf03d7b9ad56e398a20f6b6cf3fd': Update Settings app to manipulate now-global settings properly
This commit is contained in:
@@ -869,14 +869,14 @@ public class DataUsageSummary extends Fragment {
|
|||||||
|
|
||||||
private boolean getDataRoaming() {
|
private boolean getDataRoaming() {
|
||||||
final ContentResolver resolver = getActivity().getContentResolver();
|
final ContentResolver resolver = getActivity().getContentResolver();
|
||||||
return Settings.Secure.getInt(resolver, Settings.Secure.DATA_ROAMING, 0) != 0;
|
return Settings.Global.getInt(resolver, Settings.Global.DATA_ROAMING, 0) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDataRoaming(boolean enabled) {
|
private void setDataRoaming(boolean enabled) {
|
||||||
// TODO: teach telephony DataConnectionTracker to watch and apply
|
// TODO: teach telephony DataConnectionTracker to watch and apply
|
||||||
// updates when changed.
|
// updates when changed.
|
||||||
final ContentResolver resolver = getActivity().getContentResolver();
|
final ContentResolver resolver = getActivity().getContentResolver();
|
||||||
Settings.Secure.putInt(resolver, Settings.Secure.DATA_ROAMING, enabled ? 1 : 0);
|
Settings.Global.putInt(resolver, Settings.Global.DATA_ROAMING, enabled ? 1 : 0);
|
||||||
mMenuDataRoaming.setChecked(enabled);
|
mMenuDataRoaming.setChecked(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1899,7 +1899,7 @@ public class DataUsageSummary extends Fragment {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog to request user confirmation before setting
|
* Dialog to request user confirmation before setting
|
||||||
* {@link android.provider.Settings.Secure#DATA_ROAMING}.
|
* {@link android.provider.Settings.Global#DATA_ROAMING}.
|
||||||
*/
|
*/
|
||||||
public static class ConfirmDataRoamingFragment extends DialogFragment {
|
public static class ConfirmDataRoamingFragment extends DialogFragment {
|
||||||
public static void show(DataUsageSummary parent) {
|
public static void show(DataUsageSummary parent) {
|
||||||
|
@@ -316,8 +316,8 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
final ContentResolver cr = getActivity().getContentResolver();
|
final ContentResolver cr = getActivity().getContentResolver();
|
||||||
mLastEnabledState = Settings.Secure.getInt(cr,
|
mLastEnabledState = Settings.Global.getInt(cr,
|
||||||
Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
|
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
|
||||||
mEnabledSwitch.setChecked(mLastEnabledState);
|
mEnabledSwitch.setChecked(mLastEnabledState);
|
||||||
setPrefsEnabledState(mLastEnabledState);
|
setPrefsEnabledState(mLastEnabledState);
|
||||||
|
|
||||||
@@ -326,8 +326,8 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
// settings that are enabled. This is an invalid state. Switch
|
// settings that are enabled. This is an invalid state. Switch
|
||||||
// to debug settings being enabled, so the user knows there is
|
// to debug settings being enabled, so the user knows there is
|
||||||
// stuff enabled and can turn it all off if they want.
|
// stuff enabled and can turn it all off if they want.
|
||||||
Settings.Secure.putInt(getActivity().getContentResolver(),
|
Settings.Global.putInt(getActivity().getContentResolver(),
|
||||||
Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
||||||
mLastEnabledState = true;
|
mLastEnabledState = true;
|
||||||
setPrefsEnabledState(mLastEnabledState);
|
setPrefsEnabledState(mLastEnabledState);
|
||||||
}
|
}
|
||||||
@@ -342,12 +342,12 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
final ContentResolver cr = context.getContentResolver();
|
final ContentResolver cr = context.getContentResolver();
|
||||||
mHaveDebugSettings = false;
|
mHaveDebugSettings = false;
|
||||||
updateCheckBox(mEnableAdb, Settings.Secure.getInt(cr,
|
updateCheckBox(mEnableAdb, Settings.Global.getInt(cr,
|
||||||
Settings.Secure.ADB_ENABLED, 0) != 0);
|
Settings.Global.ADB_ENABLED, 0) != 0);
|
||||||
updateCheckBox(mBugreportInPower, Settings.Secure.getInt(cr,
|
updateCheckBox(mBugreportInPower, Settings.Secure.getInt(cr,
|
||||||
Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
|
Settings.Secure.BUGREPORT_IN_POWER_MENU, 0) != 0);
|
||||||
updateCheckBox(mKeepScreenOn, Settings.System.getInt(cr,
|
updateCheckBox(mKeepScreenOn, Settings.Global.getInt(cr,
|
||||||
Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
|
Settings.Global.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
|
||||||
updateCheckBox(mEnforceReadExternal, isPermissionEnforced(READ_EXTERNAL_STORAGE));
|
updateCheckBox(mEnforceReadExternal, isPermissionEnforced(READ_EXTERNAL_STORAGE));
|
||||||
updateCheckBox(mAllowMockLocation, Settings.Secure.getInt(cr,
|
updateCheckBox(mAllowMockLocation, Settings.Secure.getInt(cr,
|
||||||
Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
|
Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
|
||||||
@@ -815,8 +815,8 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
mEnableDialog.setOnDismissListener(this);
|
mEnableDialog.setOnDismissListener(this);
|
||||||
} else {
|
} else {
|
||||||
resetDangerousOptions();
|
resetDangerousOptions();
|
||||||
Settings.Secure.putInt(getActivity().getContentResolver(),
|
Settings.Global.putInt(getActivity().getContentResolver(),
|
||||||
Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 0);
|
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0);
|
||||||
mLastEnabledState = isChecked;
|
mLastEnabledState = isChecked;
|
||||||
setPrefsEnabledState(mLastEnabledState);
|
setPrefsEnabledState(mLastEnabledState);
|
||||||
}
|
}
|
||||||
@@ -857,16 +857,16 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
.show();
|
.show();
|
||||||
mAdbDialog.setOnDismissListener(this);
|
mAdbDialog.setOnDismissListener(this);
|
||||||
} else {
|
} else {
|
||||||
Settings.Secure.putInt(getActivity().getContentResolver(),
|
Settings.Global.putInt(getActivity().getContentResolver(),
|
||||||
Settings.Secure.ADB_ENABLED, 0);
|
Settings.Global.ADB_ENABLED, 0);
|
||||||
}
|
}
|
||||||
} else if (preference == mBugreportInPower) {
|
} else if (preference == mBugreportInPower) {
|
||||||
Settings.Secure.putInt(getActivity().getContentResolver(),
|
Settings.Secure.putInt(getActivity().getContentResolver(),
|
||||||
Settings.Secure.BUGREPORT_IN_POWER_MENU,
|
Settings.Secure.BUGREPORT_IN_POWER_MENU,
|
||||||
mBugreportInPower.isChecked() ? 1 : 0);
|
mBugreportInPower.isChecked() ? 1 : 0);
|
||||||
} else if (preference == mKeepScreenOn) {
|
} else if (preference == mKeepScreenOn) {
|
||||||
Settings.System.putInt(getActivity().getContentResolver(),
|
Settings.Global.putInt(getActivity().getContentResolver(),
|
||||||
Settings.System.STAY_ON_WHILE_PLUGGED_IN,
|
Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
|
||||||
mKeepScreenOn.isChecked() ?
|
mKeepScreenOn.isChecked() ?
|
||||||
(BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB) : 0);
|
(BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB) : 0);
|
||||||
} else if (preference == mEnforceReadExternal) {
|
} else if (preference == mEnforceReadExternal) {
|
||||||
@@ -958,8 +958,8 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
if (dialog == mAdbDialog) {
|
if (dialog == mAdbDialog) {
|
||||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
mDialogClicked = true;
|
mDialogClicked = true;
|
||||||
Settings.Secure.putInt(getActivity().getContentResolver(),
|
Settings.Global.putInt(getActivity().getContentResolver(),
|
||||||
Settings.Secure.ADB_ENABLED, 1);
|
Settings.Global.ADB_ENABLED, 1);
|
||||||
} else {
|
} else {
|
||||||
// Reset the toggle
|
// Reset the toggle
|
||||||
mEnableAdb.setChecked(false);
|
mEnableAdb.setChecked(false);
|
||||||
@@ -967,8 +967,8 @@ public class DevelopmentSettings extends PreferenceFragment
|
|||||||
} else if (dialog == mEnableDialog) {
|
} else if (dialog == mEnableDialog) {
|
||||||
if (which == DialogInterface.BUTTON_POSITIVE) {
|
if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
mDialogClicked = true;
|
mDialogClicked = true;
|
||||||
Settings.Secure.putInt(getActivity().getContentResolver(),
|
Settings.Global.putInt(getActivity().getContentResolver(),
|
||||||
Settings.Secure.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
|
||||||
mLastEnabledState = true;
|
mLastEnabledState = true;
|
||||||
setPrefsEnabledState(mLastEnabledState);
|
setPrefsEnabledState(mLastEnabledState);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -129,7 +129,7 @@ public class LocationSettings extends SettingsPreferenceFragment
|
|||||||
mAssistedGps.setEnabled(enabled);
|
mAssistedGps.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
} else if (preference == mAssistedGps) {
|
} else if (preference == mAssistedGps) {
|
||||||
Settings.Secure.putInt(cr, Settings.Secure.ASSISTED_GPS_ENABLED,
|
Settings.Global.putInt(cr, Settings.Global.ASSISTED_GPS_ENABLED,
|
||||||
mAssistedGps.isChecked() ? 1 : 0);
|
mAssistedGps.isChecked() ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
// If we didn't handle it, let preferences handle it.
|
// If we didn't handle it, let preferences handle it.
|
||||||
@@ -152,8 +152,8 @@ public class LocationSettings extends SettingsPreferenceFragment
|
|||||||
mNetwork.setChecked(networkEnabled);
|
mNetwork.setChecked(networkEnabled);
|
||||||
mLocationAccess.setChecked(gpsEnabled || networkEnabled);
|
mLocationAccess.setChecked(gpsEnabled || networkEnabled);
|
||||||
if (mAssistedGps != null) {
|
if (mAssistedGps != null) {
|
||||||
mAssistedGps.setChecked(Settings.Secure.getInt(res,
|
mAssistedGps.setChecked(Settings.Global.getInt(res,
|
||||||
Settings.Secure.ASSISTED_GPS_ENABLED, 2) == 1);
|
Settings.Global.ASSISTED_GPS_ENABLED, 2) == 1);
|
||||||
mAssistedGps.setEnabled(gpsEnabled);
|
mAssistedGps.setEnabled(gpsEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -229,13 +229,13 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isNonMarketAppsAllowed() {
|
private boolean isNonMarketAppsAllowed() {
|
||||||
return Settings.Secure.getInt(getContentResolver(),
|
return Settings.Global.getInt(getContentResolver(),
|
||||||
Settings.Secure.INSTALL_NON_MARKET_APPS, 0) > 0;
|
Settings.Global.INSTALL_NON_MARKET_APPS, 0) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNonMarketAppsAllowed(boolean enabled) {
|
private void setNonMarketAppsAllowed(boolean enabled) {
|
||||||
// Change the system setting
|
// Change the system setting
|
||||||
Settings.Secure.putInt(getContentResolver(), Settings.Secure.INSTALL_NON_MARKET_APPS,
|
Settings.Global.putInt(getContentResolver(), Settings.Global.INSTALL_NON_MARKET_APPS,
|
||||||
enabled ? 1 : 0);
|
enabled ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -117,7 +117,7 @@ public class WifiApEnabler {
|
|||||||
if (enable && ((wifiState == WifiManager.WIFI_STATE_ENABLING) ||
|
if (enable && ((wifiState == WifiManager.WIFI_STATE_ENABLING) ||
|
||||||
(wifiState == WifiManager.WIFI_STATE_ENABLED))) {
|
(wifiState == WifiManager.WIFI_STATE_ENABLED))) {
|
||||||
mWifiManager.setWifiEnabled(false);
|
mWifiManager.setWifiEnabled(false);
|
||||||
Settings.Secure.putInt(cr, Settings.Secure.WIFI_SAVED_STATE, 1);
|
Settings.Global.putInt(cr, Settings.Global.WIFI_SAVED_STATE, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mWifiManager.setWifiApEnabled(null, enable)) {
|
if (mWifiManager.setWifiApEnabled(null, enable)) {
|
||||||
@@ -133,13 +133,13 @@ public class WifiApEnabler {
|
|||||||
if (!enable) {
|
if (!enable) {
|
||||||
int wifiSavedState = 0;
|
int wifiSavedState = 0;
|
||||||
try {
|
try {
|
||||||
wifiSavedState = Settings.Secure.getInt(cr, Settings.Secure.WIFI_SAVED_STATE);
|
wifiSavedState = Settings.Global.getInt(cr, Settings.Global.WIFI_SAVED_STATE);
|
||||||
} catch (Settings.SettingNotFoundException e) {
|
} catch (Settings.SettingNotFoundException e) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
if (wifiSavedState == 1) {
|
if (wifiSavedState == 1) {
|
||||||
mWifiManager.setWifiEnabled(true);
|
mWifiManager.setWifiEnabled(true);
|
||||||
Settings.Secure.putInt(cr, Settings.Secure.WIFI_SAVED_STATE, 0);
|
Settings.Global.putInt(cr, Settings.Global.WIFI_SAVED_STATE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user