Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d3e25f55 authored by Preeti Ahuja's avatar Preeti Ahuja Committed by Rakesh Pallerla
Browse files

Cat: Report stkIsRunning after StkAppService is ready.

The Android framework seems to delay the intents sent to StkAppService
until the boot finishes, that is, until StkAppService receives
Boot_Complete intent from the framework. As a result before
Boot_Complete is received, StkAppService is not ready to process
the proactive commands and the proactive command times out. Also,
the CatService reports stkIsRunning to ril when the card state
moves to present without taking into account the readiness of
StkAppService.

A new api has been introduced to inform the CatService about the
readiness of the StkAppService. CatService will then report stkIsRunning
to ril only after the card state has moved to present AND
StkAppService is ready.

Change-Id: Ice7a95b6e1de4ec1b579a5ba4035d13b1d043c41
CRs-Fixed: 602191
parent f6e91488
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -65,6 +65,12 @@ public interface AppInterface {
     */
    void onCmdResponse(CatResponseMessage resMsg);

    /*
     * Callback function from app to telephony when the app is ready, that is, the app is up
     * and running and is ready to process commands received from telephony.
     */
    void onStkAppReady();

    /*
     * Enumeration for representing "Type of Command" of proactive commands.
     * Those are the only commands which are supported by the Telephony. Any app
+18 −3
Original line number Diff line number Diff line
@@ -91,6 +91,7 @@ public class CatService extends Handler implements AppInterface {

    protected RilMessageDecoder mMsgDecoder = null;
    protected boolean mStkAppInstalled = false;
    protected boolean mIsStkAppReady = false;

    protected UiccController mUiccController;
    protected CardState mCardState = CardState.CARDSTATE_ABSENT;
@@ -865,6 +866,14 @@ public class CatService extends Handler implements AppInterface {
        mContext.sendBroadcast(intent);
    }

    protected void reportStkIsRunning() {
        CatLog.d(this, "mCardState = " + mCardState +
                " mIsStkAppReady = " + mIsStkAppReady);
        if ((mCardState == CardState.CARDSTATE_PRESENT) && (mIsStkAppReady == true)) {
            mCmdIf.reportStkServiceIsRunning(null);
        }
    }

    @Override
    public synchronized void onCmdResponse(CatResponseMessage resMsg) {
        if (resMsg == null) {
@@ -875,6 +884,13 @@ public class CatService extends Handler implements AppInterface {
        msg.sendToTarget();
    }

    @Override
    public void onStkAppReady(){
        CatLog.d(this, "StkAppReady notification received");
        mIsStkAppReady = true;
        reportStkIsRunning();
    }

    private boolean validateResponse(CatResponseMessage resMsg) {
        boolean validResponse = false;
        if ((resMsg.mCmdDet.typeOfCommand == CommandType.SET_UP_EVENT_LIST.value())
@@ -1047,9 +1063,8 @@ public class CatService extends Handler implements AppInterface {
            broadcastCardStateAndIccRefreshResp(newState, null);
        } else if (oldState != CardState.CARDSTATE_PRESENT &&
                newState == CardState.CARDSTATE_PRESENT) {
            // Card moved to PRESENT STATE.
            mCmdIf.reportStkServiceIsRunning(null);
            // Card moved to PRESENT STATE
            reportStkIsRunning();
        }

    }
}