美文网首页
不断重启压测手机发现卡被禁用

不断重启压测手机发现卡被禁用

作者: 平头说人生 | 来源:发表于2018-06-26 21:12 被阅读0次

    通过如下流程获取sim卡是否禁用:
    ExtTelephonyServiceImpl.getCurrentUiccCardProvisioningStatus

    =》QtiUiccCardProvisioner.getInstance()
    .getCurrentUiccCardProvisioningStatus(slotId);
    =》UiccProvisionStatus.getCurrentState

    通过如下Log得知当前的state是-1,即不可用状态:
    06-23 17:20:46.177 1905 1905 D QtiUiccCardProvisioner: isAllCardProvisionInfoReceived, prov pref[0] = -1

    UiccProvisionStatus中的currentState是私有变量,只有setCurrentState会更改该变量,
    通过查看setCurrentState的调用发现只要调用该函数的设置的都不是-1,只有初始化的时候为-1;

    但是QtiRilInterface.getUiccProvisionPreference中有通过ByteBuffer来写入,Log中写入的值如下:
    06-23 17:20:44.615 1905 1905 D QtiRilInterface: Data received: java.nio.HeapByteBuffer[pos=0 lim=8 cap=8]

    下面的log说明调用了QtiUiccCardProvisioner.queryUiccProvisionInfo函数,该函数调用了上面的QtiRilInterface.getUiccProvisionPreference

    06-23 17:20:44.616 1905 1905 D QtiUiccCardProvisioner: queryUiccProvisionInfo, iccId[0] = null User pref -1 Current pref -1

    所以可以断定ProvisioningStatus的state状态是在queryUiccProvisionInfo中设定的

    继续根据下面Log追踪:
    06-23 17:20:44.611 1905 1905 D QtiUiccCardProvisioner: updateIccAvailability, card state[0] = CARDSTATE_PRESENT
    QtiUiccCardProvisioner.updateIccAvailability中调用上面函数
    继续追纵发现
    QtiUiccCardProvisioner中UiccController.registerForIccChanged注册iccChanged自上报事件的时候触发上面逻辑去更新ProvisioningStatus的state

    综上得知:高通自拓展Service通过自拓展的HIDL service去和底层通讯,获取当前sim卡是否禁用状态,从底层返回的结果就是禁用状态。

    正常的Log整理如下:
    06-26 20:49:15.365 1905 1905 D QtiRilInterface: Data received: java.nio.HeapByteBuffer[pos=0 lim=8 cap=8]
    06-26 20:49:15.365 1905 1905 I QtiRilInterface: get pref, phoneId 0 User pref 1 Current pref 1 exception null
    06-26 20:49:15.365 1905 1905 D QtiUiccCardProvisioner: queryUiccProvisionInfo, iccId[0] = 89860315245923771788 User pref 1 Current pref 1

    异常的Log整理如下:
    06-23 17:20:44.615 1905 1905 D QtiRilInterface: Data received: java.nio.HeapByteBuffer[pos=0 lim=8 cap=8]
    06-23 17:20:44.615 1905 1905 I QtiRilInterface: get pref, phoneId 0 User pref 1 Current pref -1 exception null
    06-23 17:20:44.616 1905 1905 D QtiUiccCardProvisioner: queryUiccProvisionInfo, iccId[0] = null User pref -1 Current pref -1

    我们继续追踪UiccController是怎么管理IccChanged自上报事件的,我们发现在处理EVENT_GET_ICC_STATUS_DONE事件的时候会遍历通知所有的注册者,通过如下Log发现出现了异常:

    06-23 17:20:29.065 1905 1905 D UiccController: Received EVENT_GET_ICC_STATUS_DONE
    06-23 17:20:29.066 1905 1905 E UiccController: Error getting ICC status. RIL_REQUEST_GET_ICC_STATUS should never return an error
    06-23 17:20:29.066 1905 1905 E UiccController: com.android.internal.telephony.CommandException: INVALID_SIM_STATE
    06-23 17:20:29.066 1905 1905 E UiccController: at com.android.internal.telephony.RILRequest.onError(RIL.java:264)
    06-23 17:20:29.066 1905 1905 E UiccController: at com.android.internal.telephony.RIL.processResponseDone(RIL.java:4087)
    06-23 17:20:29.066 1905 1905 E UiccController: at com.android.internal.telephony.RadioResponse.responseIccCardStatus(RadioResponse.java:1274)
    06-23 17:20:29.066 1905 1905 E UiccController: at com.android.internal.telephony.RadioResponse.getIccCardStatusResponse(RadioResponse.java:103)
    06-23 17:20:29.066 1905 1905 E UiccController: at android.hardware.radio.V1_1.IRadioResponse$Stub.onTransact(IRadioResponse.java:2594)

    06-23 17:20:29.066 1905 1905 D UiccController: Received EVENT_GET_ICC_STATUS_DONE
    06-23 17:20:29.066 1905 1905 E UiccController: Error getting ICC status. RIL_REQUEST_GET_ICC_STATUS should never return an error
    06-23 17:20:29.066 1905 1905 E UiccController: com.android.internal.telephony.CommandException: INVALID_SIM_STATE
    06-23 17:20:29.066 1905 1905 E UiccController: at com.android.internal.telephony.RILRequest.onError(RIL.java:264)
    06-23 17:20:29.066 1905 1905 E UiccController: at com.android.internal.telephony.RIL.processResponseDone(RIL.java:4087)
    06-23 17:20:29.066 1905 1905 E UiccController: at com.android.internal.telephony.RadioResponse.responseIccCardStatus(RadioResponse.java:1274)
    06-23 17:20:29.066 1905 1905 E UiccController: at com.android.internal.telephony.RadioResponse.getIccCardStatusResponse(RadioResponse.java:103)
    06-23 17:20:29.066 1905 1905 E UiccController: at android.hardware.radio.V1_1.IRadioResponse$Stub.onTransact(IRadioResponse.java:2594)

    两次IccChanged自上报事件都出现异常,最终导致Sim卡一直是禁用状态。

    结论:Modem上报ICC_STATUS 异常导致Sim卡一直处于禁用状态。

    课外Tips:
    通过追踪发现高通自拓展的Service ExtTelephonyServiceImpl 最终通过HIDL IQtiOemHook 去下发请求。
    所以高通平台和rild通信的不只是RILJ那里,也可以通过QtiOemHook去和底层沟通。

    相关文章

      网友评论

          本文标题:不断重启压测手机发现卡被禁用

          本文链接:https://www.haomeiwen.com/subject/dwxvyftx.html