<item>0</item>
</string-array>
+ <!-- MVNO Info used in APN editor -->
+ <string-array name="mvno_type_entries">
+ <!-- Do not translate. -->
+ <item>None</item>
+ <!-- Do not translate. -->
+ <item>SPN</item>
+ <!-- Do not translate. -->
+ <item>IMSI</item>
+ <!-- Do not translate. -->
+ <item>GID</item>
+ </string-array>
+
+ <string-array translatable="false" name="mvno_type_values">
+ <!-- Do not translate. -->
+ <item></item>
+ <!-- Do not translate. -->
+ <item>spn</item>
+ <!-- Do not translate. -->
+ <item>imsi</item>
+ <!-- Do not translate. -->
+ <item>gid</item>
+ </string-array>
+
<!-- Apps on SD instalaltion location options in ApplicationSettings -->
<string-array name="app_install_location_entries">
<item>Internal device storage</item>
private final static String KEY_ROAMING_PROTOCOL = "apn_roaming_protocol";
private final static String KEY_CARRIER_ENABLED = "carrier_enabled";
private final static String KEY_BEARER = "bearer";
+ private final static String KEY_MVNO_TYPE = "mvno_type";
private static final int MENU_DELETE = Menu.FIRST;
private static final int MENU_SAVE = Menu.FIRST + 1;
private ListPreference mRoamingProtocol;
private CheckBoxPreference mCarrierEnabled;
private ListPreference mBearer;
+ private ListPreference mMvnoType;
+ private EditTextPreference mMvnoMatchData;
private String mCurMnc;
private String mCurMcc;
Telephony.Carriers.PROTOCOL, // 16
Telephony.Carriers.CARRIER_ENABLED, // 17
Telephony.Carriers.BEARER, // 18
- Telephony.Carriers.ROAMING_PROTOCOL // 19
+ Telephony.Carriers.ROAMING_PROTOCOL, // 19
+ Telephony.Carriers.MVNO_TYPE, // 20
+ Telephony.Carriers.MVNO_MATCH_DATA // 21
};
private static final int ID_INDEX = 0;
private static final int CARRIER_ENABLED_INDEX = 17;
private static final int BEARER_INDEX = 18;
private static final int ROAMING_PROTOCOL_INDEX = 19;
+ private static final int MVNO_TYPE_INDEX = 20;
+ private static final int MVNO_MATCH_DATA_INDEX = 21;
@Override
mBearer = (ListPreference) findPreference(KEY_BEARER);
mBearer.setOnPreferenceChangeListener(this);
+ mMvnoType = (ListPreference) findPreference(KEY_MVNO_TYPE);
+ mMvnoType.setOnPreferenceChangeListener(this);
+ mMvnoMatchData = (EditTextPreference) findPreference("mvno_match_data");
+
mRes = getResources();
final Intent intent = getIntent();
mRoamingProtocol.setValue(mCursor.getString(ROAMING_PROTOCOL_INDEX));
mCarrierEnabled.setChecked(mCursor.getInt(CARRIER_ENABLED_INDEX)==1);
mBearer.setValue(mCursor.getString(BEARER_INDEX));
+ mMvnoType.setValue(mCursor.getString(MVNO_TYPE_INDEX));
+ mMvnoMatchData.setEnabled(false);
+ mMvnoMatchData.setText(mCursor.getString(MVNO_MATCH_DATA_INDEX));
}
mName.setSummary(checkNull(mName.getText()));
checkNull(protocolDescription(mRoamingProtocol.getValue(), mRoamingProtocol)));
mBearer.setSummary(
checkNull(bearerDescription(mBearer.getValue())));
+ mMvnoType.setSummary(
+ checkNull(mvnoDescription(mMvnoType.getValue())));
+ mMvnoMatchData.setSummary(checkNull(mMvnoMatchData.getText()));
}
/**
}
}
+ private String mvnoDescription(String raw) {
+ int mvnoIndex = mMvnoType.findIndexOfValue(raw);
+ if (mvnoIndex == -1) {
+ return null;
+ } else {
+ String[] values = mRes.getStringArray(R.array.mvno_type_entries);
+ if (values[mvnoIndex].equals("None")) {
+ mMvnoMatchData.setEnabled(false);
+ mMvnoMatchData.setText("");
+ } else {
+ mMvnoMatchData.setEnabled(true);
+ }
+
+ try {
+ return values[mvnoIndex];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+ }
+
public boolean onPreferenceChange(Preference preference, Object newValue) {
String key = preference.getKey();
if (KEY_AUTH_TYPE.equals(key)) {
}
mBearer.setValue((String) newValue);
mBearer.setSummary(bearer);
+ } else if (KEY_MVNO_TYPE.equals(key)) {
+ String mvno = mvnoDescription((String) newValue);
+ if (mvno == null) {
+ return false;
+ }
+ mMvnoType.setValue((String) newValue);
+ mMvnoType.setSummary(mvno);
}
return true;
values.put(Telephony.Carriers.BEARER, Integer.parseInt(bearerVal));
}
+ values.put(Telephony.Carriers.MVNO_TYPE, checkNotSet(mMvnoType.getValue()));
+ values.put(Telephony.Carriers.MVNO_MATCH_DATA, checkNotSet(mMvnoMatchData.getText()));
+
getContentResolver().update(mUri, values, null, null);
return true;