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

SimSmsTest

public class SimSmsTest extends TestCase

Fields Summary
Constructors Summary
Methods Summary
public voidtestBasic()


        ISms sms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
        assertNotNull(sms);

        List<SmsRawData> records = sms.getAllMessagesFromIccEf(ActivityThread.currentPackageName());
        assertNotNull(records);
        assertTrue(records.size() >= 0);

        int firstNullIndex = -1;
        int firstValidIndex = -1;
        byte[] pdu = null;
        for (int i = 0; i < records.size(); i++) {
            SmsRawData data = records.get(i);
            if (data != null && firstValidIndex == -1) {
                firstValidIndex = i;
                pdu = data.getBytes();
            }
            if (data == null && firstNullIndex == -1) {
                firstNullIndex = i;
            }
            if (firstNullIndex != -1 && firstValidIndex != -1) {
                break;
            }
        }
        if (firstNullIndex == -1 || firstValidIndex == -1)
            return;
        assertNotNull(pdu);