Remove getIntWithSubId in TelephonyManager.
For multi-SIM case, getIntWithSubId would check if a Global.Settings value doesn't exist for a specific SIM (for example mobile_data0), it copies value from general one (mobile_data). Test: Telephony unittests Bug: 34351475 Change-Id: I870e6f3c193cf3bdeae22fe1a750b0a0ec782f9b Merged-In: I870e6f3c193cf3bdeae22fe1a750b0a0ec782f9b
This commit is contained in:
committed by
Xiangyu/Malcolm Chen
parent
e4e5291743
commit
ccc427426f
@@ -5859,45 +5859,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
|
||||
|
||||
Reference in New Issue
Block a user