AI 144185: Integrate cdma into the main code base.

Automated import of CL 144185
This commit is contained in:
Wink Saville
2009-04-02 01:37:03 -07:00
committed by The Android Open Source Project
parent b20dd917e2
commit f9e024198d
8 changed files with 109 additions and 75 deletions

View File

@@ -240,7 +240,7 @@
</intent-filter>
</activity>
<activity android:name="SimLockSettings" android:label="@string/sim_lock_settings"
<activity android:name="IccLockSettings" android:label="@string/sim_lock_settings"
android:process="com.android.phone">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -442,7 +442,7 @@
</activity>
<activity android:name="ProxySelector" android:label="@string/proxy_settings_label"
android:theme="@android:style/Theme.Dialog">
android:theme="@android:style/Theme.Dialog">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
@@ -502,3 +502,5 @@
</manifest>

View File

@@ -291,6 +291,7 @@
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radio_info_data_attempts_label">Data attempts:</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radio_info_gprs_service_label">GPRS service:</string>
<!-- Radio Info screen. Label for a status item. Used for diagnostic info screens, precise translation isn't needed -->
<string name="radio_info_roaming_label">Roaming:</string>
@@ -433,6 +434,25 @@
<string name="radio_controls_summary">Manage Wi-Fi, Bluetooth, airplane mode, &amp; mobile networks</string>
<!-- mobile network settings screen, setting check box title -->
<string name="roaming">Data roaming</string>
<!-- mobile network settings screen, setting option summary text when check box is selected -->
<string name="roaming_enable">Connect to data services when roaming</string>
<!-- mobile network settings screen, setting option summary text when check box is clear -->
<string name="roaming_disable">Connect to data services when roaming</string>
<!-- mobile network settings screen, dialog message when you are roaming and clear the "Data roaming" check box -->
<string name="roaming_reenable_message">You have lost data connectivity because you left your home network with data roaming turned off.</string>
<!-- mobile network settings screen, button on dialog box that appears when you are roaming and clear the "Data roaming" check box -->
<string name="roaming_turn_it_on_button">Turn it on</string>
<!-- mobile network settings screen, message in dialog box that appears when you select the "Data roaming" check box -->
<string name="roaming_warning">Allow data roaming? You may incur significant roaming charges!</string>
<!-- mobile network settings screen, title of dialog box that appears when you select the "Data roaming" check box -->
<string name="roaming_reenable_title">Attention</string>
<!-- mobile network settings screen, setting option name -->
<string name="networks">Operator selection</string>
<!-- mobile network settings screen, setting option summary text -->
<string name="sum_carrier_select">Select a network operator</string>
<!-- Date and time settings -->
<!-- Main Settings screen setting option name to go into the date and time settings-->
<string name="date_and_time_settings_title">Date &amp; time</string>
@@ -1528,3 +1548,5 @@ found in the list of installed applications.</string>
<!-- label for usage time -->
<string name="usage_time_label">Usage time</string>
</resources>

View File

@@ -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

View File

@@ -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[] {

View File

@@ -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 com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import android.widget.Toast;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
/**
* 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();
}

View File

@@ -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"};
}

View File

@@ -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);

View File

@@ -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);
}
}