Loading src/java/com/android/internal/telephony/MultiSimSettingController.java +16 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; import android.os.ParcelUuid; Loading Loading @@ -79,6 +80,7 @@ public class MultiSimSettingController extends Handler { private static final int EVENT_SUBSCRIPTION_GROUP_CHANGED = 5; private static final int EVENT_DEFAULT_DATA_SUBSCRIPTION_CHANGED = 6; private static final int EVENT_CARRIER_CONFIG_CHANGED = 7; private static final int EVENT_MULTI_SIM_CONFIG_CHANGED = 8; @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"PRIMARY_SUB_"}, Loading Loading @@ -188,6 +190,9 @@ public class MultiSimSettingController extends Handler { mCarrierConfigLoadedSubIds = new int[phoneCount]; Arrays.fill(mCarrierConfigLoadedSubIds, SubscriptionManager.INVALID_SUBSCRIPTION_ID); PhoneConfigurationManager.registerForMultiSimConfigChange( this, EVENT_MULTI_SIM_CONFIG_CHANGED, null); context.registerReceiver(mIntentReceiver, new IntentFilter( CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)); } Loading Loading @@ -268,6 +273,9 @@ public class MultiSimSettingController extends Handler { int subId = msg.arg2; onCarrierConfigChanged(phoneId, subId); break; case EVENT_MULTI_SIM_CONFIG_CHANGED: int activeModems = (int) ((AsyncResult) msg.obj).result; onMultiSimConfigChanged(activeModems); } } Loading Loading @@ -358,6 +366,14 @@ public class MultiSimSettingController extends Handler { return true; } private void onMultiSimConfigChanged(int activeModems) { // Clear mCarrierConfigLoadedSubIds. Other actions will responds to active // subscription change. for (int phoneId = activeModems; phoneId < mCarrierConfigLoadedSubIds.length; phoneId++) { mCarrierConfigLoadedSubIds[phoneId] = INVALID_SUBSCRIPTION_ID; } } /** * Wait for subInfo initialization (after boot up) and carrier config load for all active * subscriptions before re-evaluate multi SIM settings. Loading src/java/com/android/internal/telephony/ProxyController.java +4 −3 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.telephony.RadioAccessFamily; import android.telephony.Rlog; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.Log; Loading Loading @@ -151,7 +152,7 @@ public class ProxyController { public void registerForAllDataDisconnected(int subId, Handler h, int what) { int phoneId = SubscriptionController.getInstance().getPhoneId(subId); if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount()) { if (SubscriptionManager.isValidPhoneId(phoneId)) { mPhones[phoneId].registerForAllDataDisconnected(h, what); } } Loading @@ -159,7 +160,7 @@ public class ProxyController { public void unregisterForAllDataDisconnected(int subId, Handler h) { int phoneId = SubscriptionController.getInstance().getPhoneId(subId); if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount()) { if (SubscriptionManager.isValidPhoneId(phoneId)) { mPhones[phoneId].unregisterForAllDataDisconnected(h); } } Loading @@ -168,7 +169,7 @@ public class ProxyController { public boolean areAllDataDisconnected(int subId) { int phoneId = SubscriptionController.getInstance().getPhoneId(subId); if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount()) { if (SubscriptionManager.isValidPhoneId(phoneId)) { return mPhones[phoneId].areAllDataDisconnected(); } else { // if we can't find a phone for the given subId, it is disconnected. Loading src/java/com/android/internal/telephony/SubscriptionController.java +4 −9 Original line number Diff line number Diff line Loading @@ -1331,17 +1331,12 @@ public class SubscriptionController extends ISub.Stub { if (DBG) logdl("[clearSubInfoRecord]+ iccId:" + " slotIndex:" + slotIndex); // update simInfo db with invalid slot index List<SubscriptionInfo> oldSubInfo = getSubInfoUsingSlotIndexPrivileged(slotIndex); ContentResolver resolver = mContext.getContentResolver(); ContentValues value = new ContentValues(1); value.put(SubscriptionManager.SIM_SLOT_INDEX, SubscriptionManager.INVALID_SIM_SLOT_INDEX); if (oldSubInfo != null) { for (int i = 0; i < oldSubInfo.size(); i++) { resolver.update(SubscriptionManager.getUriForSubscriptionId( oldSubInfo.get(i).getSubscriptionId()), value, null, null); } } value.put(SubscriptionManager.SIM_SLOT_INDEX, SubscriptionManager.INVALID_SIM_SLOT_INDEX); String where = "(" + SubscriptionManager.SIM_SLOT_INDEX + "=" + slotIndex + ")"; resolver.update(SubscriptionManager.CONTENT_URI, value, where, null); // Refresh the Cache of Active Subscription Info List refreshCachedActiveSubscriptionInfoList(); Loading src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +23 −5 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ import java.util.List; public class SubscriptionInfoUpdater extends Handler { private static final String LOG_TAG = "SubscriptionInfoUpdater"; @UnsupportedAppUsage private static final int PROJECT_SIM_NUM = TelephonyManager.getDefault() private static final int SUPPORTED_MODEM_COUNT = TelephonyManager.getDefault() .getSupportedModemCount(); private static final boolean DBG = true; Loading @@ -94,6 +94,7 @@ public class SubscriptionInfoUpdater extends Handler { private static final int EVENT_SIM_READY = 10; private static final int EVENT_SIM_IMSI = 11; private static final int EVENT_REFRESH_EMBEDDED_SUBSCRIPTIONS = 12; private static final int EVENT_MULTI_SIM_CONFIG_CHANGED = 13; private static final String ICCID_STRING_FOR_NO_SIM = ""; Loading @@ -107,9 +108,9 @@ public class SubscriptionInfoUpdater extends Handler { private static Context sContext = null; @UnsupportedAppUsage private static String[] sIccId = new String[PROJECT_SIM_NUM]; private static int[] sSimCardState = new int[PROJECT_SIM_NUM]; private static int[] sSimApplicationState = new int[PROJECT_SIM_NUM]; private static String[] sIccId = new String[SUPPORTED_MODEM_COUNT]; private static int[] sSimCardState = new int[SUPPORTED_MODEM_COUNT]; private static int[] sSimApplicationState = new int[SUPPORTED_MODEM_COUNT]; private static boolean sIsSubInfoInitialized = false; private SubscriptionManager mSubscriptionManager = null; private EuiccManager mEuiccManager; Loading Loading @@ -155,6 +156,9 @@ public class SubscriptionInfoUpdater extends Handler { mCarrierServiceBindHelper = new CarrierServiceBindHelper(sContext); initializeCarrierApps(); PhoneConfigurationManager.registerForMultiSimConfigChange( this, EVENT_MULTI_SIM_CONFIG_CHANGED, null); } private void initializeCarrierApps() { Loading Loading @@ -224,7 +228,7 @@ public class SubscriptionInfoUpdater extends Handler { @UnsupportedAppUsage private boolean isAllIccIdQueryDone() { for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) { for (int i = 0; i < TelephonyManager.getDefault().getActiveModemCount(); i++) { UiccSlot slot = UiccController.getInstance().getUiccSlotForPhone(i); int slotId = UiccController.getInstance().getSlotIdFromPhoneId(i); if (sIccId[i] == null || slot == null || !slot.isActive()) { Loading Loading @@ -336,11 +340,25 @@ public class SubscriptionInfoUpdater extends Handler { }); break; case EVENT_MULTI_SIM_CONFIG_CHANGED: onMultiSimConfigChanged(); default: logd("Unknown msg:" + msg.what); } } private void onMultiSimConfigChanged() { int activeModemCount = ((TelephonyManager) sContext.getSystemService( Context.TELEPHONY_SERVICE)).getActiveModemCount(); // For inactive modems, reset its states. for (int phoneId = activeModemCount; phoneId < SUPPORTED_MODEM_COUNT; phoneId++) { SubscriptionController.getInstance().clearSubInfoRecord(phoneId); sIccId[phoneId] = null; sSimCardState[phoneId] = TelephonyManager.SIM_STATE_UNKNOWN; sSimApplicationState[phoneId] = TelephonyManager.SIM_STATE_UNKNOWN; } } private int getCardIdFromPhoneId(int phoneId) { UiccController uiccController = UiccController.getInstance(); UiccCard card = uiccController.getUiccCardForPhone(phoneId); Loading src/java/com/android/internal/telephony/cat/AppInterface.java +5 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,11 @@ public interface AppInterface { */ void onCmdResponse(CatResponseMessage resMsg); /** * Dispose when the service is not longer needed. */ void dispose(); /* * Enumeration for representing "Type of Command" of proactive commands. * Those are the only commands which are supported by the Telephony. Any app Loading Loading
src/java/com/android/internal/telephony/MultiSimSettingController.java +16 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; import android.os.ParcelUuid; Loading Loading @@ -79,6 +80,7 @@ public class MultiSimSettingController extends Handler { private static final int EVENT_SUBSCRIPTION_GROUP_CHANGED = 5; private static final int EVENT_DEFAULT_DATA_SUBSCRIPTION_CHANGED = 6; private static final int EVENT_CARRIER_CONFIG_CHANGED = 7; private static final int EVENT_MULTI_SIM_CONFIG_CHANGED = 8; @Retention(RetentionPolicy.SOURCE) @IntDef(prefix = {"PRIMARY_SUB_"}, Loading Loading @@ -188,6 +190,9 @@ public class MultiSimSettingController extends Handler { mCarrierConfigLoadedSubIds = new int[phoneCount]; Arrays.fill(mCarrierConfigLoadedSubIds, SubscriptionManager.INVALID_SUBSCRIPTION_ID); PhoneConfigurationManager.registerForMultiSimConfigChange( this, EVENT_MULTI_SIM_CONFIG_CHANGED, null); context.registerReceiver(mIntentReceiver, new IntentFilter( CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)); } Loading Loading @@ -268,6 +273,9 @@ public class MultiSimSettingController extends Handler { int subId = msg.arg2; onCarrierConfigChanged(phoneId, subId); break; case EVENT_MULTI_SIM_CONFIG_CHANGED: int activeModems = (int) ((AsyncResult) msg.obj).result; onMultiSimConfigChanged(activeModems); } } Loading Loading @@ -358,6 +366,14 @@ public class MultiSimSettingController extends Handler { return true; } private void onMultiSimConfigChanged(int activeModems) { // Clear mCarrierConfigLoadedSubIds. Other actions will responds to active // subscription change. for (int phoneId = activeModems; phoneId < mCarrierConfigLoadedSubIds.length; phoneId++) { mCarrierConfigLoadedSubIds[phoneId] = INVALID_SUBSCRIPTION_ID; } } /** * Wait for subInfo initialization (after boot up) and carrier config load for all active * subscriptions before re-evaluate multi SIM settings. Loading
src/java/com/android/internal/telephony/ProxyController.java +4 −3 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.os.PowerManager; import android.os.PowerManager.WakeLock; import android.telephony.RadioAccessFamily; import android.telephony.Rlog; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.Log; Loading Loading @@ -151,7 +152,7 @@ public class ProxyController { public void registerForAllDataDisconnected(int subId, Handler h, int what) { int phoneId = SubscriptionController.getInstance().getPhoneId(subId); if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount()) { if (SubscriptionManager.isValidPhoneId(phoneId)) { mPhones[phoneId].registerForAllDataDisconnected(h, what); } } Loading @@ -159,7 +160,7 @@ public class ProxyController { public void unregisterForAllDataDisconnected(int subId, Handler h) { int phoneId = SubscriptionController.getInstance().getPhoneId(subId); if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount()) { if (SubscriptionManager.isValidPhoneId(phoneId)) { mPhones[phoneId].unregisterForAllDataDisconnected(h); } } Loading @@ -168,7 +169,7 @@ public class ProxyController { public boolean areAllDataDisconnected(int subId) { int phoneId = SubscriptionController.getInstance().getPhoneId(subId); if (phoneId >= 0 && phoneId < TelephonyManager.getDefault().getSupportedModemCount()) { if (SubscriptionManager.isValidPhoneId(phoneId)) { return mPhones[phoneId].areAllDataDisconnected(); } else { // if we can't find a phone for the given subId, it is disconnected. Loading
src/java/com/android/internal/telephony/SubscriptionController.java +4 −9 Original line number Diff line number Diff line Loading @@ -1331,17 +1331,12 @@ public class SubscriptionController extends ISub.Stub { if (DBG) logdl("[clearSubInfoRecord]+ iccId:" + " slotIndex:" + slotIndex); // update simInfo db with invalid slot index List<SubscriptionInfo> oldSubInfo = getSubInfoUsingSlotIndexPrivileged(slotIndex); ContentResolver resolver = mContext.getContentResolver(); ContentValues value = new ContentValues(1); value.put(SubscriptionManager.SIM_SLOT_INDEX, SubscriptionManager.INVALID_SIM_SLOT_INDEX); if (oldSubInfo != null) { for (int i = 0; i < oldSubInfo.size(); i++) { resolver.update(SubscriptionManager.getUriForSubscriptionId( oldSubInfo.get(i).getSubscriptionId()), value, null, null); } } value.put(SubscriptionManager.SIM_SLOT_INDEX, SubscriptionManager.INVALID_SIM_SLOT_INDEX); String where = "(" + SubscriptionManager.SIM_SLOT_INDEX + "=" + slotIndex + ")"; resolver.update(SubscriptionManager.CONTENT_URI, value, where, null); // Refresh the Cache of Active Subscription Info List refreshCachedActiveSubscriptionInfoList(); Loading
src/java/com/android/internal/telephony/SubscriptionInfoUpdater.java +23 −5 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ import java.util.List; public class SubscriptionInfoUpdater extends Handler { private static final String LOG_TAG = "SubscriptionInfoUpdater"; @UnsupportedAppUsage private static final int PROJECT_SIM_NUM = TelephonyManager.getDefault() private static final int SUPPORTED_MODEM_COUNT = TelephonyManager.getDefault() .getSupportedModemCount(); private static final boolean DBG = true; Loading @@ -94,6 +94,7 @@ public class SubscriptionInfoUpdater extends Handler { private static final int EVENT_SIM_READY = 10; private static final int EVENT_SIM_IMSI = 11; private static final int EVENT_REFRESH_EMBEDDED_SUBSCRIPTIONS = 12; private static final int EVENT_MULTI_SIM_CONFIG_CHANGED = 13; private static final String ICCID_STRING_FOR_NO_SIM = ""; Loading @@ -107,9 +108,9 @@ public class SubscriptionInfoUpdater extends Handler { private static Context sContext = null; @UnsupportedAppUsage private static String[] sIccId = new String[PROJECT_SIM_NUM]; private static int[] sSimCardState = new int[PROJECT_SIM_NUM]; private static int[] sSimApplicationState = new int[PROJECT_SIM_NUM]; private static String[] sIccId = new String[SUPPORTED_MODEM_COUNT]; private static int[] sSimCardState = new int[SUPPORTED_MODEM_COUNT]; private static int[] sSimApplicationState = new int[SUPPORTED_MODEM_COUNT]; private static boolean sIsSubInfoInitialized = false; private SubscriptionManager mSubscriptionManager = null; private EuiccManager mEuiccManager; Loading Loading @@ -155,6 +156,9 @@ public class SubscriptionInfoUpdater extends Handler { mCarrierServiceBindHelper = new CarrierServiceBindHelper(sContext); initializeCarrierApps(); PhoneConfigurationManager.registerForMultiSimConfigChange( this, EVENT_MULTI_SIM_CONFIG_CHANGED, null); } private void initializeCarrierApps() { Loading Loading @@ -224,7 +228,7 @@ public class SubscriptionInfoUpdater extends Handler { @UnsupportedAppUsage private boolean isAllIccIdQueryDone() { for (int i = 0; i < TelephonyManager.getDefault().getPhoneCount(); i++) { for (int i = 0; i < TelephonyManager.getDefault().getActiveModemCount(); i++) { UiccSlot slot = UiccController.getInstance().getUiccSlotForPhone(i); int slotId = UiccController.getInstance().getSlotIdFromPhoneId(i); if (sIccId[i] == null || slot == null || !slot.isActive()) { Loading Loading @@ -336,11 +340,25 @@ public class SubscriptionInfoUpdater extends Handler { }); break; case EVENT_MULTI_SIM_CONFIG_CHANGED: onMultiSimConfigChanged(); default: logd("Unknown msg:" + msg.what); } } private void onMultiSimConfigChanged() { int activeModemCount = ((TelephonyManager) sContext.getSystemService( Context.TELEPHONY_SERVICE)).getActiveModemCount(); // For inactive modems, reset its states. for (int phoneId = activeModemCount; phoneId < SUPPORTED_MODEM_COUNT; phoneId++) { SubscriptionController.getInstance().clearSubInfoRecord(phoneId); sIccId[phoneId] = null; sSimCardState[phoneId] = TelephonyManager.SIM_STATE_UNKNOWN; sSimApplicationState[phoneId] = TelephonyManager.SIM_STATE_UNKNOWN; } } private int getCardIdFromPhoneId(int phoneId) { UiccController uiccController = UiccController.getInstance(); UiccCard card = uiccController.getUiccCardForPhone(phoneId); Loading
src/java/com/android/internal/telephony/cat/AppInterface.java +5 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,11 @@ public interface AppInterface { */ void onCmdResponse(CatResponseMessage resMsg); /** * Dispose when the service is not longer needed. */ void dispose(); /* * Enumeration for representing "Type of Command" of proactive commands. * Those are the only commands which are supported by the Telephony. Any app Loading