Loading src/com/android/server/telecom/Call.java +34 −43 Original line number Diff line number Diff line Loading @@ -60,7 +60,6 @@ import java.io.IOException; import java.lang.String; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.LinkedList; Loading Loading @@ -486,11 +485,6 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, private ParcelFileDescriptor[] mInCallToConnectionServiceStreams; private ParcelFileDescriptor[] mConnectionServiceToInCallStreams; /** * Abandoned RTT pipes, to be cleaned up when the call is removed */ private Collection<ParcelFileDescriptor> mDiscardedRttFds = new LinkedList<>(); /** * True if we're supposed to start this call with RTT, either due to the master switch or due * to an extra. Loading Loading @@ -671,7 +665,13 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, mCallerInfo.cachedPhotoIcon = null; mCallerInfo.cachedPhoto = null; } for (ParcelFileDescriptor fd : mDiscardedRttFds) { Log.addEvent(this, LogUtils.Events.DESTROYED); } private void closeRttStreams() { if (mConnectionServiceToInCallStreams != null) { for (ParcelFileDescriptor fd : mConnectionServiceToInCallStreams) { if (fd != null) { try { fd.close(); Loading @@ -680,7 +680,18 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } } } Log.addEvent(this, LogUtils.Events.DESTROYED); } if (mInCallToConnectionServiceStreams != null) { for (ParcelFileDescriptor fd : mInCallToConnectionServiceStreams) { if (fd != null) { try { fd.close(); } catch (IOException e) { // ignore } } } } } /** {@inheritDoc} */ Loading Loading @@ -1308,12 +1319,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, && mDidRequestToStartWithRtt && !areRttStreamsInitialized()) { // If the phone account got set to an RTT capable one and we haven't set the streams // yet, do so now. setRttStreams(true); createRttStreams(); Log.i(this, "Setting RTT streams after target phone account selected"); } else if (!isRttSupported && !isConnectionManagerRttSupported) { // If the phone account got set to RTT-incapable, unset the streams. Log.i(this, "Unsetting RTT streams after target phone account selected"); setRttStreams(false); } } Loading Loading @@ -1418,8 +1425,10 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, if (changedProperties != 0) { int previousProperties = mConnectionProperties; mConnectionProperties = connectionProperties; setRttStreams((mConnectionProperties & Connection.PROPERTY_IS_RTT) == Connection.PROPERTY_IS_RTT); if ((mConnectionProperties & Connection.PROPERTY_IS_RTT) == Connection.PROPERTY_IS_RTT) { createRttStreams(); } mWasHighDefAudio = (connectionProperties & Connection.PROPERTY_HIGH_DEF_AUDIO) == Connection.PROPERTY_HIGH_DEF_AUDIO; boolean didRttChange = Loading Loading @@ -2525,7 +2534,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } public void sendRttRequest() { setRttStreams(true); createRttStreams(); mConnectionService.startRtt(this, getInCallToCsRttPipeForCs(), getCsToInCallRttPipeForCs()); } Loading @@ -2534,10 +2543,9 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, && mConnectionServiceToInCallStreams != null; } public void setRttStreams(boolean shouldBeRtt) { boolean areStreamsInitialized = areRttStreamsInitialized(); Log.i(this, "Setting RTT streams to %b, currently %b", shouldBeRtt, areStreamsInitialized); if (shouldBeRtt && !areStreamsInitialized) { public void createRttStreams() { if (!areRttStreamsInitialized()) { Log.i(this, "Initializing RTT streams"); try { mWasEverRtt = true; mInCallToConnectionServiceStreams = ParcelFileDescriptor.createReliablePipe(); Loading @@ -2545,16 +2553,11 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } catch (IOException e) { Log.e(this, e, "Failed to create pipes for RTT call."); } } else if (!shouldBeRtt && areStreamsInitialized) { closeRttPipes(); mInCallToConnectionServiceStreams = null; mConnectionServiceToInCallStreams = null; } } public void onRttConnectionFailure(int reason) { Log.i(this, "Got RTT initiation failure with reason %d", reason); setRttStreams(false); for (Listener l : mListeners) { l.onRttInitiationFailure(this, reason); } Loading @@ -2581,8 +2584,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, Log.w(this, "Response ID %d does not match expected %d", id, mPendingRttRequestId); return; } setRttStreams(accept); if (accept) { createRttStreams(); Log.i(this, "RTT request %d accepted.", id); mConnectionService.respondToRttRequest( this, getInCallToCsRttPipeForCs(), getCsToInCallRttPipeForCs()); Loading @@ -2592,18 +2595,6 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } } public void closeRttPipes() { // Defer closing until the call is destroyed if (mInCallToConnectionServiceStreams != null) { mDiscardedRttFds.add(mInCallToConnectionServiceStreams[0]); mDiscardedRttFds.add(mInCallToConnectionServiceStreams[1]); } if (mConnectionServiceToInCallStreams != null) { mDiscardedRttFds.add(mConnectionServiceToInCallStreams[0]); mDiscardedRttFds.add(mConnectionServiceToInCallStreams[1]); } } public boolean isRttCall() { return (mConnectionProperties & Connection.PROPERTY_IS_RTT) == Connection.PROPERTY_IS_RTT; } Loading src/com/android/server/telecom/CallsManager.java +5 −6 Original line number Diff line number Diff line Loading @@ -915,12 +915,12 @@ public class CallsManager extends Call.ListenerBase call.setIsVoipAudioMode(true); } } if (isRttSettingOn() || if (isRttSettingOn() && extras.getBoolean(TelecomManager.EXTRA_START_CALL_WITH_RTT, false)) { Log.d(this, "Incoming call requesting RTT, rtt setting is %b", isRttSettingOn()); if (phoneAccount != null && phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_RTT)) { call.setRttStreams(true); call.createRttStreams(); } // Even if the phone account doesn't support RTT yet, the connection manager might // change that. Set this to check it later. Loading Loading @@ -1211,7 +1211,7 @@ public class CallsManager extends Call.ListenerBase Log.d(this, "Outgoing call requesting RTT, rtt setting is %b", isRttSettingOn()); if (accountToUse != null && accountToUse.hasCapabilities(PhoneAccount.CAPABILITY_RTT)) { call.setRttStreams(true); call.createRttStreams(); } // Even if the phone account doesn't support RTT yet, the connection manager might // change that. Set this to check it later. Loading Loading @@ -1778,8 +1778,7 @@ public class CallsManager extends Call.ListenerBase private boolean isRttSettingOn() { return Settings.System.getInt(mContext.getContentResolver(), Settings.System.RTT_CALLING_MODE, TelecomManager.TTY_MODE_OFF) != TelecomManager.TTY_MODE_OFF; Settings.System.RTT_CALLING_MODE, 0) != 0; } void phoneAccountSelected(Call call, PhoneAccountHandle account, boolean setDefault) { Loading @@ -1801,7 +1800,7 @@ public class CallsManager extends Call.ListenerBase " rtt setting is %b", isRttSettingOn()); if (realPhoneAccount != null && realPhoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_RTT)) { call.setRttStreams(true); call.createRttStreams(); } // Even if the phone account doesn't support RTT yet, the connection manager might // change that. Set this to check it later. Loading src/com/android/server/telecom/ParcelableCallUtils.java +4 −1 Original line number Diff line number Diff line Loading @@ -342,7 +342,10 @@ public class ParcelableCallUtils { android.telecom.Call.Details.PROPERTY_SELF_MANAGED, Connection.PROPERTY_ASSISTED_DIALING_USED, android.telecom.Call.Details.PROPERTY_ASSISTED_DIALING_USED android.telecom.Call.Details.PROPERTY_ASSISTED_DIALING_USED, Connection.PROPERTY_IS_RTT, android.telecom.Call.Details.PROPERTY_RTT }; private static int convertConnectionToCallProperties(int connectionProperties) { Loading Loading
src/com/android/server/telecom/Call.java +34 −43 Original line number Diff line number Diff line Loading @@ -60,7 +60,6 @@ import java.io.IOException; import java.lang.String; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.LinkedList; Loading Loading @@ -486,11 +485,6 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, private ParcelFileDescriptor[] mInCallToConnectionServiceStreams; private ParcelFileDescriptor[] mConnectionServiceToInCallStreams; /** * Abandoned RTT pipes, to be cleaned up when the call is removed */ private Collection<ParcelFileDescriptor> mDiscardedRttFds = new LinkedList<>(); /** * True if we're supposed to start this call with RTT, either due to the master switch or due * to an extra. Loading Loading @@ -671,7 +665,13 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, mCallerInfo.cachedPhotoIcon = null; mCallerInfo.cachedPhoto = null; } for (ParcelFileDescriptor fd : mDiscardedRttFds) { Log.addEvent(this, LogUtils.Events.DESTROYED); } private void closeRttStreams() { if (mConnectionServiceToInCallStreams != null) { for (ParcelFileDescriptor fd : mConnectionServiceToInCallStreams) { if (fd != null) { try { fd.close(); Loading @@ -680,7 +680,18 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } } } Log.addEvent(this, LogUtils.Events.DESTROYED); } if (mInCallToConnectionServiceStreams != null) { for (ParcelFileDescriptor fd : mInCallToConnectionServiceStreams) { if (fd != null) { try { fd.close(); } catch (IOException e) { // ignore } } } } } /** {@inheritDoc} */ Loading Loading @@ -1308,12 +1319,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, && mDidRequestToStartWithRtt && !areRttStreamsInitialized()) { // If the phone account got set to an RTT capable one and we haven't set the streams // yet, do so now. setRttStreams(true); createRttStreams(); Log.i(this, "Setting RTT streams after target phone account selected"); } else if (!isRttSupported && !isConnectionManagerRttSupported) { // If the phone account got set to RTT-incapable, unset the streams. Log.i(this, "Unsetting RTT streams after target phone account selected"); setRttStreams(false); } } Loading Loading @@ -1418,8 +1425,10 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, if (changedProperties != 0) { int previousProperties = mConnectionProperties; mConnectionProperties = connectionProperties; setRttStreams((mConnectionProperties & Connection.PROPERTY_IS_RTT) == Connection.PROPERTY_IS_RTT); if ((mConnectionProperties & Connection.PROPERTY_IS_RTT) == Connection.PROPERTY_IS_RTT) { createRttStreams(); } mWasHighDefAudio = (connectionProperties & Connection.PROPERTY_HIGH_DEF_AUDIO) == Connection.PROPERTY_HIGH_DEF_AUDIO; boolean didRttChange = Loading Loading @@ -2525,7 +2534,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } public void sendRttRequest() { setRttStreams(true); createRttStreams(); mConnectionService.startRtt(this, getInCallToCsRttPipeForCs(), getCsToInCallRttPipeForCs()); } Loading @@ -2534,10 +2543,9 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, && mConnectionServiceToInCallStreams != null; } public void setRttStreams(boolean shouldBeRtt) { boolean areStreamsInitialized = areRttStreamsInitialized(); Log.i(this, "Setting RTT streams to %b, currently %b", shouldBeRtt, areStreamsInitialized); if (shouldBeRtt && !areStreamsInitialized) { public void createRttStreams() { if (!areRttStreamsInitialized()) { Log.i(this, "Initializing RTT streams"); try { mWasEverRtt = true; mInCallToConnectionServiceStreams = ParcelFileDescriptor.createReliablePipe(); Loading @@ -2545,16 +2553,11 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } catch (IOException e) { Log.e(this, e, "Failed to create pipes for RTT call."); } } else if (!shouldBeRtt && areStreamsInitialized) { closeRttPipes(); mInCallToConnectionServiceStreams = null; mConnectionServiceToInCallStreams = null; } } public void onRttConnectionFailure(int reason) { Log.i(this, "Got RTT initiation failure with reason %d", reason); setRttStreams(false); for (Listener l : mListeners) { l.onRttInitiationFailure(this, reason); } Loading @@ -2581,8 +2584,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, Log.w(this, "Response ID %d does not match expected %d", id, mPendingRttRequestId); return; } setRttStreams(accept); if (accept) { createRttStreams(); Log.i(this, "RTT request %d accepted.", id); mConnectionService.respondToRttRequest( this, getInCallToCsRttPipeForCs(), getCsToInCallRttPipeForCs()); Loading @@ -2592,18 +2595,6 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, } } public void closeRttPipes() { // Defer closing until the call is destroyed if (mInCallToConnectionServiceStreams != null) { mDiscardedRttFds.add(mInCallToConnectionServiceStreams[0]); mDiscardedRttFds.add(mInCallToConnectionServiceStreams[1]); } if (mConnectionServiceToInCallStreams != null) { mDiscardedRttFds.add(mConnectionServiceToInCallStreams[0]); mDiscardedRttFds.add(mConnectionServiceToInCallStreams[1]); } } public boolean isRttCall() { return (mConnectionProperties & Connection.PROPERTY_IS_RTT) == Connection.PROPERTY_IS_RTT; } Loading
src/com/android/server/telecom/CallsManager.java +5 −6 Original line number Diff line number Diff line Loading @@ -915,12 +915,12 @@ public class CallsManager extends Call.ListenerBase call.setIsVoipAudioMode(true); } } if (isRttSettingOn() || if (isRttSettingOn() && extras.getBoolean(TelecomManager.EXTRA_START_CALL_WITH_RTT, false)) { Log.d(this, "Incoming call requesting RTT, rtt setting is %b", isRttSettingOn()); if (phoneAccount != null && phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_RTT)) { call.setRttStreams(true); call.createRttStreams(); } // Even if the phone account doesn't support RTT yet, the connection manager might // change that. Set this to check it later. Loading Loading @@ -1211,7 +1211,7 @@ public class CallsManager extends Call.ListenerBase Log.d(this, "Outgoing call requesting RTT, rtt setting is %b", isRttSettingOn()); if (accountToUse != null && accountToUse.hasCapabilities(PhoneAccount.CAPABILITY_RTT)) { call.setRttStreams(true); call.createRttStreams(); } // Even if the phone account doesn't support RTT yet, the connection manager might // change that. Set this to check it later. Loading Loading @@ -1778,8 +1778,7 @@ public class CallsManager extends Call.ListenerBase private boolean isRttSettingOn() { return Settings.System.getInt(mContext.getContentResolver(), Settings.System.RTT_CALLING_MODE, TelecomManager.TTY_MODE_OFF) != TelecomManager.TTY_MODE_OFF; Settings.System.RTT_CALLING_MODE, 0) != 0; } void phoneAccountSelected(Call call, PhoneAccountHandle account, boolean setDefault) { Loading @@ -1801,7 +1800,7 @@ public class CallsManager extends Call.ListenerBase " rtt setting is %b", isRttSettingOn()); if (realPhoneAccount != null && realPhoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_RTT)) { call.setRttStreams(true); call.createRttStreams(); } // Even if the phone account doesn't support RTT yet, the connection manager might // change that. Set this to check it later. Loading
src/com/android/server/telecom/ParcelableCallUtils.java +4 −1 Original line number Diff line number Diff line Loading @@ -342,7 +342,10 @@ public class ParcelableCallUtils { android.telecom.Call.Details.PROPERTY_SELF_MANAGED, Connection.PROPERTY_ASSISTED_DIALING_USED, android.telecom.Call.Details.PROPERTY_ASSISTED_DIALING_USED android.telecom.Call.Details.PROPERTY_ASSISTED_DIALING_USED, Connection.PROPERTY_IS_RTT, android.telecom.Call.Details.PROPERTY_RTT }; private static int convertConnectionToCallProperties(int connectionProperties) { Loading