Loading src/java/com/android/internal/telephony/ServiceStateTracker.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -227,6 +227,7 @@ public abstract class ServiceStateTracker extends Handler { private boolean mImsRegistered = false; private boolean mImsRegistered = false; protected SubscriptionManager mSubscriptionManager; protected SubscriptionManager mSubscriptionManager; protected SubscriptionController mSubscriptionController; protected final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener = protected final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener = new OnSubscriptionsChangedListener() { new OnSubscriptionsChangedListener() { private int previousSubId = -1; // < 0 is invalid subId private int previousSubId = -1; // < 0 is invalid subId Loading Loading @@ -292,6 +293,7 @@ public abstract class ServiceStateTracker extends Handler { mCi.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null); mCi.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null); mCi.registerForCellInfoList(this, EVENT_UNSOL_CELL_INFO_LIST, null); mCi.registerForCellInfoList(this, EVENT_UNSOL_CELL_INFO_LIST, null); mSubscriptionController = SubscriptionController.getInstance(); mSubscriptionManager = SubscriptionManager.from(phoneBase.getContext()); mSubscriptionManager = SubscriptionManager.from(phoneBase.getContext()); mSubscriptionManager mSubscriptionManager .registerOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener); .registerOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener); Loading src/java/com/android/internal/telephony/SubscriptionController.java +28 −43 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.internal.telephony; package com.android.internal.telephony; import android.content.BroadcastReceiver; import android.content.ContentProviderClient; import android.content.ContentProviderClient; import android.content.ContentResolver; import android.content.ContentResolver; import android.content.ContentValues; import android.content.ContentValues; Loading Loading @@ -159,33 +158,6 @@ public class SubscriptionController extends ISub.Stub { } } }; }; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (DBG) logd("onReceive " + intent); // TODO: Have GsmServiceStateTracker insert this data directly and deprecate // this broadcast. int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, SubscriptionManager.INVALID_SUBSCRIPTION_ID); if (intent.getAction().equals(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION)) { if (intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_PLMN, false)) { String carrierText = intent.getStringExtra(TelephonyIntents.EXTRA_PLMN); if (intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false)) { // Need to show both plmn and spn. String separator = mContext.getString( com.android.internal.R.string.kg_text_message_separator).toString(); carrierText = new StringBuilder().append(carrierText).append(separator) .append(intent.getStringExtra(TelephonyIntents.EXTRA_SPN)) .toString(); } setCarrierText(carrierText, subId); } else if (intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false)) { setCarrierText(intent.getStringExtra(TelephonyIntents.EXTRA_PLMN), subId); } } } }; public static SubscriptionController init(Phone phone) { public static SubscriptionController init(Phone phone) { synchronized (SubscriptionController.class) { synchronized (SubscriptionController.class) { if (sInstance == null) { if (sInstance == null) { Loading Loading @@ -225,7 +197,6 @@ public class SubscriptionController extends ISub.Stub { if(ServiceManager.getService("isub") == null) { if(ServiceManager.getService("isub") == null) { ServiceManager.addService("isub", this); ServiceManager.addService("isub", this); } } registerReceiverIfNeeded(); if (DBG) logdl("[SubscriptionController] init by Context"); if (DBG) logdl("[SubscriptionController] init by Context"); } } Loading @@ -241,24 +212,10 @@ public class SubscriptionController extends ISub.Stub { if(ServiceManager.getService("isub") == null) { if(ServiceManager.getService("isub") == null) { ServiceManager.addService("isub", this); ServiceManager.addService("isub", this); } } registerReceiverIfNeeded(); if (DBG) logdl("[SubscriptionController] init by Phone"); if (DBG) logdl("[SubscriptionController] init by Phone"); } } private void registerReceiverIfNeeded() { // We only need to register the broadcast receiver if the URI // where we are going to store the data is valid. // TODO: This can be removed once the SubscriptionController is not running // on devices that don't need it, such as TVs. if (mContext.getPackageManager().resolveContentProvider( SubscriptionManager.CONTENT_URI.getAuthority(), 0) != null) { if (DBG) logd("registering SPN updated receiver"); mContext.registerReceiver(mReceiver, new IntentFilter(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION)); } } /** /** * Make sure the caller has the READ_PHONE_STATE permission. * Make sure the caller has the READ_PHONE_STATE permission. * * Loading Loading @@ -788,6 +745,34 @@ public class SubscriptionController extends ISub.Stub { return 0; return 0; } } public void setPlmnSpn(int slotId, boolean showPlmn, String plmn, boolean showSpn, String spn) { if (mContext.getPackageManager().resolveContentProvider( SubscriptionManager.CONTENT_URI.getAuthority(), 0) == null) { // No place to store this info, we are done. // TODO: This can be removed once SubscriptionController is not running on devices // that don't need it, such as TVs. return; } String carrierText = ""; if (showPlmn) { carrierText = plmn; if (showSpn) { // Need to show both plmn and spn. String separator = mContext.getString( com.android.internal.R.string.kg_text_message_separator).toString(); carrierText = new StringBuilder().append(carrierText).append(separator).append(spn) .toString(); } } else if (showSpn) { carrierText = spn; } int[] subIds = getSubId(slotId); for (int i = 0; i < subIds.length; i++) { setCarrierText(carrierText, subIds[i]); } } /** /** * Set carrier text by simInfo index * Set carrier text by simInfo index * @param text new carrier text * @param text new carrier text Loading src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -588,6 +588,9 @@ public class CdmaServiceStateTracker extends ServiceStateTracker { intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn); intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL); mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL); mSubscriptionController.setPlmnSpn(mPhone.getPhoneId(), showPlmn, plmn, false, ""); } } mCurPlmn = plmn; mCurPlmn = plmn; Loading src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -672,6 +672,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker { intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn); intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL); mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL); mSubscriptionController.setPlmnSpn(mPhone.getPhoneId(), showPlmn, plmn, showSpn, spn); } } mCurShowSpn = showSpn; mCurShowSpn = showSpn; Loading Loading
src/java/com/android/internal/telephony/ServiceStateTracker.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -227,6 +227,7 @@ public abstract class ServiceStateTracker extends Handler { private boolean mImsRegistered = false; private boolean mImsRegistered = false; protected SubscriptionManager mSubscriptionManager; protected SubscriptionManager mSubscriptionManager; protected SubscriptionController mSubscriptionController; protected final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener = protected final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener = new OnSubscriptionsChangedListener() { new OnSubscriptionsChangedListener() { private int previousSubId = -1; // < 0 is invalid subId private int previousSubId = -1; // < 0 is invalid subId Loading Loading @@ -292,6 +293,7 @@ public abstract class ServiceStateTracker extends Handler { mCi.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null); mCi.setOnSignalStrengthUpdate(this, EVENT_SIGNAL_STRENGTH_UPDATE, null); mCi.registerForCellInfoList(this, EVENT_UNSOL_CELL_INFO_LIST, null); mCi.registerForCellInfoList(this, EVENT_UNSOL_CELL_INFO_LIST, null); mSubscriptionController = SubscriptionController.getInstance(); mSubscriptionManager = SubscriptionManager.from(phoneBase.getContext()); mSubscriptionManager = SubscriptionManager.from(phoneBase.getContext()); mSubscriptionManager mSubscriptionManager .registerOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener); .registerOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener); Loading
src/java/com/android/internal/telephony/SubscriptionController.java +28 −43 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.internal.telephony; package com.android.internal.telephony; import android.content.BroadcastReceiver; import android.content.ContentProviderClient; import android.content.ContentProviderClient; import android.content.ContentResolver; import android.content.ContentResolver; import android.content.ContentValues; import android.content.ContentValues; Loading Loading @@ -159,33 +158,6 @@ public class SubscriptionController extends ISub.Stub { } } }; }; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (DBG) logd("onReceive " + intent); // TODO: Have GsmServiceStateTracker insert this data directly and deprecate // this broadcast. int subId = intent.getIntExtra(PhoneConstants.SUBSCRIPTION_KEY, SubscriptionManager.INVALID_SUBSCRIPTION_ID); if (intent.getAction().equals(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION)) { if (intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_PLMN, false)) { String carrierText = intent.getStringExtra(TelephonyIntents.EXTRA_PLMN); if (intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false)) { // Need to show both plmn and spn. String separator = mContext.getString( com.android.internal.R.string.kg_text_message_separator).toString(); carrierText = new StringBuilder().append(carrierText).append(separator) .append(intent.getStringExtra(TelephonyIntents.EXTRA_SPN)) .toString(); } setCarrierText(carrierText, subId); } else if (intent.getBooleanExtra(TelephonyIntents.EXTRA_SHOW_SPN, false)) { setCarrierText(intent.getStringExtra(TelephonyIntents.EXTRA_PLMN), subId); } } } }; public static SubscriptionController init(Phone phone) { public static SubscriptionController init(Phone phone) { synchronized (SubscriptionController.class) { synchronized (SubscriptionController.class) { if (sInstance == null) { if (sInstance == null) { Loading Loading @@ -225,7 +197,6 @@ public class SubscriptionController extends ISub.Stub { if(ServiceManager.getService("isub") == null) { if(ServiceManager.getService("isub") == null) { ServiceManager.addService("isub", this); ServiceManager.addService("isub", this); } } registerReceiverIfNeeded(); if (DBG) logdl("[SubscriptionController] init by Context"); if (DBG) logdl("[SubscriptionController] init by Context"); } } Loading @@ -241,24 +212,10 @@ public class SubscriptionController extends ISub.Stub { if(ServiceManager.getService("isub") == null) { if(ServiceManager.getService("isub") == null) { ServiceManager.addService("isub", this); ServiceManager.addService("isub", this); } } registerReceiverIfNeeded(); if (DBG) logdl("[SubscriptionController] init by Phone"); if (DBG) logdl("[SubscriptionController] init by Phone"); } } private void registerReceiverIfNeeded() { // We only need to register the broadcast receiver if the URI // where we are going to store the data is valid. // TODO: This can be removed once the SubscriptionController is not running // on devices that don't need it, such as TVs. if (mContext.getPackageManager().resolveContentProvider( SubscriptionManager.CONTENT_URI.getAuthority(), 0) != null) { if (DBG) logd("registering SPN updated receiver"); mContext.registerReceiver(mReceiver, new IntentFilter(TelephonyIntents.SPN_STRINGS_UPDATED_ACTION)); } } /** /** * Make sure the caller has the READ_PHONE_STATE permission. * Make sure the caller has the READ_PHONE_STATE permission. * * Loading Loading @@ -788,6 +745,34 @@ public class SubscriptionController extends ISub.Stub { return 0; return 0; } } public void setPlmnSpn(int slotId, boolean showPlmn, String plmn, boolean showSpn, String spn) { if (mContext.getPackageManager().resolveContentProvider( SubscriptionManager.CONTENT_URI.getAuthority(), 0) == null) { // No place to store this info, we are done. // TODO: This can be removed once SubscriptionController is not running on devices // that don't need it, such as TVs. return; } String carrierText = ""; if (showPlmn) { carrierText = plmn; if (showSpn) { // Need to show both plmn and spn. String separator = mContext.getString( com.android.internal.R.string.kg_text_message_separator).toString(); carrierText = new StringBuilder().append(carrierText).append(separator).append(spn) .toString(); } } else if (showSpn) { carrierText = spn; } int[] subIds = getSubId(slotId); for (int i = 0; i < subIds.length; i++) { setCarrierText(carrierText, subIds[i]); } } /** /** * Set carrier text by simInfo index * Set carrier text by simInfo index * @param text new carrier text * @param text new carrier text Loading
src/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -588,6 +588,9 @@ public class CdmaServiceStateTracker extends ServiceStateTracker { intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn); intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL); mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL); mSubscriptionController.setPlmnSpn(mPhone.getPhoneId(), showPlmn, plmn, false, ""); } } mCurPlmn = plmn; mCurPlmn = plmn; Loading
src/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -672,6 +672,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker { intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn); intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL); mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL); mSubscriptionController.setPlmnSpn(mPhone.getPhoneId(), showPlmn, plmn, showSpn, spn); } } mCurShowSpn = showSpn; mCurShowSpn = showSpn; Loading