diff options
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/settings/ApnEditor.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/ApnSettings.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/IccLockSettings.java (renamed from src/com/android/settings/SimLockSettings.java) | 103 | ||||
-rw-r--r-- | src/com/android/settings/RadioInfo.java | 39 | ||||
-rw-r--r-- | src/com/android/settings/SecuritySettings.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/deviceinfo/Status.java | 6 |
6 files changed, 82 insertions, 72 deletions
diff --git a/src/com/android/settings/ApnEditor.java b/src/com/android/settings/ApnEditor.java index f1fa2efd0..0bd91a825 100644 --- a/src/com/android/settings/ApnEditor.java +++ b/src/com/android/settings/ApnEditor.java @@ -202,7 +202,7 @@ public class ApnEditor extends PreferenceActivity mApnType.setText(mCursor.getString(TYPE_INDEX)); if (mNewApn) { String numeric = - SystemProperties.get(TelephonyProperties.PROPERTY_SIM_OPERATOR_NUMERIC); + SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC); // MCC is first 3 chars and then in 2 - 3 chars of MNC if (numeric != null && numeric.length() > 4) { // Country code diff --git a/src/com/android/settings/ApnSettings.java b/src/com/android/settings/ApnSettings.java index ecfdb2479..2624990ca 100644 --- a/src/com/android/settings/ApnSettings.java +++ b/src/com/android/settings/ApnSettings.java @@ -146,7 +146,7 @@ public class ApnSettings extends PreferenceActivity implements private void fillList() { String where = "numeric=\"" - + android.os.SystemProperties.get(TelephonyProperties.PROPERTY_SIM_OPERATOR_NUMERIC, "") + + android.os.SystemProperties.get(TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, "") + "\""; Cursor cursor = managedQuery(Telephony.Carriers.CONTENT_URI, new String[] { diff --git a/src/com/android/settings/SimLockSettings.java b/src/com/android/settings/IccLockSettings.java index 286e3d6f1..18beb3283 100644 --- a/src/com/android/settings/SimLockSettings.java +++ b/src/com/android/settings/IccLockSettings.java @@ -22,35 +22,36 @@ import android.os.AsyncResult; import android.os.Bundle; import android.os.Handler; import android.os.Message; +import android.preference.CheckBoxPreference; import android.preference.Preference; import android.preference.PreferenceActivity; -import android.preference.CheckBoxPreference; import android.preference.PreferenceScreen; +import android.widget.Toast; + import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneFactory; -import android.widget.Toast; /** - * Implements the preference screen to enable/disable SIM lock and - * also the dialogs to change the SIM PIN. In the former case, enabling/disabling - * the SIM lock will prompt the user for the current PIN. + * Implements the preference screen to enable/disable ICC lock and + * also the dialogs to change the ICC PIN. In the former case, enabling/disabling + * the ICC lock will prompt the user for the current PIN. * In the Change PIN case, it prompts the user for old pin, new pin and new pin * again before attempting to change it. Calls the SimCard interface to execute * these operations. * */ -public class SimLockSettings extends PreferenceActivity +public class IccLockSettings extends PreferenceActivity implements EditPinPreference.OnPinEnteredListener { private static final int OFF_MODE = 0; - // State when enabling/disabling SIM lock - private static final int SIM_LOCK_MODE = 1; + // State when enabling/disabling ICC lock + private static final int ICC_LOCK_MODE = 1; // State when entering the old pin - private static final int SIM_OLD_MODE = 2; + private static final int ICC_OLD_MODE = 2; // State when entering the new pin - first time - private static final int SIM_NEW_MODE = 3; + private static final int ICC_NEW_MODE = 3; // State when entering the new pin - second time - private static final int SIM_REENTER_MODE = 4; + private static final int ICC_REENTER_MODE = 4; // Keys in xml file private static final String PIN_DIALOG = "sim_pin"; @@ -70,7 +71,7 @@ public class SimLockSettings extends PreferenceActivity private String mOldPin; private String mNewPin; private String mError; - // Are we trying to enable or disable SIM lock? + // Are we trying to enable or disable ICC lock? private boolean mToState; private Phone mPhone; @@ -81,19 +82,19 @@ public class SimLockSettings extends PreferenceActivity private Resources mRes; // For async handler to identify request type - private static final int ENABLE_SIM_PIN_COMPLETE = 100; - private static final int CHANGE_SIM_PIN_COMPLETE = 101; + private static final int ENABLE_ICC_PIN_COMPLETE = 100; + private static final int CHANGE_ICC_PIN_COMPLETE = 101; - // For replies from SimCard interface + // For replies from IccCard interface private Handler mHandler = new Handler() { public void handleMessage(Message msg) { AsyncResult ar = (AsyncResult) msg.obj; switch (msg.what) { - case ENABLE_SIM_PIN_COMPLETE: - simLockChanged(ar.exception == null); + case ENABLE_ICC_PIN_COMPLETE: + iccLockChanged(ar.exception == null); break; - case CHANGE_SIM_PIN_COMPLETE: - simPinChanged(ar.exception == null); + case CHANGE_ICC_PIN_COMPLETE: + iccPinChanged(ar.exception == null); break; } @@ -102,24 +103,24 @@ public class SimLockSettings extends PreferenceActivity }; // For top-level settings screen to query - static boolean isSimLockEnabled() { - return PhoneFactory.getDefaultPhone().getSimCard().getSimLockEnabled(); + static boolean isIccLockEnabled() { + return PhoneFactory.getDefaultPhone().getIccCard().getIccLockEnabled(); } static String getSummary(Context context) { Resources res = context.getResources(); - String summary = isSimLockEnabled() - ? res.getString(R.string.sim_lock_on) + String summary = isIccLockEnabled() + ? res.getString(R.string.sim_lock_on) : res.getString(R.string.sim_lock_off); return summary; } - + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + addPreferencesFromResource(R.xml.sim_lock_settings); - + mPinDialog = (EditPinPreference) findPreference(PIN_DIALOG); mPinToggle = (CheckBoxPreference) findPreference(PIN_TOGGLE); if (savedInstanceState != null && savedInstanceState.containsKey(DIALOG_STATE)) { @@ -142,7 +143,7 @@ public class SimLockSettings extends PreferenceActivity protected void onResume() { super.onResume(); - mPinToggle.setChecked(mPhone.getSimCard().getSimLockEnabled()); + mPinToggle.setChecked(mPhone.getIccCard().getIccLockEnabled()); if (mDialogState != OFF_MODE) { showPinDialog(); @@ -182,21 +183,21 @@ public class SimLockSettings extends PreferenceActivity mPinDialog.setText(mPin); String message = ""; switch (mDialogState) { - case SIM_LOCK_MODE: + case ICC_LOCK_MODE: message = mRes.getString(R.string.sim_enter_pin); mPinDialog.setDialogTitle(mToState ? mRes.getString(R.string.sim_enable_sim_lock) : mRes.getString(R.string.sim_disable_sim_lock)); break; - case SIM_OLD_MODE: + case ICC_OLD_MODE: message = mRes.getString(R.string.sim_enter_old); mPinDialog.setDialogTitle(mRes.getString(R.string.sim_change_pin)); break; - case SIM_NEW_MODE: + case ICC_NEW_MODE: message = mRes.getString(R.string.sim_enter_new); mPinDialog.setDialogTitle(mRes.getString(R.string.sim_change_pin)); break; - case SIM_REENTER_MODE: + case ICC_REENTER_MODE: message = mRes.getString(R.string.sim_reenter_new); mPinDialog.setDialogTitle(mRes.getString(R.string.sim_change_pin)); break; @@ -222,26 +223,26 @@ public class SimLockSettings extends PreferenceActivity return; } switch (mDialogState) { - case SIM_LOCK_MODE: - tryChangeSimLockState(); + case ICC_LOCK_MODE: + tryChangeIccLockState(); break; - case SIM_OLD_MODE: + case ICC_OLD_MODE: mOldPin = mPin; - mDialogState = SIM_NEW_MODE; + mDialogState = ICC_NEW_MODE; mError = null; mPin = null; showPinDialog(); break; - case SIM_NEW_MODE: + case ICC_NEW_MODE: mNewPin = mPin; - mDialogState = SIM_REENTER_MODE; + mDialogState = ICC_REENTER_MODE; mPin = null; showPinDialog(); break; - case SIM_REENTER_MODE: + case ICC_REENTER_MODE: if (!mPin.equals(mNewPin)) { mError = mRes.getString(R.string.sim_pins_dont_match); - mDialogState = SIM_NEW_MODE; + mDialogState = ICC_NEW_MODE; mPin = null; showPinDialog(); } else { @@ -258,21 +259,21 @@ public class SimLockSettings extends PreferenceActivity mToState = mPinToggle.isChecked(); // Flip it back and pop up pin dialog mPinToggle.setChecked(!mToState); - mDialogState = SIM_LOCK_MODE; + mDialogState = ICC_LOCK_MODE; showPinDialog(); } return true; } - private void tryChangeSimLockState() { - // Try to change sim lock. If it succeeds, toggle the lock state and + private void tryChangeIccLockState() { + // Try to change icc lock. If it succeeds, toggle the lock state and // reset dialog state. Else inject error message and show dialog again. - Message callback = Message.obtain(mHandler, ENABLE_SIM_PIN_COMPLETE); - mPhone.getSimCard().setSimLockEnabled(mToState, mPin, callback); + Message callback = Message.obtain(mHandler, ENABLE_ICC_PIN_COMPLETE); + mPhone.getIccCard().setIccLockEnabled(mToState, mPin, callback); } - private void simLockChanged(boolean success) { + private void iccLockChanged(boolean success) { if (success) { mPinToggle.setChecked(mToState); } else { @@ -283,14 +284,14 @@ public class SimLockSettings extends PreferenceActivity resetDialogState(); } - private void simPinChanged(boolean success) { + private void iccPinChanged(boolean success) { if (!success) { // TODO: I18N - Toast.makeText(this, mRes.getString(R.string.sim_change_failed), + Toast.makeText(this, mRes.getString(R.string.sim_change_failed), Toast.LENGTH_SHORT) .show(); } else { - Toast.makeText(this, mRes.getString(R.string.sim_change_succeeded), + Toast.makeText(this, mRes.getString(R.string.sim_change_succeeded), Toast.LENGTH_SHORT) .show(); @@ -299,8 +300,8 @@ public class SimLockSettings extends PreferenceActivity } private void tryChangePin() { - Message callback = Message.obtain(mHandler, CHANGE_SIM_PIN_COMPLETE); - mPhone.getSimCard().changeSimLockPassword(mOldPin, + Message callback = Message.obtain(mHandler, CHANGE_ICC_PIN_COMPLETE); + mPhone.getIccCard().changeIccLockPassword(mOldPin, mNewPin, callback); } @@ -314,7 +315,7 @@ public class SimLockSettings extends PreferenceActivity private void resetDialogState() { mError = null; - mDialogState = SIM_OLD_MODE; // Default for when Change PIN is clicked + mDialogState = ICC_OLD_MODE; // Default for when Change PIN is clicked mPin = ""; setDialogValues(); } diff --git a/src/com/android/settings/RadioInfo.java b/src/com/android/settings/RadioInfo.java index 5df931320..b624c7a45 100644 --- a/src/com/android/settings/RadioInfo.java +++ b/src/com/android/settings/RadioInfo.java @@ -94,7 +94,7 @@ public class RadioInfo extends Activity { private static final int MENU_ITEM_TOGGLE_DATA = 5; private static final int MENU_ITEM_TOGGLE_DATA_ON_BOOT = 6; - private TextView mImei; + private TextView mDeviceId; //DeviceId is the IMEI in GSM and the MEID in CDMA private TextView number; private TextView callState; private TextView operatorName; @@ -405,7 +405,7 @@ public class RadioInfo extends Activity { mTelephonyManager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE); phone = PhoneFactory.getDefaultPhone(); - mImei = (TextView) findViewById(R.id.imei); + mDeviceId= (TextView) findViewById(R.id.imei); number = (TextView) findViewById(R.id.number); callState = (TextView) findViewById(R.id.call); operatorName = (TextView) findViewById(R.id.operator); @@ -518,7 +518,8 @@ public class RadioInfo extends Activity { @Override public boolean onCreateOptionsMenu(Menu menu) { - menu.add(0, MENU_ITEM_SELECT_BAND, 0, R.string.radio_info_band_mode_label).setOnMenuItemClickListener(mSelectBandCallback) + menu.add(0, MENU_ITEM_SELECT_BAND, 0, R.string.radio_info_band_mode_label) + .setOnMenuItemClickListener(mSelectBandCallback) .setAlphabeticShortcut('b'); menu.add(1, MENU_ITEM_VIEW_ADN, 0, R.string.radioInfo_menu_viewADN).setOnMenuItemClickListener(mViewADNCallback); @@ -531,14 +532,14 @@ public class RadioInfo extends Activity { menu.add(1, MENU_ITEM_TOGGLE_DATA, 0, R.string.radioInfo_menu_disableData).setOnMenuItemClickListener(mToggleData); menu.add(1, MENU_ITEM_TOGGLE_DATA_ON_BOOT, - 0, R.string.radioInfo_menu_disableDataOnBoot).setOnMenuItemClickListener(mToggleDataOnBoot); + 0, R.string.radioInfo_menu_disableDataOnBoot).setOnMenuItemClickListener( + mToggleDataOnBoot); return true; } @Override - public boolean onPrepareOptionsMenu(Menu menu) - { + public boolean onPrepareOptionsMenu(Menu menu) { // Get the TOGGLE DATA menu item in the right state. MenuItem item = menu.findItem(MENU_ITEM_TOGGLE_DATA); int state = mTelephonyManager.getDataState(); @@ -575,11 +576,10 @@ public class RadioInfo extends Activity { } private void updatePowerState() { - //log("updatePowerState"); String buttonText = isRadioOn() ? getString(R.string.turn_off_radio) : getString(R.string.turn_on_radio); - radioPowerButton.setText(buttonText); + radioPowerButton.setText(buttonText); } private void updateQxdmState(Boolean newQxdmStatus) { @@ -650,11 +650,15 @@ public class RadioInfo extends Activity { } private final void updateLocation(CellLocation location) { - GsmCellLocation loc = (GsmCellLocation)location; - Resources r = getResources(); + int lac = -1; + int cid = -1; + if (location instanceof GsmCellLocation) { + GsmCellLocation loc = (GsmCellLocation)location; + lac = loc.getLac(); + cid = loc.getCid(); + } - int lac = loc.getLac(); - int cid = loc.getCid(); + Resources r = getResources(); mLocation.setText(r.getString(R.string.radioInfo_lac) + " = " + ((lac == -1) ? "unknown" : Integer.toHexString(lac)) @@ -782,8 +786,9 @@ public class RadioInfo extends Activity { s = phone.getDeviceId(); if (s == null) s = r.getString(R.string.radioInfo_unknown); - mImei.setText(s); + mDeviceId.setText(s); + s = phone.getLine1Number(); if (s == null) s = r.getString(R.string.radioInfo_unknown); number.setText(s); @@ -1030,7 +1035,7 @@ public class RadioInfo extends Activity { private MenuItem.OnMenuItemClickListener mViewSDNCallback = new MenuItem.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { Intent intent = new Intent( - Intent.ACTION_VIEW, Uri.parse("content://sim/sdn")); + Intent.ACTION_VIEW, Uri.parse("content://icc/sdn")); // XXX We need to specify the component here because if we don't // the activity manager will try to resolve the type by calling // the content provider, which causes it to be loaded in a process @@ -1085,7 +1090,7 @@ public class RadioInfo extends Activity { private MenuItem.OnMenuItemClickListener mGetPdpList = new MenuItem.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { - phone.getPdpContextList(null); + phone.getDataCallList(null); return true; } }; @@ -1122,8 +1127,7 @@ public class RadioInfo extends Activity { OnClickListener mDnsCheckButtonHandler = new OnClickListener() { public void onClick(View v) { - GSMPhone gsmPhone = (GSMPhone) phone; - gsmPhone.disableDnsCheck(!gsmPhone.isDnsCheckDisabled()); + phone.disableDnsCheck(!phone.isDnsCheckDisabled()); updateDnsCheckState(); } }; @@ -1182,3 +1186,4 @@ public class RadioInfo extends Activity { private String[] mPreferredNetworkLabels = { "WCDMA preferred", "GSM only", "WCDMA only", "Unknown"}; } + diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index 867bce3e4..b34388ed2 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -124,7 +124,7 @@ public class SecuritySettings extends PreferenceActivity simLockPreferences.setTitle(R.string.sim_lock_settings_category); // Intent to launch SIM lock settings intent = new Intent(); - intent.setClassName("com.android.settings", "com.android.settings.SimLockSettings"); + intent.setClassName("com.android.settings", "com.android.settings.IccLockSettings"); simLockPreferences.setIntent(intent); PreferenceCategory simLockCat = new PreferenceCategory(this); diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java index 9162d25d1..839e712d9 100644 --- a/src/com/android/settings/deviceinfo/Status.java +++ b/src/com/android/settings/deviceinfo/Status.java @@ -50,7 +50,7 @@ import java.lang.ref.WeakReference; * # Phone Number * # Network * # Roaming - * # IMEI + * # Device Id (IMEI in GSM and MEID in CDMA) * # Network type * # Signal Strength * # Battery Strength : TODO @@ -181,7 +181,9 @@ public class Status extends PreferenceActivity { mSignalStrength = findPreference("signal_strength"); mUptime = findPreference("up_time"); + //NOTE "imei" is the "Device ID" since it represents the IMEI in GSM and the MEID in CDMA setSummaryText("imei", mPhone.getDeviceId()); + setSummaryText("imei_sv", ((TelephonyManager) getSystemService(TELEPHONY_SERVICE)) .getDeviceSoftwareVersion()); @@ -379,3 +381,5 @@ public class Status extends PreferenceActivity { return h + ":" + pad(m) + ":" + pad(s); } } + + |