/* Intentionally private for singleton */ private CatService( CommandsInterface ci, UiccCardApplication ca, IccRecords ir, Context context, IccFileHandler fh, UiccCard ic) { if (ci == null || ca == null || ir == null || context == null || fh == null || ic == null) { throw new NullPointerException("Service: Input parameters must not be null"); } mCmdIf = ci; mContext = context; // Get the RilMessagesDecoder for decoding the messages. mMsgDecoder = RilMessageDecoder.getInstance(this, fh); // Register ril events handling. mCmdIf.setOnCatSessionEnd(this, MSG_ID_SESSION_END, null); mCmdIf.setOnCatProactiveCmd(this, MSG_ID_PROACTIVE_COMMAND, null); mCmdIf.setOnCatEvent(this, MSG_ID_EVENT_NOTIFY, null); mCmdIf.setOnCatCallSetUp(this, MSG_ID_CALL_SETUP, null); // mCmdIf.setOnSimRefresh(this, MSG_ID_REFRESH, null); mIccRecords = ir; mUiccApplication = ca; // Register for SIM ready event. mUiccApplication.registerForReady(this, MSG_ID_SIM_READY, null); mIccRecords.registerForRecordsLoaded(this, MSG_ID_ICC_RECORDS_LOADED, null); // Check if STK application is availalbe mStkAppInstalled = isStkAppInstalled(); CatLog.d(this, "Running CAT service. STK app installed:" + mStkAppInstalled); }
/* For multisim catservice should not be singleton */ CatService(CommandsInterface ci, Context context, IccFileHandler fh, int slotId) { if (ci == null || context == null || fh == null) { throw new NullPointerException("Service: Input parameters must not be null"); } mCmdIf = ci; mContext = context; mSlotId = slotId; mHandlerThread = new HandlerThread("Cat Telephony service" + slotId); mHandlerThread.start(); // Get the RilMessagesDecoder for decoding the messages. mMsgDecoder = RilMessageDecoder.getInstance(this, fh, slotId); if (null == mMsgDecoder) { CatLog.d(this, "Null RilMessageDecoder instance"); return; } mMsgDecoder.start(); // Register ril events handling. mCmdIf.setOnCatSessionEnd(this, MSG_ID_SESSION_END, null); mCmdIf.setOnCatProactiveCmd(this, MSG_ID_PROACTIVE_COMMAND, null); mCmdIf.setOnCatEvent(this, MSG_ID_EVENT_NOTIFY, null); mCmdIf.setOnCatCallSetUp(this, MSG_ID_CALL_SETUP, null); mCmdIf.setOnCatSendSmsResult(this, MSG_ID_SEND_SMS_RESULT, null); // Samsung STK // mCmdIf.setOnSimRefresh(this, MSG_ID_REFRESH, null); mCmdIf.registerForIccRefresh(this, MSG_ID_ICC_REFRESH, null); mCmdIf.setOnCatCcAlphaNotify(this, MSG_ID_ALPHA_NOTIFY, null); mUiccController = UiccController.getInstance(); mUiccController.registerForIccChanged(this, MSG_ID_ICC_CHANGED, null); // Check if STK application is availalbe mStkAppInstalled = isStkAppInstalled(); CatLog.d( this, "Running CAT service on Slotid: " + mSlotId + ". STK app installed:" + mStkAppInstalled); }