Permalink
Browse files

Add NT_MODE's for NETWORK_MODE's 8 and 10

as defined in RILConstants.java
and fix force closes when phone is not yet ready

Change-Id: I225bb776152e4c63ade1f70669edb2df3986634c
Signed-off-by: dhacker29 <davidhackerdvm@gmail.com>
  • Loading branch information...
dhacker29 authored and Whitehawkx committed Jul 10, 2012
1 parent 08d162f commit 96d324b627da352d6007477146925783fc760d6c
View
@@ -364,8 +364,18 @@
<string name="preferred_network_mode_evdo_only_summary">Preferred network mode: EvDo only</string>
<!-- Mobile network settings, summary for preferred network mode LTE / CDMA[CHAR LIMIT=100] -->
<string name="preferred_network_mode_lte_cdma_summary">Preferred network mode: LTE / CDMA</string>
+ <!-- Mobile network settings, summary for preferred network mode LTE / GSM[CHAR LIMIT=100] -->
+ <string name="preferred_network_mode_lte_gsm_summary">Preferred network mode: LTE / WCDMA / GSM</string>
+ <!-- Mobile network settings, summary for preferred network mode LTE / CDMA / EvDo[CHAR LIMIT=100] -->
+ <string name="preferred_network_mode_lte_cdma_evdo_summary">Preferred network mode: LTE / CDMA / EvDo</string>
+ <!-- Mobile network settings, summary for preferred network mode LTE / CMDA / EvDo / GSM/WCDMACHAR LIMIT=100] -->
+ <string name="preferred_network_mode_lte_cdma_evdo_gsm_wcdma_summary">Preferred network mode: LTE / CMDA / EvDo / GSM/WCDMA</string>
<string-array name="preferred_network_mode_choices">
+ <item>LTE ONLY</item>
+ <item>LTE/CMDA/EvDo/GSM/WCDMA</item>
+ <item>LTE/WCDMA/GSM</item>
+ <item>LTE/CDMA/ EvDo</item>
<item>LTE/CDMA</item>
<item>EvDo only</item>
<item>CDMA w/o EvDo</item>
@@ -376,6 +386,10 @@
<item>GSM/WCDMA preferred</item>
</string-array>
<string-array name="preferred_network_mode_values" translatable="false">
+ <item>"11"</item>
+ <item>"10"</item>
+ <item>"9"</item>
+ <item>"8"</item>
<item>"7"</item>
<item>"6"</item>
<item>"5"</item>
@@ -387,10 +401,14 @@
</string-array>
<!-- Mobile network settings, network mode choices for a device supporting CDMA and LTE [CHAR LIMIT=25] -->
<string-array name="preferred_network_mode_choices_lte">
+ <item>LTE ONLY</item>
+ <item>LTE/CMDA/EvDo/GSM/WCDMA</item>
<item>LTE/CDMA</item>
- <item>CDMA</item>
+ <item>CDMA/EvDo auto</item>
</string-array>
<string-array name="preferred_network_mode_values_lte" translatable="false">
+ <item>"11"</item>
+ <item>"10"</item>
<item>"7"</item>
<item>"4"</item>
</string-array>
@@ -1038,6 +1038,9 @@ private synchronized void handlePreciseCallStateChange(boolean sendUpdate,
}
}
+ /* phone not setup yet */
+ if (foregroundCall == null) return;
+
switch(foregroundCall.getState()) {
case ACTIVE:
call = 1;
@@ -363,8 +363,14 @@ private CallStatusCode placeCallInternal(Intent intent) {
if (VDBG) log("- got Phone instance: " + phone + ", class = " + phone.getClass());
// update okToCallStatus based on new phone
- okToCallStatus = checkIfOkToInitiateOutgoingCall(
- phone.getServiceState().getState());
+ if (phone.getServiceState() != null) {
+ okToCallStatus = checkIfOkToInitiateOutgoingCall(
+ phone.getServiceState().getState());
+ }
+ else {
+ log(">>>> phone.getServiceState == NULL, setting CallStatusCode.OUT_OF_SERVICE");
+ return CallStatusCode.OUT_OF_SERVICE;
+ }
} catch (PhoneUtils.VoiceMailNumberMissingException ex) {
// If the call status is NOT in an acceptable state, it
@@ -757,18 +757,20 @@ private void onPhoneStateChanged(AsyncResult r) {
.enableNotificationAlerts(state == Phone.State.IDLE);
Phone fgPhone = mCM.getFgPhone();
- if (fgPhone.getPhoneType() == Phone.PHONE_TYPE_CDMA) {
- if ((fgPhone.getForegroundCall().getState() == Call.State.ACTIVE)
- && ((mPreviousCdmaCallState == Call.State.DIALING)
- || (mPreviousCdmaCallState == Call.State.ALERTING))) {
- if (mIsCdmaRedialCall) {
- int toneToPlay = InCallTonePlayer.TONE_REDIAL;
- new InCallTonePlayer(toneToPlay).start();
- }
- // Stop any signal info tone when call moves to ACTIVE state
+ if (fgPhone != null) {
+ if (fgPhone.getPhoneType() == Phone.PHONE_TYPE_CDMA) {
+ if ((fgPhone.getForegroundCall().getState() == Call.State.ACTIVE)
+ && ((mPreviousCdmaCallState == Call.State.DIALING)
+ || (mPreviousCdmaCallState == Call.State.ALERTING))) {
+ if (mIsCdmaRedialCall) {
+ int toneToPlay = InCallTonePlayer.TONE_REDIAL;
+ new InCallTonePlayer(toneToPlay).start();
+ }
+ // Stop any signal info tone when call moves to ACTIVE state
stopSignalInfoTone();
+ }
+ mPreviousCdmaCallState = fgPhone.getForegroundCall().getState();
}
- mPreviousCdmaCallState = fgPhone.getForegroundCall().getState();
}
// Have the PhoneApp recompute its mShowBluetoothIndication
@@ -830,45 +832,47 @@ private void onPhoneStateChanged(AsyncResult r) {
IN_CALL_NOTIFICATION_UPDATE_DELAY);
}
- if (fgPhone.getPhoneType() == Phone.PHONE_TYPE_CDMA) {
- Connection c = fgPhone.getForegroundCall().getLatestConnection();
- if ((c != null) && (PhoneNumberUtils.isLocalEmergencyNumber(c.getAddress(),
+ if (fgPhone != null) {
+ if (fgPhone.getPhoneType() == Phone.PHONE_TYPE_CDMA) {
+ Connection c = fgPhone.getForegroundCall().getLatestConnection();
+ if ((c != null) && (PhoneNumberUtils.isLocalEmergencyNumber(c.getAddress(),
mApplication))) {
- if (VDBG) log("onPhoneStateChanged: it is an emergency call.");
- Call.State callState = fgPhone.getForegroundCall().getState();
- if (mEmergencyTonePlayerVibrator == null) {
- mEmergencyTonePlayerVibrator = new EmergencyTonePlayerVibrator();
- }
+ if (VDBG) log("onPhoneStateChanged: it is an emergency call.");
+ Call.State callState = fgPhone.getForegroundCall().getState();
+ if (mEmergencyTonePlayerVibrator == null) {
+ mEmergencyTonePlayerVibrator = new EmergencyTonePlayerVibrator();
+ }
- if (callState == Call.State.DIALING || callState == Call.State.ALERTING) {
- mIsEmergencyToneOn = Settings.System.getInt(
- mApplication.getContentResolver(),
- Settings.System.EMERGENCY_TONE, EMERGENCY_TONE_OFF);
- if (mIsEmergencyToneOn != EMERGENCY_TONE_OFF &&
- mCurrentEmergencyToneState == EMERGENCY_TONE_OFF) {
- if (mEmergencyTonePlayerVibrator != null) {
- mEmergencyTonePlayerVibrator.start();
+ if (callState == Call.State.DIALING || callState == Call.State.ALERTING) {
+ mIsEmergencyToneOn = Settings.System.getInt(
+ mApplication.getContentResolver(),
+ Settings.System.EMERGENCY_TONE, EMERGENCY_TONE_OFF);
+ if (mIsEmergencyToneOn != EMERGENCY_TONE_OFF &&
+ mCurrentEmergencyToneState == EMERGENCY_TONE_OFF) {
+ if (mEmergencyTonePlayerVibrator != null) {
+ mEmergencyTonePlayerVibrator.start();
+ }
}
- }
- } else if (callState == Call.State.ACTIVE) {
- if (mCurrentEmergencyToneState != EMERGENCY_TONE_OFF) {
- if (mEmergencyTonePlayerVibrator != null) {
- mEmergencyTonePlayerVibrator.stop();
+ } else if (callState == Call.State.ACTIVE) {
+ if (mCurrentEmergencyToneState != EMERGENCY_TONE_OFF) {
+ if (mEmergencyTonePlayerVibrator != null) {
+ mEmergencyTonePlayerVibrator.stop();
+ }
}
}
}
}
- }
- if ((fgPhone.getPhoneType() == Phone.PHONE_TYPE_GSM)
- || (fgPhone.getPhoneType() == Phone.PHONE_TYPE_SIP)) {
- Call.State callState = mCM.getActiveFgCallState();
- if (!callState.isDialing()) {
- // If call get activated or disconnected before the ringback
- // tone stops, we have to stop it to prevent disturbing.
- if (mInCallRingbackTonePlayer != null) {
- mInCallRingbackTonePlayer.stopTone();
- mInCallRingbackTonePlayer = null;
+ if ((fgPhone.getPhoneType() == Phone.PHONE_TYPE_GSM)
+ || (fgPhone.getPhoneType() == Phone.PHONE_TYPE_SIP)) {
+ Call.State callState = mCM.getActiveFgCallState();
+ if (!callState.isDialing()) {
+ // If call get activated or disconnected before the ringback
+ // tone stops, we have to stop it to prevent disturbing.
+ if (mInCallRingbackTonePlayer != null) {
+ mInCallRingbackTonePlayer.stopTone();
+ mInCallRingbackTonePlayer = null;
+ }
}
}
}
@@ -344,6 +344,12 @@ public boolean onPreferenceChange(Preference preference, Object objValue) {
case Phone.NT_MODE_CDMA:
modemNetworkMode = Phone.NT_MODE_CDMA;
break;
+ case Phone.NT_MODE_LTE_CDMA_EVDO:
+ modemNetworkMode = Phone.NT_MODE_LTE_CDMA_EVDO;
+ break;
+ case Phone.NT_MODE_LTE_CMDA_EVDO_GSM_WCDMA:
+ modemNetworkMode = Phone.NT_MODE_LTE_CMDA_EVDO_GSM_WCDMA;
+ break;
case Phone.NT_MODE_GSM_UMTS:
modemNetworkMode = Phone.NT_MODE_GSM_UMTS;
break;
@@ -356,6 +362,9 @@ public boolean onPreferenceChange(Preference preference, Object objValue) {
case Phone.NT_MODE_WCDMA_PREF:
modemNetworkMode = Phone.NT_MODE_WCDMA_PREF;
break;
+ case Phone.NT_MODE_LTE_GSM_WCDMA:
+ modemNetworkMode = Phone.NT_MODE_LTE_GSM_WCDMA;
+ break;
default:
modemNetworkMode = Phone.PREFERRED_NT_MODE;
}
@@ -430,6 +439,9 @@ private void handleGetPreferredNetworkTypeResponse(Message msg) {
modemNetworkMode == Phone.NT_MODE_CDMA ||
modemNetworkMode == Phone.NT_MODE_CDMA_NO_EVDO ||
modemNetworkMode == Phone.NT_MODE_EVDO_NO_CDMA ||
+ modemNetworkMode == Phone.NT_MODE_LTE_CDMA_EVDO ||
+ modemNetworkMode == Phone.NT_MODE_LTE_CMDA_EVDO_GSM_WCDMA ||
+ modemNetworkMode == Phone.NT_MODE_LTE_GSM_WCDMA ||
modemNetworkMode == Phone.NT_MODE_GLOBAL ) {
if (DBG) {
log("handleGetPreferredNetworkTypeResponse: if 1: modemNetworkMode = " +
@@ -535,6 +547,18 @@ private void UpdatePreferredNetworkModeSummary(int NetworkMode) {
mButtonPreferredNetworkMode.setSummary(
R.string.preferred_network_mode_evdo_only_summary);
break;
+ case Phone.NT_MODE_LTE_GSM_WCDMA:
+ mButtonPreferredNetworkMode.setSummary(
+ R.string.preferred_network_mode_lte_gsm_summary);
+ break;
+ case Phone.NT_MODE_LTE_CDMA_EVDO:
+ mButtonPreferredNetworkMode.setSummary(
+ R.string.preferred_network_mode_lte_cdma_evdo_summary);
+ break;
+ case Phone.NT_MODE_LTE_CMDA_EVDO_GSM_WCDMA:
+ mButtonPreferredNetworkMode.setSummary(
+ R.string.preferred_network_mode_lte_cdma_evdo_gsm_wcdma_summary);
+ break;
case Phone.NT_MODE_GLOBAL:
default:
mButtonPreferredNetworkMode.setSummary(
@@ -1990,17 +1990,19 @@ static void setMute(boolean muted) {
*/
private static void setMuteInternal(Phone phone, boolean muted) {
final PhoneApp app = PhoneApp.getInstance();
- Context context = phone.getContext();
- boolean routeToAudioManager =
- context.getResources().getBoolean(R.bool.send_mic_mute_to_AudioManager);
- if (routeToAudioManager) {
- AudioManager audioManager =
- (AudioManager) phone.getContext().getSystemService(Context.AUDIO_SERVICE);
- if (DBG) log("setMuteInternal: using setMicrophoneMute(" + muted + ")...");
- audioManager.setMicrophoneMute(muted);
- } else {
- if (DBG) log("setMuteInternal: using phone.setMute(" + muted + ")...");
- phone.setMute(muted);
+ if (phone != null) {
+ Context context = phone.getContext();
+ boolean routeToAudioManager =
+ context.getResources().getBoolean(R.bool.send_mic_mute_to_AudioManager);
+ if (routeToAudioManager) {
+ AudioManager audioManager =
+ (AudioManager) phone.getContext().getSystemService(Context.AUDIO_SERVICE);
+ if (DBG) log("setMuteInternal: using setMicrophoneMute(" + muted + ")...");
+ audioManager.setMicrophoneMute(muted);
+ } else {
+ if (DBG) log("setMuteInternal: using phone.setMute(" + muted + ")...");
+ phone.setMute(muted);
+ }
}
app.notificationMgr.updateMuteNotification();
}

0 comments on commit 96d324b

Please sign in to comment.