diff options
author | Chouting Zhang <MichaelZhang@motorola.com> | 2009-06-24 14:25:43 -0500 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2009-06-25 22:01:32 -0700 |
commit | 386278a338d740dce95b7fa1514662b0eb5683e4 (patch) | |
tree | 03df16b9c97743db7fab9efa481a7aae48c41233 /src/com | |
parent | d2e3b0139009b98be5ed825e58c38a325240594e (diff) | |
download | packages_apps_settings-386278a338d740dce95b7fa1514662b0eb5683e4.zip packages_apps_settings-386278a338d740dce95b7fa1514662b0eb5683e4.tar.gz packages_apps_settings-386278a338d740dce95b7fa1514662b0eb5683e4.tar.bz2 |
CDMA Settings additions
This patch implement CDMA Settings features
1. Add code to get MEID, MIN, and PRL value if the phone is a CDMA Phone
2. Display MEID, MIN, and PRL on Settings screen if it is a CDMA phone
3. Do not display IMSI, IMEI, and IMEI SV for a CDMA phone
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/settings/SecuritySettings.java | 29 | ||||
-rw-r--r-- | src/com/android/settings/SoundAndDisplaySettings.java | 25 | ||||
-rw-r--r-- | src/com/android/settings/deviceinfo/Status.java | 24 |
3 files changed, 63 insertions, 15 deletions
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index c17e2a0..ffeac34 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -41,6 +41,7 @@ import android.text.method.LinkMovementMethod; import android.widget.TextView; import com.android.internal.widget.LockPatternUtils; +import android.telephony.TelephonyManager; import java.util.Observable; import java.util.Observer; @@ -166,18 +167,24 @@ public class SecuritySettings extends PreferenceActivity implements mChoosePattern.setIntent(intent); inlinePrefCat.addPreference(mChoosePattern); - PreferenceScreen simLockPreferences = getPreferenceManager() - .createPreferenceScreen(this); - 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.IccLockSettings"); - simLockPreferences.setIntent(intent); + int activePhoneType = TelephonyManager.getDefault().getPhoneType(); + + // do not display SIM lock for CDMA phone + if (TelephonyManager.PHONE_TYPE_CDMA != activePhoneType) + { + PreferenceScreen simLockPreferences = getPreferenceManager() + .createPreferenceScreen(this); + 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.IccLockSettings"); + simLockPreferences.setIntent(intent); - PreferenceCategory simLockCat = new PreferenceCategory(this); - simLockCat.setTitle(R.string.sim_lock_settings_title); - root.addPreference(simLockCat); - simLockCat.addPreference(simLockPreferences); + PreferenceCategory simLockCat = new PreferenceCategory(this); + simLockCat.setTitle(R.string.sim_lock_settings_title); + root.addPreference(simLockCat); + simLockCat.addPreference(simLockPreferences); + } // Passwords PreferenceCategory passwordsCat = new PreferenceCategory(this); diff --git a/src/com/android/settings/SoundAndDisplaySettings.java b/src/com/android/settings/SoundAndDisplaySettings.java index 4111450..3d3a5d0 100644 --- a/src/com/android/settings/SoundAndDisplaySettings.java +++ b/src/com/android/settings/SoundAndDisplaySettings.java @@ -37,6 +37,7 @@ import android.preference.CheckBoxPreference; import android.provider.Settings; import android.util.Log; import android.view.IWindowManager; +import android.telephony.TelephonyManager; public class SoundAndDisplaySettings extends PreferenceActivity implements Preference.OnPreferenceChangeListener { @@ -44,6 +45,7 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements /** If there is no setting in the provider, use this. */ private static final int FALLBACK_SCREEN_TIMEOUT_VALUE = 30000; + private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0; private static final String KEY_SILENT = "silent"; private static final String KEY_VIBRATE = "vibrate"; @@ -54,6 +56,7 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements private static final String KEY_ACCELEROMETER = "accelerometer"; private static final String KEY_PLAY_MEDIA_NOTIFICATION_SOUNDS = "play_media_notification_sounds"; private static final String KEY_COMPATIBILITY_MODE = "compatibility_mode"; + private static final String KEY_EMERGENCY_TONE ="emergency_tone"; private CheckBoxPreference mSilent; @@ -91,6 +94,7 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ContentResolver resolver = getContentResolver(); + int activePhoneType = TelephonyManager.getDefault().getPhoneType(); mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window")); @@ -99,6 +103,11 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements addPreferencesFromResource(R.xml.sound_and_display_settings); + if (TelephonyManager.PHONE_TYPE_CDMA != activePhoneType) { + // device is not CDMA, do not display CDMA emergency_tone + getPreferenceScreen().removePreference(findPreference(KEY_EMERGENCY_TONE)); + } + mSilent = (CheckBoxPreference) findPreference(KEY_SILENT); mPlayMediaNotificationSounds = (CheckBoxPreference) findPreference(KEY_PLAY_MEDIA_NOTIFICATION_SOUNDS); @@ -125,6 +134,14 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements screenTimeoutPreference.setValue(String.valueOf(Settings.System.getInt( resolver, SCREEN_OFF_TIMEOUT, FALLBACK_SCREEN_TIMEOUT_VALUE))); screenTimeoutPreference.setOnPreferenceChangeListener(this); + + if (TelephonyManager.PHONE_TYPE_CDMA == activePhoneType) { + ListPreference emergencyTonePreference = + (ListPreference) findPreference(KEY_EMERGENCY_TONE); + emergencyTonePreference.setValue(String.valueOf(Settings.System.getInt( + resolver, Settings.System.EMERGENCY_TONE, FALLBACK_EMERGENCY_TONE_VALUE))); + emergencyTonePreference.setOnPreferenceChangeListener(this); + } } @Override @@ -273,6 +290,14 @@ public class SoundAndDisplaySettings extends PreferenceActivity implements } catch (NumberFormatException e) { Log.e(TAG, "could not persist screen timeout setting", e); } + } else if (KEY_EMERGENCY_TONE.equals(preference.getKey())) { + int value = Integer.parseInt((String) objValue); + try { + Settings.System.putInt(getContentResolver(), + Settings.System.EMERGENCY_TONE, value); + } catch (NumberFormatException e) { + Log.e(TAG, "could not persist emergency tone setting", e); + } } return true; diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java index ece5346..a165754 100644 --- a/src/com/android/settings/deviceinfo/Status.java +++ b/src/com/android/settings/deviceinfo/Status.java @@ -182,11 +182,27 @@ public class Status extends PreferenceActivity { 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)) + if (mPhone.getPhoneName().equals("CDMA")) { + setSummaryText("meid_number", mPhone.getMeid()); + setSummaryText("min_number", mPhone.getCdmaMin()); + setSummaryText("prl_version", mPhone.getCdmaPrlVersion()); + + // device is not GSM/UMTS, do not display GSM/UMTS features + getPreferenceScreen().removePreference(findPreference("imei")); + getPreferenceScreen().removePreference(findPreference("imei_sv")); + } else { + setSummaryText("imei", mPhone.getDeviceId()); + + setSummaryText("imei_sv", + ((TelephonyManager) getSystemService(TELEPHONY_SERVICE)) .getDeviceSoftwareVersion()); + + // device is not CDMA, do not display CDMA features + getPreferenceScreen().removePreference(findPreference("prl_version")); + getPreferenceScreen().removePreference(findPreference("meid_number")); + getPreferenceScreen().removePreference(findPreference("min_number")); + } + setSummaryText("number", mPhone.getLine1Number()); mPhoneStateReceiver = new PhoneStateIntentReceiver(this, mHandler); |