FileDocCategorySizeDatePackage
UiccSmsController.javaAPI DocAndroid 5.1 API16344Thu Mar 12 22:22:54 GMT 2015com.android.internal.telephony

UiccSmsController

public class UiccSmsController extends ISms.Stub
UiccSmsController to provide an inter-process communication to access Sms in Icc.

Fields Summary
static final String
LOG_TAG
protected Phone[]
mPhone
Constructors Summary
protected UiccSmsController(Phone[] phone)


      
        mPhone = phone;

        if (ServiceManager.getService("isms") == null) {
            ServiceManager.addService("isms", this);
        }
    
Methods Summary
public booleancopyMessageToIccEf(java.lang.String callingPackage, int status, byte[] pdu, byte[] smsc)

        return copyMessageToIccEfForSubscriber(getPreferredSmsSubscription(), callingPackage, status,
                pdu, smsc);
    
public booleancopyMessageToIccEfForSubscriber(int subId, java.lang.String callingPackage, int status, byte[] pdu, byte[] smsc)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null) {
            return iccSmsIntMgr.copyMessageToIccEf(callingPackage, status, pdu, smsc);
        } else {
            Rlog.e(LOG_TAG,"copyMessageToIccEf iccSmsIntMgr is null" +
                          " for Subscription: " + subId);
            return false;
        }
    
public booleandisableCellBroadcast(int messageIdentifier, int ranType)

        return disableCellBroadcastForSubscriber(getPreferredSmsSubscription(), messageIdentifier,
                ranType);
    
public booleandisableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType)

        return disableCellBroadcastRangeForSubscriber(subId, messageIdentifier, messageIdentifier,
                ranType);
    
public booleandisableCellBroadcastRange(int startMessageId, int endMessageId, int ranType)

        return disableCellBroadcastRangeForSubscriber(getPreferredSmsSubscription(), startMessageId,
                endMessageId, ranType);
    
public booleandisableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId, int ranType)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null ) {
            return iccSmsIntMgr.disableCellBroadcastRange(startMessageId, endMessageId, ranType);
        } else {
            Rlog.e(LOG_TAG,"disableCellBroadcast iccSmsIntMgr is null for" +
                          " Subscription:"+subId);
        }
       return false;
    
public booleanenableCellBroadcast(int messageIdentifier, int ranType)

        return enableCellBroadcastForSubscriber(getPreferredSmsSubscription(), messageIdentifier,
                ranType);
    
public booleanenableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType)

        return enableCellBroadcastRangeForSubscriber(subId, messageIdentifier, messageIdentifier,
                ranType);
    
public booleanenableCellBroadcastRange(int startMessageId, int endMessageId, int ranType)

        return enableCellBroadcastRangeForSubscriber(getPreferredSmsSubscription(), startMessageId,
                endMessageId, ranType);
    
public booleanenableCellBroadcastRangeForSubscriber(int subId, int startMessageId, int endMessageId, int ranType)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null ) {
            return iccSmsIntMgr.enableCellBroadcastRange(startMessageId, endMessageId, ranType);
        } else {
            Rlog.e(LOG_TAG,"enableCellBroadcast iccSmsIntMgr is null for" +
                          " Subscription: " + subId);
        }
        return false;
    
public java.util.ListgetAllMessagesFromIccEf(java.lang.String callingPackage)

        return getAllMessagesFromIccEfForSubscriber(getPreferredSmsSubscription(), callingPackage);
    
public java.util.ListgetAllMessagesFromIccEfForSubscriber(int subId, java.lang.String callingPackage)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null) {
            return iccSmsIntMgr.getAllMessagesFromIccEf(callingPackage);
        } else {
            Rlog.e(LOG_TAG,"getAllMessagesFromIccEf iccSmsIntMgr is" +
                          " null for Subscription: " + subId);
            return null;
        }
    
