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

VoiceMailConstants

public class VoiceMailConstants extends Object
{@hide}

Fields Summary
private HashMap
CarrierVmMap
static final String
LOG_TAG
static final String
PARTNER_VOICEMAIL_PATH
static final int
NAME
static final int
NUMBER
static final int
TAG
static final int
SIZE
Constructors Summary
VoiceMailConstants()


      
        CarrierVmMap = new HashMap<String, String[]>();
        loadVoiceMail();
    
Methods Summary
booleancontainsCarrier(java.lang.String carrier)

        return CarrierVmMap.containsKey(carrier);
    
java.lang.StringgetCarrierName(java.lang.String carrier)

        String[] data = CarrierVmMap.get(carrier);
        return data[NAME];
    
java.lang.StringgetVoiceMailNumber(java.lang.String carrier)

        String[] data = CarrierVmMap.get(carrier);
        return data[NUMBER];
    
java.lang.StringgetVoiceMailTag(java.lang.String carrier)

        String[] data = CarrierVmMap.get(carrier);
        return data[TAG];
    
private voidloadVoiceMail()

        FileReader vmReader;

        final File vmFile = new File(Environment.getRootDirectory(),
                PARTNER_VOICEMAIL_PATH);

        try {
            vmReader = new FileReader(vmFile);
        } catch (FileNotFoundException e) {
            Rlog.w(LOG_TAG, "Can't open " +
                    Environment.getRootDirectory() + "/" + PARTNER_VOICEMAIL_PATH);
            return;
        }

        try {
            XmlPullParser parser = Xml.newPullParser();
            parser.setInput(vmReader);

            XmlUtils.beginDocument(parser, "voicemail");

            while (true) {
                XmlUtils.nextElement(parser);

                String name = parser.getName();
                if (!"voicemail".equals(name)) {
                    break;
                }

                String[] data = new String[SIZE];
                String numeric = parser.getAttributeValue(null, "numeric");
                data[NAME]     = parser.getAttributeValue(null, "carrier");
                data[NUMBER]   = parser.getAttributeValue(null, "vmnumber");
                data[TAG]      = parser.getAttributeValue(null, "vmtag");

                CarrierVmMap.put(numeric, data);
            }
        } catch (XmlPullParserException e) {
            Rlog.w(LOG_TAG, "Exception in Voicemail parser " + e);
        } catch (IOException e) {
            Rlog.w(LOG_TAG, "Exception in Voicemail parser " + e);
        } finally {
            try {
                if (vmReader != null) {
                    vmReader.close();
                }
            } catch (IOException e) {}
        }