use of com.android.internal.telephony.gsm.GsmConnection in project XobotOS by xamarin.
the class GsmCallTracker method handleMessage.
//****** Overridden from Handler
public void handleMessage(Message msg) {
AsyncResult ar;
switch(msg.what) {
case EVENT_POLL_CALLS_RESULT:
ar = (AsyncResult) msg.obj;
if (msg == lastRelevantPoll) {
if (DBG_POLL)
log("handle EVENT_POLL_CALL_RESULT: set needsPoll=F");
needsPoll = false;
lastRelevantPoll = null;
handlePollCalls((AsyncResult) msg.obj);
}
break;
case EVENT_OPERATION_COMPLETE:
ar = (AsyncResult) msg.obj;
operationComplete();
break;
case EVENT_SWITCH_RESULT:
case EVENT_CONFERENCE_RESULT:
case EVENT_SEPARATE_RESULT:
case EVENT_ECT_RESULT:
ar = (AsyncResult) msg.obj;
if (ar.exception != null) {
phone.notifySuppServiceFailed(getFailedService(msg.what));
}
operationComplete();
break;
case EVENT_GET_LAST_CALL_FAIL_CAUSE:
int causeCode;
ar = (AsyncResult) msg.obj;
operationComplete();
if (ar.exception != null) {
// An exception occurred...just treat the disconnect
// cause as "normal"
causeCode = CallFailCause.NORMAL_CLEARING;
Log.i(LOG_TAG, "Exception during getLastCallFailCause, assuming normal disconnect");
} else {
causeCode = ((int[]) ar.result)[0];
}
// Log the causeCode if its not normal
if (causeCode == CallFailCause.NO_CIRCUIT_AVAIL || causeCode == CallFailCause.TEMPORARY_FAILURE || causeCode == CallFailCause.SWITCHING_CONGESTION || causeCode == CallFailCause.CHANNEL_NOT_AVAIL || causeCode == CallFailCause.QOS_NOT_AVAIL || causeCode == CallFailCause.BEARER_NOT_AVAIL || causeCode == CallFailCause.ERROR_UNSPECIFIED) {
GsmCellLocation loc = ((GsmCellLocation) phone.getCellLocation());
EventLog.writeEvent(EventLogTags.CALL_DROP, causeCode, loc != null ? loc.getCid() : -1, TelephonyManager.getDefault().getNetworkType());
}
for (int i = 0, s = droppedDuringPoll.size(); i < s; i++) {
GsmConnection conn = droppedDuringPoll.get(i);
conn.onRemoteDisconnect(causeCode);
}
updatePhoneState();
phone.notifyPreciseCallStateChanged();
droppedDuringPoll.clear();
break;
case EVENT_REPOLL_AFTER_DELAY:
case EVENT_CALL_STATE_CHANGE:
pollCallsWhenSafe();
break;
case EVENT_RADIO_AVAILABLE:
handleRadioAvailable();
break;
case EVENT_RADIO_NOT_AVAILABLE:
handleRadioNotAvailable();
break;
}
}
use of com.android.internal.telephony.gsm.GsmConnection in project XobotOS by xamarin.
the class GsmCallTracker method hangupAllConnections.
void hangupAllConnections(GsmCall call) throws CallStateException {
try {
int count = call.connections.size();
for (int i = 0; i < count; i++) {
GsmConnection cn = (GsmConnection) call.connections.get(i);
cm.hangupConnection(cn.getGSMIndex(), obtainCompleteMessage());
}
} catch (CallStateException ex) {
Log.e(LOG_TAG, "hangupConnectionByIndex caught " + ex);
}
}
use of com.android.internal.telephony.gsm.GsmConnection in project XobotOS by xamarin.
the class GsmCallTracker method dispose.
public void dispose() {
//Unregister for all events
cm.unregisterForCallStateChanged(this);
cm.unregisterForOn(this);
cm.unregisterForNotAvailable(this);
for (GsmConnection c : connections) {
try {
if (c != null)
hangup(c);
} catch (CallStateException ex) {
Log.e(LOG_TAG, "unexpected error on hangup during dispose");
}
}
try {
if (pendingMO != null)
hangup(pendingMO);
} catch (CallStateException ex) {
Log.e(LOG_TAG, "unexpected error on hangup during dispose");
}
clearDisconnected();
}
use of com.android.internal.telephony.gsm.GsmConnection in project XobotOS by xamarin.
the class GsmCallTracker method dial.
/**
* clirMode is one of the CLIR_ constants
*/
Connection dial(String dialString, int clirMode, UUSInfo uusInfo) throws CallStateException {
// note that this triggers call state changed notif
clearDisconnected();
if (!canDial()) {
throw new CallStateException("cannot dial in current state");
}
// there on hold
if (foregroundCall.getState() == GsmCall.State.ACTIVE) {
// this will probably be done by the radio anyway
// but the dial might fail before this happens
// and we need to make sure the foreground call is clear
// for the newly dialed connection
switchWaitingOrHoldingAndActive();
// Fake local state so that
// a) foregroundCall is empty for the newly dialed connection
// b) hasNonHangupStateChanged remains false in the
// next poll, so that we don't clear a failed dialing call
fakeHoldForegroundBeforeDial();
}
if (foregroundCall.getState() != GsmCall.State.IDLE) {
//we should have failed in !canDial() above before we get here
throw new CallStateException("cannot dial in current state");
}
pendingMO = new GsmConnection(phone.getContext(), dialString, this, foregroundCall);
hangupPendingMO = false;
if (pendingMO.address == null || pendingMO.address.length() == 0 || pendingMO.address.indexOf(PhoneNumberUtils.WILD) >= 0) {
// Phone number is invalid
pendingMO.cause = Connection.DisconnectCause.INVALID_NUMBER;
// handlePollCalls() will notice this call not present
// and will mark it as dropped.
pollCallsWhenSafe();
} else {
// Always unmute when initiating a new call
setMute(false);
cm.dial(pendingMO.address, clirMode, uusInfo, obtainCompleteMessage());
}
updatePhoneState();
phone.notifyPreciseCallStateChanged();
return pendingMO;
}
use of com.android.internal.telephony.gsm.GsmConnection in project XobotOS by xamarin.
the class GsmCallTracker method fakeHoldForegroundBeforeDial.
private void fakeHoldForegroundBeforeDial() {
List<Connection> connCopy;
// We need to make a copy here, since fakeHoldBeforeDial()
// modifies the lists, and we don't want to reverse the order
connCopy = (List<Connection>) foregroundCall.connections.clone();
for (int i = 0, s = connCopy.size(); i < s; i++) {
GsmConnection conn = (GsmConnection) connCopy.get(i);
conn.fakeHoldBeforeDial();
}
}
Aggregations