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

Commit 19486720 authored by Chen Xu's avatar Chen Xu Committed by Gerrit Code Review
Browse files

Merge "make STK broadcast explicit"

parents 06d6647b 685aaba8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telephony.cat;

import android.content.ComponentName;

/**
 * Interface for communication between STK App and CAT Telephony
 *
@@ -48,6 +50,11 @@ public interface AppInterface {
    // Permission required by STK command receiver
    public static final String STK_PERMISSION = "android.permission.RECEIVE_STK_COMMANDS";

    // Only forwards cat broadcast to the system default stk app
    public static ComponentName getDefaultSTKApplication() {
        return ComponentName.unflattenFromString("com.android.stk/.StkCmdReceiver");
    }

    /*
     * Callback function from app to telephony to pass a result code and user's
     * input back to the ICC.
+4 −0
Original line number Diff line number Diff line
@@ -513,6 +513,7 @@ public class CatService extends Handler implements AppInterface {
        Intent intent = new Intent(AppInterface.CAT_CMD_ACTION);
        intent.putExtra("STK CMD", cmdMsg);
        intent.putExtra("SLOT_ID", mSlotId);
        intent.setComponent(AppInterface.getDefaultSTKApplication());
        CatLog.d(this, "Sending CmdMsg: " + cmdMsg+ " on slotid:" + mSlotId);
        mContext.sendBroadcast(intent, AppInterface.STK_PERMISSION);
    }
@@ -527,6 +528,7 @@ public class CatService extends Handler implements AppInterface {
        mCurrntCmd = mMenuCmd;
        Intent intent = new Intent(AppInterface.CAT_SESSION_END_ACTION);
        intent.putExtra("SLOT_ID", mSlotId);
        intent.setComponent(AppInterface.getDefaultSTKApplication());
        mContext.sendBroadcast(intent, AppInterface.STK_PERMISSION);
    }

@@ -878,6 +880,7 @@ public class CatService extends Handler implements AppInterface {

        // This sends an intent with CARD_ABSENT (0 - false) /CARD_PRESENT (1 - true).
        intent.putExtra(AppInterface.CARD_STATUS, cardPresent);
        intent.setComponent(AppInterface.getDefaultSTKApplication());
        CatLog.d(this, "Sending Card Status: "
                + cardState + " " + "cardPresent: " + cardPresent);
        mContext.sendBroadcast(intent, AppInterface.STK_PERMISSION);
@@ -889,6 +892,7 @@ public class CatService extends Handler implements AppInterface {
        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        intent.putExtra(AppInterface.ALPHA_STRING, alphaString);
        intent.putExtra("SLOT_ID", mSlotId);
        intent.setComponent(AppInterface.getDefaultSTKApplication());
        mContext.sendBroadcast(intent, AppInterface.STK_PERMISSION);
    }