FileDocCategorySizeDatePackage
SpnOverride.javaAPI DocAndroid 1.5 API2174Wed May 06 22:42:02 BST 2009com.android.internal.telephony.gsm

SpnOverride

public class SpnOverride extends Object

Fields Summary
private HashMap
CarrierSpnMap
static final String
LOG_TAG
static final String
PARTNER_SPN_OVERRIDE_PATH
Constructors Summary
SpnOverride()


      
        CarrierSpnMap = new HashMap<String, String>();
        loadSpnOverrides();
    
Methods Summary
booleancontainsCarrier(java.lang.String carrier)

        return CarrierSpnMap.containsKey(carrier);
    
java.lang.StringgetSpn(java.lang.String carrier)

        return CarrierSpnMap.get(carrier);
    
private voidloadSpnOverrides()

        FileReader spnReader;

        final File spnFile = new File(Environment.getRootDirectory(),
                PARTNER_SPN_OVERRIDE_PATH);

        try {
            spnReader = new FileReader(spnFile);
        } catch (FileNotFoundException e) {
            Log.w(LOG_TAG, "Can't open " +
                    Environment.getRootDirectory() + "/" + PARTNER_SPN_OVERRIDE_PATH);
            return;
        }

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

            XmlUtils.beginDocument(parser, "spnOverrides");

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

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

                String numeric = parser.getAttributeValue(null, "numeric");
                String data    = parser.getAttributeValue(null, "spn");

                CarrierSpnMap.put(numeric, data);
            }
        } catch (XmlPullParserException e) {
            Log.w(LOG_TAG, "Exception in spn-conf parser " + e);
        } catch (IOException e) {
            Log.w(LOG_TAG, "Exception in spn-conf parser " + e);
        }