am 098295a5: Merge "Updated emergency string when locale changes." into eclair

Merge commit '098295a5a3e840e94040ce38eb08eb6c72b2a7e0' into eclair-plus-aosp

* commit '098295a5a3e840e94040ce38eb08eb6c72b2a7e0':
  Updated emergency string when locale changes.
This commit is contained in:
John Wang
2010-01-22 13:20:25 -08:00
committed by Android Git Automerger

View File

@@ -20,9 +20,12 @@ import android.app.AlarmManager;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.database.ContentObserver; import android.database.ContentObserver;
import android.os.AsyncResult; import android.os.AsyncResult;
import android.os.Handler; import android.os.Handler;
@@ -166,6 +169,16 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
static final int MAX_NUM_DATA_STATE_READS = 15; static final int MAX_NUM_DATA_STATE_READS = 15;
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_LOCALE_CHANGED)) {
// update emergency string whenever locale changed
updateSpnDisplay();
}
}
};
private ContentObserver mAutoTimeObserver = new ContentObserver(new Handler()) { private ContentObserver mAutoTimeObserver = new ContentObserver(new Handler()) {
@Override @Override
public void onChange(boolean selfChange) { public void onChange(boolean selfChange) {
@@ -211,6 +224,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
mAutoTimeObserver); mAutoTimeObserver);
setSignalStrengthDefaultValues(); setSignalStrengthDefaultValues();
mNeedToRegForSimLoaded = true; mNeedToRegForSimLoaded = true;
// Monitor locale change
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_LOCALE_CHANGED);
phone.getContext().registerReceiver(mIntentReceiver, filter);
} }
public void dispose() { public void dispose() {
@@ -558,20 +576,18 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
// For emergency calls only, pass the EmergencyCallsOnly string via EXTRA_PLMN // For emergency calls only, pass the EmergencyCallsOnly string via EXTRA_PLMN
if (mEmergencyOnly && cm.getRadioState().isOn()) { if (mEmergencyOnly && cm.getRadioState().isOn()) {
plmn = phone.getContext().getText(com.android.internal.R.string.emergency_calls_only).toString(); plmn = Resources.getSystem().
getText(com.android.internal.R.string.emergency_calls_only).toString();
} }
if (rule != curSpnRule if (rule != curSpnRule
|| !TextUtils.equals(spn, curSpn) || !TextUtils.equals(spn, curSpn)
|| !TextUtils.equals(plmn, curPlmn)) { || !TextUtils.equals(plmn, curPlmn)) {
boolean showSpn = boolean showSpn = mEmergencyOnly
(rule & SIMRecords.SPN_RULE_SHOW_SPN) == SIMRecords.SPN_RULE_SHOW_SPN; || (rule & SIMRecords.SPN_RULE_SHOW_SPN) == SIMRecords.SPN_RULE_SHOW_SPN;
boolean showPlmn = boolean showPlmn =
(rule & SIMRecords.SPN_RULE_SHOW_PLMN) == SIMRecords.SPN_RULE_SHOW_PLMN; (rule & SIMRecords.SPN_RULE_SHOW_PLMN) == SIMRecords.SPN_RULE_SHOW_PLMN;
if (mEmergencyOnly)
showPlmn = true;
Intent intent = new Intent(Intents.SPN_STRINGS_UPDATED_ACTION); Intent intent = new Intent(Intents.SPN_STRINGS_UPDATED_ACTION);
intent.putExtra(Intents.EXTRA_SHOW_SPN, showSpn); intent.putExtra(Intents.EXTRA_SHOW_SPN, showSpn);
intent.putExtra(Intents.EXTRA_SPN, spn); intent.putExtra(Intents.EXTRA_SPN, spn);