Merge "Updated emergency string when locale changes." into eclair
This commit is contained in:
@@ -20,9 +20,12 @@ import android.app.AlarmManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.os.AsyncResult;
|
||||
import android.os.Handler;
|
||||
@@ -166,6 +169,16 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
|
||||
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()) {
|
||||
@Override
|
||||
public void onChange(boolean selfChange) {
|
||||
@@ -211,6 +224,11 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
mAutoTimeObserver);
|
||||
setSignalStrengthDefaultValues();
|
||||
mNeedToRegForSimLoaded = true;
|
||||
|
||||
// Monitor locale change
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_LOCALE_CHANGED);
|
||||
phone.getContext().registerReceiver(mIntentReceiver, filter);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
@@ -558,20 +576,18 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
|
||||
|
||||
// For emergency calls only, pass the EmergencyCallsOnly string via EXTRA_PLMN
|
||||
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
|
||||
|| !TextUtils.equals(spn, curSpn)
|
||||
|| !TextUtils.equals(plmn, curPlmn)) {
|
||||
boolean showSpn =
|
||||
(rule & SIMRecords.SPN_RULE_SHOW_SPN) == SIMRecords.SPN_RULE_SHOW_SPN;
|
||||
boolean showSpn = mEmergencyOnly
|
||||
|| (rule & SIMRecords.SPN_RULE_SHOW_SPN) == SIMRecords.SPN_RULE_SHOW_SPN;
|
||||
boolean showPlmn =
|
||||
(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.putExtra(Intents.EXTRA_SHOW_SPN, showSpn);
|
||||
intent.putExtra(Intents.EXTRA_SPN, spn);
|
||||
|
||||
Reference in New Issue
Block a user