private IccSmsInterfaceManagergetIccSmsInterfaceManager(int subId)
get sms interface manager object based on subscription.

        int phoneId = SubscriptionController.getInstance().getPhoneId(subId) ;
        //Fixme: for multi-subscription case
        if (!SubscriptionManager.isValidPhoneId(phoneId)
                || phoneId == SubscriptionManager.DEFAULT_PHONE_INDEX) {
            phoneId = 0;
        }

        try {
            return (IccSmsInterfaceManager)
                ((PhoneProxy)mPhone[(int)phoneId]).getIccSmsInterfaceManager();
        } catch (NullPointerException e) {
            Rlog.e(LOG_TAG, "Exception is :"+e.toString()+" For subscription :"+subId );
            e.printStackTrace(); //This will print stact trace
            return null;
        } catch (ArrayIndexOutOfBoundsException e) {
            Rlog.e(LOG_TAG, "Exception is :"+e.toString()+" For subscription :"+subId );
            e.printStackTrace(); //This will print stack trace
            return null;
        }
    
public java.lang.StringgetImsSmsFormat()

        return getImsSmsFormatForSubscriber(getPreferredSmsSubscription());
    
public java.lang.StringgetImsSmsFormatForSubscriber(int subId)

       IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null ) {
            return iccSmsIntMgr.getImsSmsFormat();
        } else {
            Rlog.e(LOG_TAG, "getImsSmsFormat iccSmsIntMgr is null");
        }
        return null;
    
public intgetPreferredSmsSubscription()
Gets User preferred SMS subscription

        return  SubscriptionController.getInstance().getDefaultSmsSubId();
    
public intgetPremiumSmsPermission(java.lang.String packageName)

        return getPremiumSmsPermissionForSubscriber(getPreferredSmsSubscription(), packageName);
    
public intgetPremiumSmsPermissionForSubscriber(int subId, java.lang.String packageName)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null ) {
            return iccSmsIntMgr.getPremiumSmsPermission(packageName);
        } else {
            Rlog.e(LOG_TAG, "getPremiumSmsPermission iccSmsIntMgr is null");
        }
        //TODO Rakesh
        return 0;
    
public voidinjectSmsPdu(byte[] pdu, java.lang.String format, android.app.PendingIntent receivedIntent)

        injectSmsPdu(SubscriptionManager.getDefaultSmsSubId(), pdu, format, receivedIntent);
    
public voidinjectSmsPdu(int subId, byte[] pdu, java.lang.String format, android.app.PendingIntent receivedIntent)

        getIccSmsInterfaceManager(subId).injectSmsPdu(pdu, format, receivedIntent);
    
public booleanisImsSmsSupported()

        return isImsSmsSupportedForSubscriber(getPreferredSmsSubscription());
    
public booleanisImsSmsSupportedForSubscriber(int subId)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null ) {
            return iccSmsIntMgr.isImsSmsSupported();
        } else {
            Rlog.e(LOG_TAG, "isImsSmsSupported iccSmsIntMgr is null");
        }
        return false;
    
public booleanisSMSPromptEnabled()
Get SMS prompt property, enabled or not

        return PhoneFactory.isSMSPromptEnabled();
    
public booleanisSmsSimPickActivityNeeded(int subId)

        final Context context = ActivityThread.currentApplication().getApplicationContext();
        TelephonyManager telephonyManager =
                (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        List<SubscriptionInfo> subInfoList;
        final long identity = Binder.clearCallingIdentity();
        try {
            subInfoList = SubscriptionManager.from(context).getActiveSubscriptionInfoList();
        } finally {
            Binder.restoreCallingIdentity(identity);
        }

        if (subInfoList != null) {
            final int subInfoLength = subInfoList.size();

            for (int i = 0; i < subInfoLength; ++i) {
                final SubscriptionInfo sir = subInfoList.get(i);
                if (sir != null && sir.getSubscriptionId() == subId) {
                    // The subscription id is valid, sms sim pick activity not needed
                    return false;
                }
            }

            // If reached here and multiple SIMs and subs present, sms sim pick activity is needed
            if (subInfoLength > 0 && telephonyManager.getSimCount() > 1) {
                return true;
            }
        }

        return false;
    
public voidsendData(java.lang.String callingPackage, java.lang.String destAddr, java.lang.String scAddr, int destPort, byte[] data, android.app.PendingIntent sentIntent, android.app.PendingIntent deliveryIntent)

         sendDataForSubscriber(getPreferredSmsSubscription(), callingPackage, destAddr, scAddr,
                 destPort, data, sentIntent, deliveryIntent);
    
public voidsendDataForSubscriber(int subId, java.lang.String callingPackage, java.lang.String destAddr, java.lang.String scAddr, int destPort, byte[] data, android.app.PendingIntent sentIntent, android.app.PendingIntent deliveryIntent)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendData(callingPackage, destAddr, scAddr, destPort, data,
                    sentIntent, deliveryIntent);
        } else {
            Rlog.e(LOG_TAG,"sendText iccSmsIntMgr is null for" +
                          " Subscription: " + subId);
        }
    
