Merge "Remove getIntWithSubId in TelephonyManager."

This commit is contained in:
Xiangyu/Malcolm Chen
2017-09-01 18:23:45 +00:00
committed by Android (Google) Code Review

View File

@@ -5792,45 +5792,6 @@ public class TelephonyManager {
return false;
}
/**
* This function retrieves value for setting "name+subId", and if that is not found
* retrieves value for setting "name", and if that is not found throws
* SettingNotFoundException
*
* @hide
*/
public static int getIntWithSubId(ContentResolver cr, String name, int subId)
throws SettingNotFoundException {
try {
return Settings.Global.getInt(cr, name + subId);
} catch (SettingNotFoundException e) {
try {
int val = Settings.Global.getInt(cr, name);
Settings.Global.putInt(cr, name + subId, val);
/* We are now moving from 'setting' to 'setting+subId', and using the value stored
* for 'setting' as default. Reset the default (since it may have a user set
* value). */
int default_val = val;
if (name.equals(Settings.Global.MOBILE_DATA)) {
default_val = "true".equalsIgnoreCase(
SystemProperties.get("ro.com.android.mobiledata", "true")) ? 1 : 0;
} else if (name.equals(Settings.Global.DATA_ROAMING)) {
default_val = "true".equalsIgnoreCase(
SystemProperties.get("ro.com.android.dataroaming", "false")) ? 1 : 0;
}
if (default_val != val) {
Settings.Global.putInt(cr, name, default_val);
}
return val;
} catch (SettingNotFoundException exc) {
throw new SettingNotFoundException(name);
}
}
}
/**
* Returns the IMS Registration Status
* @hide