Merge change I749d6801 into eclair-mr2
* changes: Telephony: Fix exception if PROPERTY_OPERATOR_NUMERIC is not set and minor fixes.
This commit is contained in:
@@ -24,6 +24,7 @@ import android.net.wifi.WifiManager;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -573,34 +574,36 @@ public final class MccTable
|
|||||||
* @param mccmnc truncated imsi with just the MCC and MNC - MNC assumed to be from 4th to end
|
* @param mccmnc truncated imsi with just the MCC and MNC - MNC assumed to be from 4th to end
|
||||||
*/
|
*/
|
||||||
public static void updateMccMncConfiguration(PhoneBase phone, String mccmnc) {
|
public static void updateMccMncConfiguration(PhoneBase phone, String mccmnc) {
|
||||||
int mcc, mnc;
|
if (!TextUtils.isEmpty(mccmnc)) {
|
||||||
|
int mcc, mnc;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mcc = Integer.parseInt(mccmnc.substring(0,3));
|
mcc = Integer.parseInt(mccmnc.substring(0,3));
|
||||||
mnc = Integer.parseInt(mccmnc.substring(3));
|
mnc = Integer.parseInt(mccmnc.substring(3));
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
Log.e(LOG_TAG, "Error parsing IMSI");
|
Log.e(LOG_TAG, "Error parsing IMSI");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(LOG_TAG, "updateMccMncConfiguration: mcc=" + mcc + ", mnc=" + mnc);
|
Log.d(LOG_TAG, "updateMccMncConfiguration: mcc=" + mcc + ", mnc=" + mnc);
|
||||||
|
|
||||||
if (mcc != 0) {
|
|
||||||
setTimezoneFromMccIfNeeded(phone, mcc);
|
|
||||||
setLocaleFromMccIfNeeded(phone, mcc);
|
|
||||||
setWifiChannelsFromMccIfNeeded(phone, mcc);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Configuration config = ActivityManagerNative.getDefault().getConfiguration();
|
|
||||||
if (mcc != 0) {
|
if (mcc != 0) {
|
||||||
config.mcc = mcc;
|
setTimezoneFromMccIfNeeded(phone, mcc);
|
||||||
|
setLocaleFromMccIfNeeded(phone, mcc);
|
||||||
|
setWifiChannelsFromMccIfNeeded(phone, mcc);
|
||||||
}
|
}
|
||||||
if (mnc != 0) {
|
try {
|
||||||
config.mnc = mnc;
|
Configuration config = ActivityManagerNative.getDefault().getConfiguration();
|
||||||
|
if (mcc != 0) {
|
||||||
|
config.mcc = mcc;
|
||||||
|
}
|
||||||
|
if (mnc != 0) {
|
||||||
|
config.mnc = mnc;
|
||||||
|
}
|
||||||
|
ActivityManagerNative.getDefault().updateConfiguration(config);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(LOG_TAG, "Can't update configuration", e);
|
||||||
}
|
}
|
||||||
ActivityManagerNative.getDefault().updateConfiguration(config);
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
Log.e(LOG_TAG, "Can't update configuration", e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2191,6 +2191,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
case RIL_REQUEST_SET_SMSC_ADDRESS: ret = responseVoid(p); break;
|
case RIL_REQUEST_SET_SMSC_ADDRESS: ret = responseVoid(p); break;
|
||||||
case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break;
|
case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break;
|
||||||
case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break;
|
case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break;
|
||||||
|
case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: ret = responseVoid(p); break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest);
|
throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest);
|
||||||
//break;
|
//break;
|
||||||
|
|||||||
@@ -202,10 +202,6 @@ public class CDMAPhone extends PhoneBase {
|
|||||||
// Sets current entry in the telephony carrier table
|
// Sets current entry in the telephony carrier table
|
||||||
updateCurrentCarrierInProvider(operatorNumeric);
|
updateCurrentCarrierInProvider(operatorNumeric);
|
||||||
|
|
||||||
// Updates MCC MNC device configuration information
|
|
||||||
MccTable.updateMccMncConfiguration(this, operatorNumeric);
|
|
||||||
|
|
||||||
|
|
||||||
// Notify voicemails.
|
// Notify voicemails.
|
||||||
notifier.notifyMessageWaitingChanged(this);
|
notifier.notifyMessageWaitingChanged(this);
|
||||||
}
|
}
|
||||||
@@ -1401,20 +1397,22 @@ public class CDMAPhone extends PhoneBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the "current" field in the telephony provider according to the build-time
|
* Sets the "current" field in the telephony provider according to the
|
||||||
* operator numeric property
|
* build-time operator numeric property
|
||||||
*
|
*
|
||||||
* @return true for success; false otherwise.
|
* @return true for success; false otherwise.
|
||||||
*/
|
*/
|
||||||
// TODO(Moto): move this method into PhoneBase, since it looks identical to
|
boolean updateCurrentCarrierInProvider(String operatorNumeric) {
|
||||||
// the one in GsmPhone
|
|
||||||
private boolean updateCurrentCarrierInProvider(String operatorNumeric) {
|
|
||||||
if (!TextUtils.isEmpty(operatorNumeric)) {
|
if (!TextUtils.isEmpty(operatorNumeric)) {
|
||||||
try {
|
try {
|
||||||
Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
|
Uri uri = Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current");
|
||||||
ContentValues map = new ContentValues();
|
ContentValues map = new ContentValues();
|
||||||
map.put(Telephony.Carriers.NUMERIC, operatorNumeric);
|
map.put(Telephony.Carriers.NUMERIC, operatorNumeric);
|
||||||
getContext().getContentResolver().insert(uri, map);
|
getContext().getContentResolver().insert(uri, map);
|
||||||
|
|
||||||
|
// Updates MCC MNC device configuration information
|
||||||
|
MccTable.updateMccMncConfiguration(this, operatorNumeric);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
Log.e(LOG_TAG, "Can't store current operator", e);
|
Log.e(LOG_TAG, "Can't store current operator", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user