/** * This function creates a single instance of this class * * @return object of type CdmaSubscriptionSourceManager */ public static CdmaSubscriptionSourceManager getInstance( Context context, CommandsInterface ci, Handler h, int what, Object obj) { synchronized (sReferenceCountMonitor) { if (null == sInstance) { sInstance = new CdmaSubscriptionSourceManager(context, ci); } sInstance.sReferenceCount++; } sInstance.registerForCdmaSubscriptionSourceChanged(h, what, obj); return sInstance; }
CdmaDataProfileTracker(CDMAPhone phone) { mPhone = phone; mCdmaSsm = CdmaSubscriptionSourceManager.getInstance( phone.getContext(), phone.mCM, this, EVENT_LOAD_PROFILES, null); mOmhServicePriorityMap = new HashMap<String, Integer>(); sendMessage(obtainMessage(EVENT_LOAD_PROFILES)); log("SUPPORT_OMH: " + mIsOmhEnabled); }
private String getOperatorNumeric() { String result = null; CdmaDataConnectionTracker cdmaDct = (CdmaDataConnectionTracker) (mPhone.mDataConnectionTracker); if (mCdmaSsm.getCdmaSubscriptionSource() == CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_NV) { result = SystemProperties.get(CDMAPhone.PROPERTY_CDMA_HOME_OPERATOR_NUMERIC); log("operatorNumeric for NV " + result); } else if (cdmaDct.getIccRecords() != null) { result = cdmaDct.getIccRecords().getOperatorNumeric(); log("operatorNumeric for icc " + result); } else { log("IccRecords == null -> operatorNumeric = null"); } return result; }
/** FIXME replace this with some other way of making these instances */ public static void makeDefaultPhone(Context context) { synchronized (sLockProxyPhones) { if (!sMadeDefaults) { sContext = context; // create the telephony device controller. TelephonyDevController.create(); int retryCount = 0; for (; ; ) { boolean hasException = false; retryCount++; try { // use UNIX domain socket to // prevent subsequent initialization new LocalServerSocket("com.android.internal.telephony"); } catch (java.io.IOException ex) { hasException = true; } if (!hasException) { break; } else if (retryCount > SOCKET_OPEN_MAX_RETRY) { throw new RuntimeException("PhoneFactory probably already running"); } else { try { Thread.sleep(SOCKET_OPEN_RETRY_MILLIS); } catch (InterruptedException er) { } } } sPhoneNotifier = new DefaultPhoneNotifier(); int cdmaSubscription = CdmaSubscriptionSourceManager.getDefault(context); Rlog.i(LOG_TAG, "Cdma Subscription set to " + cdmaSubscription); /* In case of multi SIM mode two instances of PhoneProxy, RIL are created, where as in single SIM mode only instance. isMultiSimEnabled() function checks whether it is single SIM or multi SIM mode */ int numPhones = TelephonyManager.getDefault().getPhoneCount(); int[] networkModes = new int[numPhones]; sProxyPhones = new PhoneProxy[numPhones]; sCommandsInterfaces = new RIL[numPhones]; for (int i = 0; i < numPhones; i++) { // reads the system properties and makes commandsinterface // Get preferred network type. networkModes[i] = RILConstants.PREFERRED_NETWORK_MODE; Rlog.i(LOG_TAG, "Network Mode set to " + Integer.toString(networkModes[i])); sCommandsInterfaces[i] = new RIL(context, networkModes[i], cdmaSubscription, i); } Rlog.i(LOG_TAG, "Creating SubscriptionController"); SubscriptionController.init(context, sCommandsInterfaces); // Instantiate UiccController so that all other classes can just // call getInstance() mUiccController = UiccController.make(context, sCommandsInterfaces); for (int i = 0; i < numPhones; i++) { PhoneBase phone = null; int phoneType = TelephonyManager.getPhoneType(networkModes[i]); if (phoneType == PhoneConstants.PHONE_TYPE_GSM) { phone = new GSMPhone(context, sCommandsInterfaces[i], sPhoneNotifier, i); } else if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) { phone = new CDMALTEPhone(context, sCommandsInterfaces[i], sPhoneNotifier, i); } Rlog.i(LOG_TAG, "Creating Phone with type = " + phoneType + " sub = " + i); sProxyPhones[i] = new PhoneProxy(phone); } mProxyController = ProxyController.getInstance( context, sProxyPhones, mUiccController, sCommandsInterfaces); // Set the default phone in base class. // FIXME: This is a first best guess at what the defaults will be. It // FIXME: needs to be done in a more controlled manner in the future. sProxyPhone = sProxyPhones[0]; sCommandsInterface = sCommandsInterfaces[0]; // Ensure that we have a default SMS app. Requesting the app with // updateIfNeeded set to true is enough to configure a default SMS app. ComponentName componentName = SmsApplication.getDefaultSmsApplication(context, true /* updateIfNeeded */); String packageName = "NONE"; if (componentName != null) { packageName = componentName.getPackageName(); } Rlog.i(LOG_TAG, "defaultSmsApplication: " + packageName); // Set up monitor to watch for changes to SMS packages SmsApplication.initSmsPackageMonitor(context); sMadeDefaults = true; Rlog.i(LOG_TAG, "Creating SubInfoRecordUpdater "); sSubInfoRecordUpdater = new SubscriptionInfoUpdater(context, sProxyPhones, sCommandsInterfaces); SubscriptionController.getInstance().updatePhonesAvailability(sProxyPhones); // Start monitoring after defaults have been made. // Default phone must be ready before ImsPhone is created // because ImsService might need it when it is being opened. for (int i = 0; i < numPhones; i++) { sProxyPhones[i].startMonitoringImsService(); } } } }