Permalink
Browse files

Use telephony-common - DO NOT MERGE

Change-Id: I1710418850040fc20afff4795ee4a85027203fc9
  • Loading branch information...
1 parent b24309d commit 086249ce77a15d7a98857cadef39287c6e53e56f Wink Saville committed with Jean-Baptiste Queru Jun 14, 2012
Showing with 269 additions and 238 deletions.
  1. +1 −0 Android.mk
  2. +15 −14 src/com/android/phone/BluetoothHandsfree.java
  3. +32 −29 src/com/android/phone/CallCard.java
  4. +3 −2 src/com/android/phone/CallController.java
  5. +4 −3 src/com/android/phone/CallFeaturesSetting.java
  6. +26 −25 src/com/android/phone/CallNotifier.java
  7. +2 −1 src/com/android/phone/CdmaCallOptions.java
  8. +2 −1 src/com/android/phone/CdmaOptions.java
  9. +3 −2 src/com/android/phone/EmergencyCallHelper.java
  10. +2 −1 src/com/android/phone/EmergencyCallbackModeService.java
  11. +2 −1 src/com/android/phone/GsmUmtsCallOptions.java
  12. +2 −1 src/com/android/phone/GsmUmtsOptions.java
  13. +3 −2 src/com/android/phone/InCallControlState.java
  14. +34 −33 src/com/android/phone/InCallScreen.java
  15. +12 −11 src/com/android/phone/InCallTouchUi.java
  16. +6 −5 src/com/android/phone/MobileNetworkSettings.java
  17. +5 −3 src/com/android/phone/NotificationMgr.java
  18. +5 −4 src/com/android/phone/OtaUtils.java
  19. +2 −1 src/com/android/phone/OutgoingCallBroadcaster.java
  20. +27 −25 src/com/android/phone/PhoneApp.java
  21. +9 −8 src/com/android/phone/PhoneInterfaceManager.java
  22. +51 −50 src/com/android/phone/PhoneUtils.java
  23. +6 −5 src/com/android/phone/RespondViaSmsManager.java
  24. +3 −2 src/com/android/phone/SipBroadcastReceiver.java
  25. +2 −2 src/com/android/phone/SpecialCharSequenceMgr.java
  26. +2 −1 src/com/android/phone/sip/SipEditor.java
  27. +4 −2 src/com/android/phone/sip/SipSettings.java
  28. +4 −4 tests/src/com/android/phone/unit/CnapTest.java
