FileDocCategorySizeDatePackage
IccServiceTable.javaAPI DocAndroid 5.1 API2915Thu Mar 12 22:22:54 GMT 2015com.android.internal.telephony.uicc

IccServiceTable

public abstract class IccServiceTable extends Object
Wrapper class for an ICC EF containing a bit field of enabled services.

Fields Summary
protected final byte[]
mServiceTable
Constructors Summary
protected IccServiceTable(byte[] table)

        mServiceTable = table;
    
Methods Summary
protected abstract java.lang.StringgetTag()

protected abstract java.lang.Object[]getValues()

protected booleanisAvailable(int service)
Returns if the specified service is available.

param
service the service number as a zero-based offset (the enum ordinal)
return
true if the service is available; false otherwise

        int offset = service / 8;
        if (offset >= mServiceTable.length) {
            // Note: Enums are zero-based, but the TS service numbering is one-based
            Rlog.e(getTag(), "isAvailable for service " + (service + 1) + " fails, max service is " +
                    (mServiceTable.length * 8));
            return false;
        }
        int bit = service % 8;
        return (mServiceTable[offset] & (1 << bit)) != 0;
    
public java.lang.StringtoString()

        Object[] values = getValues();
        int numBytes = mServiceTable.length;
        StringBuilder builder = new StringBuilder(getTag()).append('[")
                .append(numBytes * 8).append("]={ ");

        boolean addComma = false;
        for (int i = 0; i < numBytes; i++) {
            byte currentByte = mServiceTable[i];
            for (int bit = 0; bit < 8; bit++) {
                if ((currentByte & (1 << bit)) != 0) {
                    if (addComma) {
                        builder.append(", ");
                    } else {
                        addComma = true;
                    }
                    int ordinal = (i * 8) + bit;
                    if (ordinal < values.length) {
                        builder.append(values[ordinal]);
                    } else {
                        builder.append('#").append(ordinal + 1);    // service number (one-based)
                    }
                }
            }
        }
        return builder.append(" }").toString();