{"id":276894,"date":"2016-03-24T16:21:02","date_gmt":"2016-03-24T13:21:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=276894"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=276894","title":{"rendered":"\u042d\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 SIM-\u043a\u043e\u043c\u0430\u043d\u0434 \u0447\u0435\u0440\u0435\u0437 SIM Toolkit \u043d\u0430 Android 5.1 \u0438 \u043d\u0438\u0436\u0435 (CVE-2015-3843)"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d23\/059\/429\/d230594295bd46fdb722f53352aa3496.jpg\"\/><\/p>\n<p>  \u042f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u044d\u0442\u0443 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c, \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0431\u0430\u043d\u043a\u043e\u043c \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443 \u0442\u0435\u043b\u0435\u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u0443\u0433, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u043b\u0438 \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 SIM-\u043a\u0430\u0440\u0442\u044b \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Android.<a name=\"habracut\"><\/a><\/p>\n<h4>\u041f\u0435\u0440\u0435\u0445\u0432\u0430\u0442<\/h4>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0447\u0442\u043e \u043d\u0430 SIM-\u043a\u0430\u0440\u0442\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0441\u0432\u044f\u0437\u0438 \u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0432\u0430\u0448\u0435\u0433\u043e Android-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0415\u0441\u043b\u0438 \u043f\u043e\u043a\u043e\u043f\u0430\u0442\u044c\u0441\u044f \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 Android, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0442\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u043b\u0430\u0441\u0441 <a href=\"https:\/\/android.googlesource.com\/platform\/frameworks\/opt\/telephony\/+\/android-5.1.0_r5\/src\/java\/com\/android\/internal\/telephony\/cat\/CatService.java\">com.android.internal.telephony.cat.CatService<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u043a\u043e\u043c\u0430\u043d\u0434 \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u043e\u0435\u043c \u0440\u0430\u0434\u0438\u043e\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 (Radio Interface Layer, RIL) \u0438 \u041e\u0421.<\/p>\n<pre><code class=\"cs\">public void handleMessage(Message msg) {         CatLog.d(this, &quot;handleMessage[&quot; + msg.what + &quot;]&quot;);         switch (msg.what) {         case MSG_ID_SESSION_END:         case MSG_ID_PROACTIVE_COMMAND:         case MSG_ID_EVENT_NOTIFY:         case MSG_ID_REFRESH:             CatLog.d(this, &quot;ril message arrived,slotid:&quot; + mSlotId);             String data = null;             if (msg.obj != null) {                 AsyncResult ar = (AsyncResult) msg.obj;                 if (ar != null && ar.result != null) {                     try {                         data = (String) ar.result;                     } catch (ClassCastException e) {                         break;                     }                 }             }             mMsgDecoder.sendStartDecodingMessageParams(new RilMessage(msg.what, data));             break;         case MSG_ID_CALL_SETUP:             mMsgDecoder.sendStartDecodingMessageParams(new RilMessage(msg.what, null));             break;         case MSG_ID_ICC_RECORDS_LOADED:             break;         case MSG_ID_RIL_MSG_DECODED:             handleRilMsg((RilMessage) msg.obj);             break;         case MSG_ID_RESPONSE:             handleCmdResponse((CatResponseMessage) msg.obj);             break; <\/code><\/pre>\n<p>  \u0418\u0437 \u0432\u0441\u0435\u0445 \u0442\u0438\u043f\u043e\u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 <code>MSG_ID_RIL_MSG_DECODED<\/code>.<\/p>\n<pre><code class=\"cs\">  private void handleRilMsg(RilMessage rilMsg) {         if (rilMsg == null) {             return;         }         \/\/ dispatch messages         CommandParams cmdParams = null;         switch (rilMsg.mId) {         case MSG_ID_EVENT_NOTIFY:             if (rilMsg.mResCode == ResultCode.OK) {                 cmdParams = (CommandParams) rilMsg.mData;                 if (cmdParams != null) {                     handleCommand(cmdParams, false);                 }             }             break;         case MSG_ID_PROACTIVE_COMMAND:             try {                 cmdParams = (CommandParams) rilMsg.mData;             } catch (ClassCastException e) {                 \/\/ for error handling : cast exception                 CatLog.d(this, &quot;Fail to parse proactive command&quot;);                 \/\/ Don't send Terminal Resp if command detail is not available                 if (mCurrntCmd != null) {                     sendTerminalResponse(mCurrntCmd.mCmdDet, ResultCode.CMD_DATA_NOT_UNDERSTOOD,                                      false, 0x00, null);                 }                 break;             }             if (cmdParams != null) {                 if (rilMsg.mResCode == ResultCode.OK) {                     handleCommand(cmdParams, true);                 } else {                     \/\/ for proactive commands that couldn't be decoded                     \/\/ successfully respond with the code generated by the                     \/\/ message decoder.                     sendTerminalResponse(cmdParams.mCmdDet, rilMsg.mResCode,                             false, 0, null);                 }             }             break; <\/code><\/pre>\n<p>  \u041e\u0431\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 switch \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0442 \u043a \u0432\u044b\u0437\u043e\u0432\u0443 \u043c\u0435\u0442\u043e\u0434\u0430 <code>handleCommand()<\/code>, \u043e\u0434\u043d\u0430\u043a\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0437\u043d\u044b\u0439:<\/p>\n<ul>\n<li><code>MSG_ID_EVENT_NOTIFY<\/code> \u2014 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f;<\/li>\n<li><code>MSG_ID_PROACTIVE_COMMAND<\/code> \u2014 \u0430 \u044d\u0442\u043e, \u043a\u0430\u043a \u0440\u0430\u0437 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0442\u0440\u0435\u0431\u0443\u0435\u0442.<\/li>\n<\/ul>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a <code>handleCommand<\/code>:  <\/p>\n<pre><code class=\"cs\">     \/**      * Handles RIL_UNSOL_STK_EVENT_NOTIFY or RIL_UNSOL_STK_PROACTIVE_COMMAND command      * from RIL.      * Sends valid proactive command data to the application using intents.      * RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE will be send back if the command is      * from RIL_UNSOL_STK_PROACTIVE_COMMAND.      *\/     private void handleCommand(CommandParams cmdParams, boolean isProactiveCmd) {         CatLog.d(this, cmdParams.getCommandType().name());         CharSequence message;         CatCmdMessage cmdMsg = new CatCmdMessage(cmdParams);         switch (cmdParams.getCommandType()) {             case SET_UP_MENU:                 if (removeMenu(cmdMsg.getMenu())) {                     mMenuCmd = null;                 } else {                     mMenuCmd = cmdMsg;                 }                 sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);                 break;             case DISPLAY_TEXT:                 break;             case REFRESH:                 \/\/ ME side only handles refresh commands which meant to remove IDLE                 \/\/ MODE TEXT.                 cmdParams.mCmdDet.typeOfCommand = CommandType.SET_UP_IDLE_MODE_TEXT.value();                 break;             case SET_UP_IDLE_MODE_TEXT:                 sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);                 break;             case SET_UP_EVENT_LIST:                 if (isSupportedSetupEventCommand(cmdMsg)) {                     sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);                 } else {                     sendTerminalResponse(cmdParams.mCmdDet, ResultCode.BEYOND_TERMINAL_CAPABILITY,                             false, 0, null);                 }                 break;             case PROVIDE_LOCAL_INFORMATION:                 ResponseData resp;                 switch (cmdParams.mCmdDet.commandQualifier) {                     case CommandParamsFactory.DTTZ_SETTING:                         resp = new DTTZResponseData(null);                         sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, resp);                         break;                     case CommandParamsFactory.LANGUAGE_SETTING:                         resp = new LanguageResponseData(Locale.getDefault().getLanguage());                         sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, resp);                         break;                     default:                         sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);                 }                 \/\/ No need to start STK app here.                 return;             case LAUNCH_BROWSER:                 if ((((LaunchBrowserParams) cmdParams).mConfirmMsg.text != null)                         && (((LaunchBrowserParams) cmdParams).mConfirmMsg.text.equals(STK_DEFAULT))) {                     message = mContext.getText(com.android.internal.R.string.launchBrowserDefault);                     ((LaunchBrowserParams) cmdParams).mConfirmMsg.text = message.toString();                 }                 break;             case SELECT_ITEM:             case GET_INPUT:             case GET_INKEY:                 break;             case SEND_DTMF:             case SEND_SMS:             case SEND_SS:             case SEND_USSD:                 if ((((DisplayTextParams)cmdParams).mTextMsg.text != null)                         && (((DisplayTextParams)cmdParams).mTextMsg.text.equals(STK_DEFAULT))) {                     message = mContext.getText(com.android.internal.R.string.sending);                     ((DisplayTextParams)cmdParams).mTextMsg.text = message.toString();                 }                 break;             case PLAY_TONE:                 break;             case SET_UP_CALL:                 if ((((CallSetupParams) cmdParams).mConfirmMsg.text != null)                         && (((CallSetupParams) cmdParams).mConfirmMsg.text.equals(STK_DEFAULT))) {                     message = mContext.getText(com.android.internal.R.string.SetupCallDefault);                     ((CallSetupParams) cmdParams).mConfirmMsg.text = message.toString();                 }                 break;             case OPEN_CHANNEL:             case CLOSE_CHANNEL:             case RECEIVE_DATA:             case SEND_DATA:                 BIPClientParams cmd = (BIPClientParams) cmdParams;                 \/* Per 3GPP specification 102.223,                  * if the alpha identifier is not provided by the UICC,                  * the terminal MAY give information to the user                  * noAlphaUsrCnf defines if you need to show user confirmation or not                  *\/                 boolean noAlphaUsrCnf = false;                 try {                     noAlphaUsrCnf = mContext.getResources().getBoolean(                             com.android.internal.R.bool.config_stkNoAlphaUsrCnf);                 } catch (NotFoundException e) {                     noAlphaUsrCnf = false;                 }                 if ((cmd.mTextMsg.text == null) && (cmd.mHasAlphaId || noAlphaUsrCnf)) {                     CatLog.d(this, &quot;cmd &quot; + cmdParams.getCommandType() + &quot; with null alpha id&quot;);                     \/\/ If alpha length is zero, we just respond with OK.                     if (isProactiveCmd) {                         sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);                     } else if (cmdParams.getCommandType() == CommandType.OPEN_CHANNEL) {                         mCmdIf.handleCallSetupRequestFromSim(true, null);                     }                     return;                 }                 \/\/ Respond with permanent failure to avoid retry if STK app is not present.                 if (!mStkAppInstalled) {                     CatLog.d(this, &quot;No STK application found.&quot;);                     if (isProactiveCmd) {                         sendTerminalResponse(cmdParams.mCmdDet,                                              ResultCode.BEYOND_TERMINAL_CAPABILITY,                                              false, 0, null);                         return;                     }                 }                 \/*                  * CLOSE_CHANNEL, RECEIVE_DATA and SEND_DATA can be delivered by                  * either PROACTIVE_COMMAND or EVENT_NOTIFY.                  * If PROACTIVE_COMMAND is used for those commands, send terminal                  * response here.                  *\/                 if (isProactiveCmd &&                     ((cmdParams.getCommandType() == CommandType.CLOSE_CHANNEL) ||                      (cmdParams.getCommandType() == CommandType.RECEIVE_DATA) ||                      (cmdParams.getCommandType() == CommandType.SEND_DATA))) {                     sendTerminalResponse(cmdParams.mCmdDet, ResultCode.OK, false, 0, null);                 }                 break;             default:                 CatLog.d(this, &quot;Unsupported command&quot;);                 return;         }         mCurrntCmd = cmdMsg;         broadcastCatCmdIntent(cmdMsg); }<\/code><\/pre>\n<p>  \u0418, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, <code>broadcastCatCmdIntent()<\/code>: <\/p>\n<pre><code class=\"cs\">    private void broadcastCatCmdIntent(CatCmdMessage cmdMsg) {         Intent intent = new Intent(AppInterface.CAT_CMD_ACTION);         intent.putExtra(&quot;STK CMD&quot;, cmdMsg);         intent.putExtra(&quot;SLOT_ID&quot;, mSlotId);         CatLog.d(this, &quot;Sending CmdMsg: &quot; + cmdMsg+ &quot; on slotid:&quot; + mSlotId);         mContext.sendBroadcast(intent);     }  <\/code><\/pre>\n<p>  \u0410 \u0432\u043e\u0442 \u044d\u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u0430\u043d\u044f\u0442\u043d\u0430\u044f:<\/p>\n<ul>\n<li><code>AppInterface.CAT_CMD_ACTION<\/code> \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f <code>android.intent.action.stk.command<\/code>;<\/li>\n<li><code>SLOT_ID<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 SIM-\u043a\u0430\u0440\u0442\u0430\u043c\u0438;<\/li>\n<li><code>STK CMD<\/code> \u2014 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 <code>Parcelable<\/code>.<\/li>\n<\/ul>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e CatService \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043d\u0435\u044f\u0432\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u043d\u0442 \u0431\u0435\u0437 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0439.<\/p>\n<h5>\u041a\u0430\u043a \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u044d\u0442\u0438\u043c \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f?<\/h5>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0435\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0439, \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 SIM-\u043a\u0430\u0440\u0442\u043e\u0439 \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043b\u0438\u0448\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c receiver \u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435\u043c android.intent.action.stk.command \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c STK CMD \u0438\u0437 \u0438\u043d\u0442\u0435\u043d\u0442\u0430.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0447\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/720\/fbf\/916\/720fbf91637a42df96df0923bb088084.png\"\/><\/p>\n<p>  \u042d\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 <code>Parcelable<\/code> \u0432 \u0431\u0430\u0439\u0442\u0430\u0445. \u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0432 Hex \u0432 ASCII, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 SIM-\u043a\u0430\u0440\u0442\u044b.<\/p>\n<h4>\u042d\u043c\u0443\u043b\u044f\u0446\u0438\u044f<\/h4>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0435 \u0448\u0438\u0440\u043e\u043a\u043e\u0432\u0435\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/785\/42d\/023\/78542d023e1c46069b0a38a90046e27b.jpg\"\/><\/p>\n<p>  <i>\u0412\u0438\u0434 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f<\/i><\/p>\n<p>  \u042d\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f SIM Toolkit (STK) \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e Android-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/android.googlesource.com\/platform\/packages\/apps\/Stk\/+\/master\">\u0442\u0443\u0442<\/a>.<\/p>\n<pre><code class=\"xml\">&lt;manifest xmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;         xmlns:androidprv=&quot;http:\/\/schemas.android.com\/apk\/prv\/res\/android&quot;         package=&quot;com.android.stk&quot;         android:sharedUserId=&quot;android.uid.phone&quot;&gt;     &lt;original-package android:name=&quot;com.android.stk&quot; \/&gt;     &lt;uses-permission android:name=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot; \/&gt;     &lt;uses-permission android:name=&quot;android.permission.GET_TASKS&quot;\/&gt;     &lt;application android:icon=&quot;@drawable\/ic_launcher_sim_toolkit&quot;         android:label=&quot;@string\/app_name&quot;         android:clearTaskOnLaunch=&quot;true&quot;         android:process=&quot;com.android.phone&quot;         android:taskAffinity=&quot;android.task.stk&quot;&gt; ... &lt;receiver android:name=&quot;com.android.stk.StkCmdReceiver&quot;&gt;             &lt;intent-filter&gt;                 &lt;action android:name= &quot;android.intent.action.stk.command&quot; \/&gt;                 &lt;action android:name= &quot;android.intent.action.stk.session_end&quot; \/&gt;                 &lt;action android:name= &quot;android.intent.action.stk.icc_status_change&quot; \/&gt;                 &lt;action android:name= &quot;android.intent.action.stk.alpha_notify&quot; \/&gt;                 &lt;action android:name= &quot;android.intent.action.LOCALE_CHANGED&quot; \/&gt;             &lt;\/intent-filter&gt;         &lt;\/receiver&gt;  <\/code><\/pre>\n<p>  \u0412\u044b\u0448\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0444\u0430\u0439\u043b\u0430 <code>AndroidManifest.xml<\/code>, \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0439\u0441\u044f \u043a \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0443 <code>receiver<\/code>. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b SIM-\u043a\u0430\u0440\u0442\u044b, \u043d\u043e \u0438 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u044b\u0445 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043e\u0431\u044a\u0435\u043a\u0442 <code>Parcelable<\/code>, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043d\u0430 <code>com.android.stk.StkCmdReceiver<\/code>. <code>Receiver<\/code> \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f, \u0430 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 android.intent.action.stk.command \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 AndroidManifest.xml \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u043e\u0448\u0435\u043d\u043d\u0438\u043a\u0430\u043c \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u043a\u043e\u043c\u0430\u043d\u0434 SIM-\u043a\u0430\u0440\u0442\u044b. <\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  1. SIM-\u043a\u0430\u0440\u0442\u0430 \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u0441\u043a\u0430\u0436\u0435\u043c, \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0431\u0430\u043d\u043a\u0435, \u0432\u044b\u0432\u043e\u0434\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0442\u0438\u043f\u0430 \u00ab\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u2116 1234 \u043d\u0430 \u0441\u0443\u043c\u043c\u0443 100 500 \u0440\u0443\u0431\u043b\u0435\u0439\u00bb \u0441 \u0434\u0432\u0443\u043c\u044f \u043e\u043f\u0446\u0438\u044f\u043c\u0438 \u2014 \u00ab\u041e\u041a\u00bb \u0438 \u00ab\u041e\u0442\u043c\u0435\u043d\u0430\u00bb. \u041a\u043e\u0434 \u043d\u0430 <a href=\"https:\/\/android.googlesource.com\/platform\/packages\/apps\/Stk\/+\/master\/src\/com\/android\/stk\/StkDialogActivity.java\">StkDialogActivity.java<\/a>:<\/p>\n<pre><code class=\"cs\">    public void onClick(View v) {         String input = null;         switch (v.getId()) {         case OK_BUTTON:             CatLog.d(LOG_TAG, &quot;OK Clicked!, mSlotId: &quot; + mSlotId);             cancelTimeOut();             sendResponse(StkAppService.RES_ID_CONFIRM, true);             break;         case CANCEL_BUTTON:             CatLog.d(LOG_TAG, &quot;Cancel Clicked!, mSlotId: &quot; + mSlotId);             cancelTimeOut();             sendResponse(StkAppService.RES_ID_CONFIRM, false);             break;         }         finish();     } <\/code><\/pre>\n<p>  2. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0436\u043c\u0435\u0442 \u00ab\u041e\u041a\u00bb, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>sendResponse(StkAppService.RES_ID_CONFIRM, true)<\/code>; \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u2014 <code>sendResponse(StkAppService.RES_ID_CONFIRM, false)<\/code>;.<\/p>\n<p>  3. \u0427\u0442\u043e, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f <code>android.intent.action.stk.command<\/code> \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c (\u043f\u043e\u0434\u0434\u0435\u043b\u044c\u043d\u043e\u0435) \u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0437\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u043a\u0443\u043d\u0434 \u0434\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 SIM-\u043a\u0430\u0440\u0442\u043e\u0439 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f (\u00ab\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u2116 1234 \u043d\u0430 \u0441\u0443\u043c\u043c\u0443 100 500 \u0440\u0443\u0431\u043b\u0435\u0439\u00bb)? \u0412 \u0442\u0435\u043a\u0441\u0442\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u00ab\u041d\u0430\u0436\u043c\u0438\u0442\u0435 \u041e\u041a \u0434\u043b\u044f \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f\u00bb, \u0430 \u043a\u043d\u043e\u043f\u043a\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0442\u0435 \u0436\u0435 \u2014 \u00ab\u041e\u041a\u00bb \u0438 \u00ab\u041e\u0442\u043c\u0435\u043d\u0430\u00bb.<\/p>\n<p>  4. \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0434\u0438\u0430\u043b\u043e\u0433 \u0441 \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0432\u044b\u0431\u0435\u0440\u0435\u0442 \u043e\u0434\u043d\u0443 \u0438\u0437 \u044d\u0442\u0438\u0445 \u043e\u043f\u0446\u0438\u0439 \u0432 \u043f\u043e\u0434\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u043d\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c.\u00a0<\/p>\n<p>  5. \u0418\u0442\u0430\u043a, \u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c:<\/p>\n<ul>\n<li>SIM-\u043a\u0430\u0440\u0442\u0430 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f;<\/li>\n<li>Android \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u0435\u0440\u0432\u044b\u0439 (\u043f\u043e\u0434\u0434\u0435\u043b\u044c\u043d\u044b\u0439) \u0434\u0438\u0430\u043b\u043e\u0433.<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u043d\u0430\u0436\u0430\u0442\u044c \u00ab\u041e\u041a\u00bb, \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u043c\u0435\u0442\u043e\u0434 <code>sendResponse()<\/code> \u0441 \u0444\u043b\u0430\u0433\u043e\u043c \u00abtrue\u00bb \u0438 SIM-\u043a\u0430\u0440\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u00ab\u041e\u041a\u00bb, \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0431\u044b \u043e\u043d\u0430 \u0431\u044b\u043b\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0430 \u0438\u0437 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u0438\u0430\u043b\u043e\u0433\u0430. \u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u044b\u0431\u0435\u0440\u0435\u0442 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u043e\u043a\u043d\u0435 \u043e\u043f\u0446\u0438\u044e \u00ab\u041e\u0442\u043c\u0435\u043d\u0430\u00bb, \u044d\u0442\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443. SIM-\u043a\u0430\u0440\u0442\u0430 \u0432\u043e\u0441\u043f\u0440\u0438\u043c\u0435\u0442 \u044d\u0442\u043e \u043a\u0430\u043a \u043d\u043e\u0432\u044b\u0439 \u043e\u0442\u043a\u043b\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u043d\u0430 \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u0442. \u0412 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0439 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"cs\">    private void handleCmdResponse(CatResponseMessage resMsg) {         \/\/ Make sure the response details match the last valid command. An invalid         \/\/ response is a one that doesn't have a corresponding proactive command         \/\/ and sending it can &quot;confuse&quot; the baseband\/ril.         \/\/ One reason for out of order responses can be UI glitches. For example,         \/\/ if the application launch an activity, and that activity is stored         \/\/ by the framework inside the history stack. That activity will be         \/\/ available for relaunch using the latest application dialog         \/\/ (long press on the home button). Relaunching that activity can send         \/\/ the same command's result again to the CatService and can cause it to         \/\/ get out of sync with the SIM. This can happen in case of         \/\/ non-interactive type Setup Event List and SETUP_MENU proactive commands.         \/\/ Stk framework would have already sent Terminal Response to Setup Event         \/\/ List and SETUP_MENU proactive commands. After sometime Stk app will send         \/\/ Envelope Command\/Event Download. In which case, the response details doesn't         \/\/ match with last valid command (which are not related).         \/\/ However, we should allow Stk framework to send the message to ICC. <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u00ab\u041d\u0435\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0442\u043a\u043b\u0438\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u043f\u0440\u043e\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u043e\u0436\u0435\u0442 \u201c\u0441\u0431\u0438\u0442\u044c \u0441 \u0442\u043e\u043b\u043a\u0443\u201d baseband\/ril\u00bb. \u041d\u0430 \u0434\u0435\u043b\u0435, \u0435\u0441\u043b\u0438 RIL \u0438\u043b\u0438 SIM-\u043a\u0430\u0440\u0442\u0430 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0442 \u0432\u0430\u0441 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442\u043a\u043b\u0438\u043a\u0438, \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u044b\u043c\u0438. \u0412 \u0445\u043e\u0434\u0435 \u043c\u043e\u0435\u0433\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e SIM-\u043a\u0430\u0440\u0442 \u0432\u044b\u0448\u043b\u043e \u0438\u0437 \u0441\u0442\u0440\u043e\u044f, \u0442\u0430\u043a \u0438 \u043d\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0432 \u043c\u0435\u043d\u044e.<\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 AOSP \u0443\u0441\u0442\u0440\u0430\u043d\u0438\u043b\u0430 \u044d\u0442\u0443 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 Android 5.1.1 \u0434\u043b\u044f Nexus-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 (\u0441\u0431\u043e\u0440\u043a\u0430 LMY48I).<\/p>\n<p>  \u0412\u043e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043c\u043e\u0438\u0445 \u043f\u0430\u0442\u0447\u0435\u0439:<\/p>\n<pre><code class=\"cs\">For \/platform\/frameworks\/opt\/telephony\/+\/master\/:  --- a\/src\/java\/com\/android\/internal\/telephony\/cat\/CatService.java +++ b\/src\/java\/com\/android\/internal\/telephony\/cat\/CatService.java @@ -501,7 +501,7 @@          intent.putExtra(&quot;STK CMD&quot;, cmdMsg);          intent.putExtra(&quot;SLOT_ID&quot;, mSlotId);          CatLog.d(this, &quot;Sending CmdMsg: &quot; + cmdMsg+ &quot; on slotid:&quot; + mSlotId); -        mContext.sendBroadcast(intent); +        mContext.sendBroadcast(intent,&quot;android.permission.RECEIVE_STK_COMMANDS&quot;);      }        \/** @@ -514,7 +514,7 @@          mCurrntCmd = mMenuCmd;          Intent intent = new Intent(AppInterface.CAT_SESSION_END_ACTION);          intent.putExtra(&quot;SLOT_ID&quot;, mSlotId); -        mContext.sendBroadcast(intent); +        mContext.sendBroadcast(intent,&quot;android.permission.RECEIVE_STK_COMMANDS&quot;);      }     @@ -868,7 +868,7 @@          intent.putExtra(AppInterface.CARD_STATUS, cardPresent);          CatLog.d(this, &quot;Sending Card Status: &quot;                  + cardState + &quot; &quot; + &quot;cardPresent: &quot; + cardPresent); -        mContext.sendBroadcast(intent); +        mContext.sendBroadcast(intent,&quot;android.permission.RECEIVE_STK_COMMANDS&quot;);      }        private void broadcastAlphaMessage(String alphaString) { @@ -877,7 +877,7 @@          intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);          intent.putExtra(AppInterface.ALPHA_STRING, alphaString);          intent.putExtra(&quot;SLOT_ID&quot;, mSlotId); -        mContext.sendBroadcast(intent); +        mContext.sendBroadcast(intent,&quot;android.permission.RECEIVE_STK_COMMANDS&quot;);      }        @Override   For \/platform\/frameworks\/base\/ :  --- a\/core\/res\/AndroidManifest.xml +++ b\/core\/res\/AndroidManifest.xml @@ -303,6 +303,11 @@      &lt;protected-broadcast android:name=&quot;android.intent.action.ACTION_SET_RADIO_CAPABILITY_DONE&quot; \/&gt;      &lt;protected-broadcast android:name=&quot;android.intent.action.ACTION_SET_RADIO_CAPABILITY_FAILED&quot; \/&gt;   +    &lt;protected-broadcast android:name=&quot;android.intent.action.stk.command&quot; \/&gt; +    &lt;protected-broadcast android:name=&quot;android.intent.action.stk.session_end&quot; \/&gt; +    &lt;protected-broadcast android:name=&quot;android.intent.action.stk.icc_status_change&quot; \/&gt; +    &lt;protected-broadcast android:name=&quot;android.intent.action.stk.alpha_notify&quot; \/&gt; +      &lt;!-- ====================================== --&gt;      &lt;!-- Permissions for things that cost money --&gt;      &lt;!-- ====================================== --&gt; @@ -2923,6 +2928,9 @@          android:description=&quot;@string\/permdesc_bindCarrierMessagingService&quot;          android:protectionLevel=&quot;signature|system&quot; \/&gt;   +    &lt;permission android:name=&quot;android.permission.RECEIVE_STK_COMMANDS&quot; +        android:protectionLevel=&quot;signature|system&quot; \/&gt; +      &lt;!-- The system process is explicitly the only one allowed to launch the           confirmation UI for full backup\/restore --&gt;      &lt;uses-permission android:name=&quot;android.permission.CONFIRM_FULL_BACKUP&quot;\/&gt;   For \/platform\/packages\/apps\/Stk\/ :  --- a\/AndroidManifest.xml +++ b\/AndroidManifest.xml @@ -24,6 +24,7 @@        &lt;uses-permission android:name=&quot;android.permission.RECEIVE_BOOT_COMPLETED&quot; \/&gt;      &lt;uses-permission android:name=&quot;android.permission.GET_TASKS&quot;\/&gt; +    &lt;uses-permission android:name=&quot;android.permission.RECEIVE_STK_COMMANDS&quot;\/&gt;        &lt;application android:icon=&quot;@drawable\/ic_launcher_sim_toolkit&quot;          android:label=&quot;@string\/app_name&quot; <\/code><\/pre>\n<p>  <b>\u0410\u0432\u0442\u043e\u0440<\/b>: \u0420\u0443\u043a\u043e\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u043e\u0442\u0434\u0435\u043b\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Positive Technologies (<a href=\"http:\/\/blog.0xb.in\/2015\/08\/spoofing-and-intercepting-sim-commands.html\">\u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430<\/a>)               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habrahabr.ru\/post\/280095\/\"> https:\/\/habrahabr.ru\/post\/280095\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d23\/059\/429\/d230594295bd46fdb722f53352aa3496.jpg\"\/><\/p>\n<p>  \u042f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u044d\u0442\u0443 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c, \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0430 \u043e\u0434\u043d\u043e\u0440\u0430\u0437\u043e\u0432\u044b\u0445 \u043f\u0430\u0440\u043e\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438\u0441\u044c \u0431\u0430\u043d\u043a\u043e\u043c \u043f\u043e\u0441\u0442\u0430\u0432\u0449\u0438\u043a\u0443 \u0442\u0435\u043b\u0435\u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u0443\u0433, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u043b\u0438 \u043d\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 SIM-\u043a\u0430\u0440\u0442\u044b \u0438 \u0432\u044b\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Android.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-276894","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/276894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=276894"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/276894\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=276894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=276894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=276894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}