use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyTester method handleTestConferenceEventPackage.
/**
* Handles request to send a test conference event package to the active Ims call.
*
* @see com.android.internal.telephony.test.TestConferenceEventPackageParser
* @param context The context.
* @param fileName The name of the test conference event package file to read.
*/
private void handleTestConferenceEventPackage(Context context, String fileName) {
// Attempt to get the active IMS call before parsing the test XML file.
ImsPhone imsPhone = (ImsPhone) mPhone;
if (imsPhone == null) {
return;
}
ImsPhoneCall imsPhoneCall = imsPhone.getForegroundCall();
if (imsPhoneCall == null) {
return;
}
ImsCall imsCall = imsPhoneCall.getImsCall();
if (imsCall == null) {
return;
}
File packageFile = new File(context.getFilesDir(), fileName);
final FileInputStream is;
try {
is = new FileInputStream(packageFile);
} catch (FileNotFoundException ex) {
log("Test conference event package file not found: " + packageFile.getAbsolutePath());
return;
}
TestConferenceEventPackageParser parser = new TestConferenceEventPackageParser(is);
ImsConferenceState imsConferenceState = parser.parse();
if (imsConferenceState == null) {
return;
}
imsCall.conferenceStateUpdated(imsConferenceState);
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTracker method switchWaitingOrHoldingAndActive.
public void switchWaitingOrHoldingAndActive() throws CallStateException {
if (DBG)
log("switchWaitingOrHoldingAndActive");
if (mRingingCall.getState() == ImsPhoneCall.State.INCOMING) {
throw new CallStateException("cannot be in the incoming state");
}
if (mForegroundCall.getState() == ImsPhoneCall.State.ACTIVE) {
ImsCall imsCall = mForegroundCall.getImsCall();
if (imsCall == null) {
throw new CallStateException("no ims call");
}
// Swap the ImsCalls pointed to by the foreground and background ImsPhoneCalls.
// If hold or resume later fails, we will swap them back.
boolean switchingWithWaitingCall = !mBackgroundCall.getState().isAlive() && mRingingCall != null && mRingingCall.getState() == ImsPhoneCall.State.WAITING;
mSwitchingFgAndBgCalls = true;
if (switchingWithWaitingCall) {
mCallExpectedToResume = mRingingCall.getImsCall();
} else {
mCallExpectedToResume = mBackgroundCall.getImsCall();
}
mForegroundCall.switchWith(mBackgroundCall);
// be resumed.
try {
imsCall.hold();
mMetrics.writeOnImsCommand(mPhone.getPhoneId(), imsCall.getSession(), ImsCommand.IMS_CMD_HOLD);
// If there is no background call to resume, then don't expect there to be a switch.
if (mCallExpectedToResume == null) {
log("mCallExpectedToResume is null");
mSwitchingFgAndBgCalls = false;
}
} catch (ImsException e) {
mForegroundCall.switchWith(mBackgroundCall);
throw new CallStateException(e.getMessage());
}
} else if (mBackgroundCall.getState() == ImsPhoneCall.State.HOLDING) {
resumeWaitingOrHolding();
}
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneCallTracker method handleDataEnabledChange.
/**
* Handles changes to the enabled state of mobile data.
* When data is disabled, handles auto-downgrade of video calls over LTE.
* When data is enabled, handled resuming of video calls paused when data was disabled.
* @param enabled {@code true} if mobile data is enabled, {@code false} if mobile data is
* disabled.
* @param reasonCode The {@link ImsReasonInfo} code for the data enabled state change.
*/
private void handleDataEnabledChange(boolean enabled, int reasonCode) {
if (!enabled) {
// data charges.
for (ImsPhoneConnection conn : mConnections) {
ImsCall imsCall = conn.getImsCall();
if (imsCall != null && imsCall.isVideoCall() && !imsCall.isWifiCall()) {
log("handleDataEnabledChange - downgrading " + conn);
downgradeVideoCall(reasonCode, conn);
}
}
} else if (mSupportPauseVideo) {
// Data was re-enabled, so un-pause previously paused video calls.
for (ImsPhoneConnection conn : mConnections) {
// If video is paused, check to see if there are any pending pauses due to enabled
// state of data changing.
log("handleDataEnabledChange - resuming " + conn);
if (VideoProfile.isPaused(conn.getVideoState()) && conn.wasVideoPausedFromSource(VideoPauseTracker.SOURCE_DATA_ENABLED)) {
// The data enabled state was a cause of a pending pause, so potentially
// resume the video now.
conn.resumeVideo(VideoPauseTracker.SOURCE_DATA_ENABLED);
}
}
mShouldUpdateImsConfigOnDisconnect = false;
}
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhoneConnection method sendRttModifyResponse.
/**
* Sends the user's response to a remotely-issued RTT upgrade request
*
* @param textStream A valid {@link android.telecom.Connection.RttTextStream} if the user
* accepts, {@code null} if not.
*/
public void sendRttModifyResponse(android.telecom.Connection.RttTextStream textStream) {
boolean accept = textStream != null;
ImsCall imsCall = getImsCall();
imsCall.sendRttModifyResponse(accept);
if (accept) {
setCurrentRttTextStream(textStream);
startRttTextProcessing();
} else {
Rlog.e(LOG_TAG, "sendRttModifyResponse: foreground call has no connections");
}
}
use of com.android.ims.ImsCall in project android_frameworks_opt_telephony by LineageOS.
the class ImsCallTest method testSetWifi.
@Test
@SmallTest
public void testSetWifi() {
ImsCall mTestImsCall = new ImsCall(mContext, mTestCallProfile);
assertFalse(mTestImsCall.isWifiCall());
mBundle.putString(ImsCallProfile.EXTRA_CALL_RAT_TYPE, ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN + "");
assertTrue(mTestImsCall.isWifiCall());
}
Aggregations