View
@@ -20,6 +20,7 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
+LOCAL_JAVA_LIBRARIES := telephony-common
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += \
src/com/android/phone/EventLogTags.logtags \
@@ -53,6 +53,7 @@
import com.android.internal.telephony.Call;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.CallManager;
@@ -126,7 +127,7 @@
private final BluetoothPhoneState mBluetoothPhoneState; // for CIND and CIEV updates
private final BluetoothAtPhonebook mPhonebook;
- private Phone.State mPhoneState = Phone.State.IDLE;
+ private PhoneConstants.State mPhoneState = PhoneConstants.State.IDLE;
CdmaPhoneCallState.PhoneCallState mCdmaThreeWayCallState =
CdmaPhoneCallState.PhoneCallState.IDLE;
@@ -1019,10 +1020,10 @@ private synchronized void handlePreciseCallStateChange(boolean sendUpdate,
// This function will get called when the Precise Call State
// {@link Call.State} changes. Hence, we might get this update
- // even if the {@link Phone.state} is same as before.
+ // even if the {@link PhoneConstants.state} is same as before.
// Check for the same.
- Phone.State newState = mCM.getState();
+ PhoneConstants.State newState = mCM.getState();
if (newState != mPhoneState) {
mPhoneState = newState;
switch (mPhoneState) {
@@ -1049,7 +1050,7 @@ private synchronized void handlePreciseCallStateChange(boolean sendUpdate,
// +BLND: OK response
// There is a special case handling of the same case
// for CDMA below
- if (mCM.getFgPhone().getPhoneType() == Phone.PHONE_TYPE_GSM) {
+ if (mCM.getFgPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
callStarted();
}
break;
@@ -1131,7 +1132,7 @@ private synchronized void handlePreciseCallStateChange(boolean sendUpdate,
}
}
- if (mCM.getDefaultPhone().getPhoneType() == Phone.PHONE_TYPE_CDMA) {
+ if (mCM.getDefaultPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
PhoneApp app = PhoneApp.getInstance();
if (app.cdmaPhoneCallState != null) {
CdmaPhoneCallState.PhoneCallState currCdmaThreeWayCallState =
@@ -1194,7 +1195,7 @@ private synchronized void handlePreciseCallStateChange(boolean sendUpdate,
boolean callsSwitched;
- if (mCM.getDefaultPhone().getPhoneType() == Phone.PHONE_TYPE_CDMA &&
+ if (mCM.getDefaultPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA &&
mCdmaThreeWayCallState == CdmaPhoneCallState.PhoneCallState.CONF_CALL) {
callsSwitched = mCdmaCallsSwapped;
} else {
@@ -2321,9 +2322,9 @@ public AtCommandResult handleActionCommand() {
result.addResponse(args);
return result;
}
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
return cdmaGetClccResult();
- } else if (phoneType == Phone.PHONE_TYPE_GSM) {
+ } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
return gsmGetClccResult();
} else {
throw new IllegalStateException("Unexpected phone type: " + phoneType);
@@ -2353,7 +2354,7 @@ public AtCommandResult handleSetCommand(Object[] args) {
return new AtCommandResult(AtCommandResult.ERROR);
}
} else if (args[0].equals(1)) {
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
if (ringingCall.isRinging()) {
// Hangup the active call and then answer call waiting call.
if (VDBG) log("CHLD:1 Callwaiting Answer call");
@@ -2366,7 +2367,7 @@ public AtCommandResult handleSetCommand(Object[] args) {
PhoneUtils.hangup(PhoneApp.getInstance().mCM);
}
return new AtCommandResult(AtCommandResult.OK);
- } else if (phoneType == Phone.PHONE_TYPE_GSM) {
+ } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
// Hangup active call, answer held call
if (PhoneUtils.answerAndEndActive(
PhoneApp.getInstance().mCM, ringingCall)) {
@@ -2379,7 +2380,7 @@ public AtCommandResult handleSetCommand(Object[] args) {
}
} else if (args[0].equals(2)) {
sendURC("OK");
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
// For CDMA, the way we switch to a new incoming call is by
// calling PhoneUtils.answerCall(). switchAndHoldActive() won't
// properly update the call state within telephony.
@@ -2399,15 +2400,15 @@ public AtCommandResult handleSetCommand(Object[] args) {
// Toggle the second callers active state flag
cdmaSwapSecondCallState();
}
- } else if (phoneType == Phone.PHONE_TYPE_GSM) {
+ } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
PhoneUtils.switchHoldingAndActive(backgroundCall);
} else {
throw new IllegalStateException("Unexpected phone type: " + phoneType);
}
return new AtCommandResult(AtCommandResult.UNSOLICITED);
} else if (args[0].equals(3)) {
sendURC("OK");
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
CdmaPhoneCallState.PhoneCallState state =
PhoneApp.getInstance().cdmaPhoneCallState.getCurrentCallState();
// For CDMA, we need to check if the call is in THRWAY_ACTIVE state
@@ -2419,7 +2420,7 @@ public AtCommandResult handleSetCommand(Object[] args) {
// This can happen when CONF_CALL was entered from a Call Waiting
mBluetoothPhoneState.updateCallHeld();
}
- } else if (phoneType == Phone.PHONE_TYPE_GSM) {
+ } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
if (mCM.hasActiveFgCall() && mCM.hasActiveBgCall()) {
PhoneUtils.mergeCalls();
}
@@ -47,6 +47,7 @@
import com.android.internal.telephony.CallerInfoAsyncQuery;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneConstants;
import java.util.List;
@@ -249,7 +250,7 @@ protected void onFinishInflate() {
// Update the onscreen UI based on the current state of the phone.
- Phone.State state = cm.getState(); // IDLE, RINGING, or OFFHOOK
+ PhoneConstants.State state = cm.getState(); // IDLE, RINGING, or OFFHOOK
Call ringingCall = cm.getFirstActiveRingingCall();
Call fgCall = cm.getActiveFgCall();
Call bgCall = cm.getFirstActiveBgCall();
@@ -312,8 +313,8 @@ protected void onFinishInflate() {
* Updates the overall size and positioning of mCallInfoContainer and
* the "Call info" blocks, based on the phone state.
*/
- private void updateCallInfoLayout(Phone.State state) {
- boolean ringing = (state == Phone.State.RINGING);
+ private void updateCallInfoLayout(PhoneConstants.State state) {
+ boolean ringing = (state == PhoneConstants.State.RINGING);
if (DBG) log("updateCallInfoLayout()... ringing = " + ringing);
// Based on the current state, update the overall
@@ -361,7 +362,7 @@ private void updateForegroundCall(CallManager cm) {
Phone phone = fgCall.getPhone();
int phoneType = phone.getPhoneType();
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
if ((mApplication.cdmaPhoneCallState.getCurrentCallState()
== CdmaPhoneCallState.PhoneCallState.THRWAY_ACTIVE)
&& mApplication.cdmaPhoneCallState.IsThreeWayCallOrigStateDialing()) {
@@ -371,8 +372,8 @@ private void updateForegroundCall(CallManager cm) {
// we need to clean up the background call area.
displaySecondaryCallStatus(cm, bgCall);
}
- } else if ((phoneType == Phone.PHONE_TYPE_GSM)
- || (phoneType == Phone.PHONE_TYPE_SIP)) {
+ } else if ((phoneType == PhoneConstants.PHONE_TYPE_GSM)
+ || (phoneType == PhoneConstants.PHONE_TYPE_SIP)) {
displaySecondaryCallStatus(cm, bgCall);
}
}
@@ -523,10 +524,10 @@ private void displayMainCallStatus(CallManager cm, Call call) {
// has only one connection.)
Connection conn = null;
int phoneType = call.getPhone().getPhoneType();
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
conn = call.getLatestConnection();
- } else if ((phoneType == Phone.PHONE_TYPE_GSM)
- || (phoneType == Phone.PHONE_TYPE_SIP)) {
+ } else if ((phoneType == PhoneConstants.PHONE_TYPE_GSM)
+ || (phoneType == PhoneConstants.PHONE_TYPE_SIP)) {
conn = call.getEarliestConnection();
} else {
throw new IllegalStateException("Unexpected phone type: " + phoneType);
@@ -539,7 +540,8 @@ private void displayMainCallStatus(CallManager cm, Call call) {
// with the current implementation of getCallerInfo and
// updateDisplayForPerson.
CallerInfo info = PhoneUtils.getCallerInfo(getContext(), null /* conn */);
- updateDisplayForPerson(info, Connection.PRESENTATION_ALLOWED, false, call, conn);
+ updateDisplayForPerson(info, PhoneConstants.PRESENTATION_ALLOWED, false, call,
+ conn);
} else {
if (DBG) log(" - CONN: " + conn + ", state = " + conn.getState());
int presentation = conn.getNumberPresentation();
@@ -557,7 +559,7 @@ private void displayMainCallStatus(CallManager cm, Call call) {
// Adding a check to see if the update was caused due to a Phone number update
// or CNAP update. If so then we need to start a new query
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
Object obj = conn.getUserData();
String updatedNumber = conn.getAddress();
String updatedCnapName = conn.getCnapName();
@@ -660,18 +662,18 @@ public void onQueryComplete(int token, Object cookie, CallerInfo ci) {
Call call = (Call) cookie;
Connection conn = null;
int phoneType = call.getPhone().getPhoneType();
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
conn = call.getLatestConnection();
- } else if ((phoneType == Phone.PHONE_TYPE_GSM)
- || (phoneType == Phone.PHONE_TYPE_SIP)) {
+ } else if ((phoneType == PhoneConstants.PHONE_TYPE_GSM)
+ || (phoneType == PhoneConstants.PHONE_TYPE_SIP)) {
conn = call.getEarliestConnection();
} else {
throw new IllegalStateException("Unexpected phone type: " + phoneType);
}
PhoneUtils.CallerInfoToken cit =
PhoneUtils.startGetCallerInfo(getContext(), conn, this, null);
- int presentation = Connection.PRESENTATION_ALLOWED;
+ int presentation = PhoneConstants.PRESENTATION_ALLOWED;
if (conn != null) presentation = conn.getNumberPresentation();
if (DBG) log("- onQueryComplete: presentation=" + presentation
+ ", contactExists=" + ci.contactExists);
@@ -680,7 +682,7 @@ public void onQueryComplete(int token, Object cookie, CallerInfo ci) {
// CallerInfo (for CNAP). Therefore if ci.contactExists then use the ci passed in.
// Otherwise, regenerate the CIT from the Connection and use the CallerInfo from there.
if (ci.contactExists) {
- updateDisplayForPerson(ci, Connection.PRESENTATION_ALLOWED, false, call, conn);
+ updateDisplayForPerson(ci, PhoneConstants.PRESENTATION_ALLOWED, false, call, conn);
} else {
updateDisplayForPerson(cit.currentInfo, presentation, false, call, conn);
}
@@ -802,7 +804,7 @@ private void updateCallStateWidgets(Call call) {
// Check a couple of other special cases (these are all CDMA-specific).
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
if ((state == Call.State.ACTIVE)
&& mApplication.cdmaPhoneCallState.IsThreeWayCallOrigStateDialing()) {
// Display "Dialing" while dialing a 3Way call, even
@@ -991,7 +993,7 @@ private void displaySecondaryCallStatus(CallManager cm, Call call) {
// CDMA: This is because in CDMA when the user originates the second call,
// although the Foreground call state is still ACTIVE in reality the network
// put the first call on hold.
- if (mApplication.phone.getPhoneType() == Phone.PHONE_TYPE_CDMA) {
+ if (mApplication.phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
showSecondaryCallInfo();
List<Connection> connections = call.getConnections();
@@ -1018,7 +1020,7 @@ private void displaySecondaryCallStatus(CallManager cm, Call call) {
String name = PhoneUtils.getCompactNameFromCallerInfo(info, getContext());
boolean forceGenericPhoto = false;
if (info != null && info.numberPresentation !=
- Connection.PRESENTATION_ALLOWED) {
+ PhoneConstants.PRESENTATION_ALLOWED) {
name = PhoneUtils.getPresentationString(
getContext(), info.numberPresentation);
forceGenericPhoto = true;
@@ -1233,7 +1235,7 @@ private void updateDisplayForPerson(CallerInfo info,
// (or potentially some other default based on the presentation.)
displayName = PhoneUtils.getPresentationString(getContext(), presentation);
if (DBG) log(" ==> no name *or* number! displayName = " + displayName);
- } else if (presentation != Connection.PRESENTATION_ALLOWED) {
+ } else if (presentation != PhoneConstants.PRESENTATION_ALLOWED) {
// This case should never happen since the network should never send a phone #
// AND a restricted presentation. However we leave it here in case of weird
// network behavior
@@ -1270,7 +1272,7 @@ private void updateDisplayForPerson(CallerInfo info,
} else {
// We do have a valid "name" in the CallerInfo. Display that
// in the "name" slot, and the phone number in the "number" slot.
- if (presentation != Connection.PRESENTATION_ALLOWED) {
+ if (presentation != PhoneConstants.PRESENTATION_ALLOWED) {
// This case should never happen since the network should never send a name
// AND a restricted presentation. However we leave it here in case of weird
// network behavior
@@ -1384,7 +1386,7 @@ private void updateDisplayForConference(Call call) {
if (DBG) log("updateDisplayForConference()...");
int phoneType = call.getPhone().getPhoneType();
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
// This state corresponds to both 3-Way merged call and
// Call Waiting accepted call.
// In this case we display the UI in a "generic" state, with
@@ -1393,8 +1395,8 @@ private void updateDisplayForConference(Call call) {
// which caller party he is talking to.
showImage(mPhoto, R.drawable.picture_dialing);
mName.setText(R.string.card_title_in_call);
- } else if ((phoneType == Phone.PHONE_TYPE_GSM)
- || (phoneType == Phone.PHONE_TYPE_SIP)) {
+ } else if ((phoneType == PhoneConstants.PHONE_TYPE_GSM)
+ || (phoneType == PhoneConstants.PHONE_TYPE_SIP)) {
// Normal GSM (or possibly SIP?) conference call.
// Display the "conference call" image as the contact photo.
// TODO: Better visual treatment for contact photos in a
@@ -1490,10 +1492,10 @@ private void updatePhotoForCallState(Call call) {
{
Connection conn = null;
int phoneType = call.getPhone().getPhoneType();
- if (phoneType == Phone.PHONE_TYPE_CDMA) {
+ if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
conn = call.getLatestConnection();
- } else if ((phoneType == Phone.PHONE_TYPE_GSM)
- || (phoneType == Phone.PHONE_TYPE_SIP)) {
+ } else if ((phoneType == PhoneConstants.PHONE_TYPE_GSM)
+ || (phoneType == PhoneConstants.PHONE_TYPE_SIP)) {
conn = call.getEarliestConnection();
} else {
throw new IllegalStateException("Unexpected phone type: " + phoneType);
@@ -1629,8 +1631,9 @@ private String getECMCardTitle(Context context, Phone phone) {
* and/or icon to be displayed here.)
*/
private void updateCallTypeLabel(Call call) {
- int phoneType = (call != null) ? call.getPhone().getPhoneType() : Phone.PHONE_TYPE_NONE;
- if (phoneType == Phone.PHONE_TYPE_SIP) {
+ int phoneType = (call != null) ? call.getPhone().getPhoneType() :
+ PhoneConstants.PHONE_TYPE_NONE;
+ if (phoneType == PhoneConstants.PHONE_TYPE_SIP) {
mCallTypeLabel.setVisibility(View.VISIBLE);
mCallTypeLabel.setText(R.string.incall_call_type_label_sip);
mCallTypeLabel.setTextColor(mTextColorCallTypeSip);
Oops, something went wrong.

0 comments on commit 086249c

Please sign in to comment.