public voidsendMultipartText(java.lang.String callingPackage, java.lang.String destAddr, java.lang.String scAddr, java.util.List parts, java.util.List sentIntents, java.util.List deliveryIntents)

         sendMultipartTextForSubscriber(getPreferredSmsSubscription(), callingPackage, destAddr,
                 scAddr, parts, sentIntents, deliveryIntents);
    
public voidsendMultipartTextForSubscriber(int subId, java.lang.String callingPackage, java.lang.String destAddr, java.lang.String scAddr, java.util.List parts, java.util.List sentIntents, java.util.List deliveryIntents)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null ) {
            iccSmsIntMgr.sendMultipartText(callingPackage, destAddr, scAddr, parts, sentIntents,
                    deliveryIntents);
        } else {
            Rlog.e(LOG_TAG,"sendMultipartText iccSmsIntMgr is null for" +
                          " Subscription: " + subId);
        }
    
public voidsendStoredMultipartText(int subId, java.lang.String callingPkg, android.net.Uri messageUri, java.lang.String scAddress, java.util.List sentIntents, java.util.List deliveryIntents)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null ) {
            iccSmsIntMgr.sendStoredMultipartText(callingPkg, messageUri, scAddress, sentIntents,
                    deliveryIntents);
        } else {
            Rlog.e(LOG_TAG,"sendStoredMultipartText iccSmsIntMgr is null for subscription: "
                    + subId);
        }
    
public voidsendStoredText(int subId, java.lang.String callingPkg, android.net.Uri messageUri, java.lang.String scAddress, android.app.PendingIntent sentIntent, android.app.PendingIntent deliveryIntent)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendStoredText(callingPkg, messageUri, scAddress, sentIntent,
                    deliveryIntent);
        } else {
            Rlog.e(LOG_TAG,"sendStoredText iccSmsIntMgr is null for subscription: " + subId);
        }
    
public voidsendText(java.lang.String callingPackage, java.lang.String destAddr, java.lang.String scAddr, java.lang.String text, android.app.PendingIntent sentIntent, android.app.PendingIntent deliveryIntent)

        sendTextForSubscriber(getPreferredSmsSubscription(), callingPackage, destAddr, scAddr,
            text, sentIntent, deliveryIntent);
    
public voidsendTextForSubscriber(int subId, java.lang.String callingPackage, java.lang.String destAddr, java.lang.String scAddr, java.lang.String text, android.app.PendingIntent sentIntent, android.app.PendingIntent deliveryIntent)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null) {
            iccSmsIntMgr.sendText(callingPackage, destAddr, scAddr, text, sentIntent,
                    deliveryIntent);
        } else {
            Rlog.e(LOG_TAG,"sendText iccSmsIntMgr is null for" +
                          " Subscription: " + subId);
        }
    
public voidsetPremiumSmsPermission(java.lang.String packageName, int permission)

         setPremiumSmsPermissionForSubscriber(getPreferredSmsSubscription(), packageName, permission);
    
public voidsetPremiumSmsPermissionForSubscriber(int subId, java.lang.String packageName, int permission)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null ) {
            iccSmsIntMgr.setPremiumSmsPermission(packageName, permission);
        } else {
            Rlog.e(LOG_TAG, "setPremiumSmsPermission iccSmsIntMgr is null");
        }
    
public booleanupdateMessageOnIccEf(java.lang.String callingPackage, int index, int status, byte[] pdu)

        return  updateMessageOnIccEfForSubscriber(getPreferredSmsSubscription(), callingPackage,
                index, status, pdu);
    
public booleanupdateMessageOnIccEfForSubscriber(int subId, java.lang.String callingPackage, int index, int status, byte[] pdu)

        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
        if (iccSmsIntMgr != null) {
            return iccSmsIntMgr.updateMessageOnIccEf(callingPackage, index, status, pdu);
        } else {
            Rlog.e(LOG_TAG,"updateMessageOnIccEf iccSmsIntMgr is null" +
                          " for Subscription: " + subId);
            return false;
        }