diff options
author | Xin Li <delphij@google.com> | 2020-08-31 21:21:38 -0700 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2020-08-31 21:21:38 -0700 |
commit | 628590d7ec80e10a3fc24b1c18a1afb55cca10a8 (patch) | |
tree | 4b1c3f52d86d7fb53afbe9e9438468588fa489f8 /telecomm/java/android/telecom/RemoteConnection.java | |
parent | b11b8ec3aec8bb42f2c07e1c5ac7942da293baa8 (diff) | |
parent | d2d3a20624d968199353ccf6ddbae6f3ac39c9af (diff) |
Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I3d92a6de21a938f6b352ec26dc23420c0fe02b27
Change-Id: Ifdb80563ef042738778ebb8a7581a97c4e3d96e2
Diffstat (limited to 'telecomm/java/android/telecom/RemoteConnection.java')
-rw-r--r-- | telecomm/java/android/telecom/RemoteConnection.java | 95 |
1 files changed, 88 insertions, 7 deletions
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index 78b4f3bfb90b..52210a55c8d0 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -26,6 +26,7 @@ import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; +import android.telecom.Logging.Session; import android.view.Surface; import com.android.internal.telecom.IConnectionService; @@ -33,10 +34,12 @@ import com.android.internal.telecom.IVideoCallback; import com.android.internal.telecom.IVideoProvider; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; /** * A connection provided to a {@link ConnectionService} by another {@code ConnectionService} @@ -655,6 +658,7 @@ public final class RemoteConnection { private int mCallerDisplayNamePresentation; private RemoteConference mConference; private Bundle mExtras; + private String mCallingPackageAbbreviation; /** * @hide @@ -667,6 +671,13 @@ public final class RemoteConnection { mConnectionService = connectionService; mConnected = true; mState = Connection.STATE_INITIALIZING; + if (request != null && request.getExtras() != null + && request.getExtras().containsKey( + Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME)) { + String callingPackage = request.getExtras().getString( + Connection.EXTRA_REMOTE_CONNECTION_ORIGINATING_PACKAGE_NAME); + mCallingPackageAbbreviation = Log.getPackageAbbreviation(callingPackage); + } } /** @@ -705,6 +716,7 @@ public final class RemoteConnection { Bundle newExtras = new Bundle(); newExtras.putString(Connection.EXTRA_ORIGINAL_CONNECTION_ID, callId); putExtras(newExtras); + mCallingPackageAbbreviation = Log.getPackageAbbreviation(callingPackage); } /** @@ -899,11 +911,15 @@ public final class RemoteConnection { * Instructs this {@code RemoteConnection} to abort. */ public void abort() { + Log.startSession("RC.a", getActiveOwnerInfo()); try { if (mConnected) { - mConnectionService.abort(mConnectionId, null /*Session.Info*/); + mConnectionService.abort(mConnectionId, Log.getExternalSession( + mCallingPackageAbbreviation)); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -911,11 +927,15 @@ public final class RemoteConnection { * Instructs this {@link Connection#STATE_RINGING} {@code RemoteConnection} to answer. */ public void answer() { + Log.startSession("RC.an", getActiveOwnerInfo()); try { if (mConnected) { - mConnectionService.answer(mConnectionId, null /*Session.Info*/); + mConnectionService.answer(mConnectionId, Log.getExternalSession( + mCallingPackageAbbreviation)); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -925,11 +945,15 @@ public final class RemoteConnection { * @hide */ public void answer(int videoState) { + Log.startSession("RC.an2", getActiveOwnerInfo()); try { if (mConnected) { - mConnectionService.answerVideo(mConnectionId, videoState, null /*Session.Info*/); + mConnectionService.answerVideo(mConnectionId, videoState, + Log.getExternalSession(mCallingPackageAbbreviation)); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -937,11 +961,15 @@ public final class RemoteConnection { * Instructs this {@link Connection#STATE_RINGING} {@code RemoteConnection} to reject. */ public void reject() { + Log.startSession("RC.r", getActiveOwnerInfo()); try { if (mConnected) { - mConnectionService.reject(mConnectionId, null /*Session.Info*/); + mConnectionService.reject(mConnectionId, Log.getExternalSession( + mCallingPackageAbbreviation)); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -949,11 +977,15 @@ public final class RemoteConnection { * Instructs this {@code RemoteConnection} to go on hold. */ public void hold() { + Log.startSession("RC.h", getActiveOwnerInfo()); try { if (mConnected) { - mConnectionService.hold(mConnectionId, null /*Session.Info*/); + mConnectionService.hold(mConnectionId, Log.getExternalSession( + mCallingPackageAbbreviation)); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -961,11 +993,15 @@ public final class RemoteConnection { * Instructs this {@link Connection#STATE_HOLDING} call to release from hold. */ public void unhold() { + Log.startSession("RC.u", getActiveOwnerInfo()); try { if (mConnected) { - mConnectionService.unhold(mConnectionId, null /*Session.Info*/); + mConnectionService.unhold(mConnectionId, Log.getExternalSession( + mCallingPackageAbbreviation)); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -973,11 +1009,15 @@ public final class RemoteConnection { * Instructs this {@code RemoteConnection} to disconnect. */ public void disconnect() { + Log.startSession("RC.d", getActiveOwnerInfo()); try { if (mConnected) { - mConnectionService.disconnect(mConnectionId, null /*Session.Info*/); + mConnectionService.disconnect(mConnectionId, Log.getExternalSession( + mCallingPackageAbbreviation)); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -991,11 +1031,14 @@ public final class RemoteConnection { * value must be one of {@code '0'} through {@code '9'}, {@code '*'} or {@code '#'}. */ public void playDtmfTone(char digit) { + Log.startSession("RC.pDT", getActiveOwnerInfo()); try { if (mConnected) { mConnectionService.playDtmfTone(mConnectionId, digit, null /*Session.Info*/); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -1007,11 +1050,14 @@ public final class RemoteConnection { * currently playing, this method will do nothing. */ public void stopDtmfTone() { + Log.startSession("RC.sDT", getActiveOwnerInfo()); try { if (mConnected) { mConnectionService.stopDtmfTone(mConnectionId, null /*Session.Info*/); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -1037,12 +1083,16 @@ public final class RemoteConnection { * @param proceed Whether or not to continue with the post-dial sequence. */ public void postDialContinue(boolean proceed) { + Log.startSession("RC.pDC", getActiveOwnerInfo()); try { if (mConnected) { mConnectionService.onPostDialContinue(mConnectionId, proceed, null /*Session.Info*/); } } catch (RemoteException ignored) { + // bliss + } finally { + Log.endSession(); } } @@ -1052,11 +1102,14 @@ public final class RemoteConnection { * See {@link Call#pullExternalCall()} for more information. */ public void pullExternalCall() { + Log.startSession("RC.pEC", getActiveOwnerInfo()); try { if (mConnected) { mConnectionService.pullExternalCall(mConnectionId, null /*Session.Info*/); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -1096,12 +1149,15 @@ public final class RemoteConnection { * @param state The audio state of this {@code RemoteConnection}. */ public void setCallAudioState(CallAudioState state) { + Log.startSession("RC.sCAS", getActiveOwnerInfo()); try { if (mConnected) { mConnectionService.onCallAudioStateChanged(mConnectionId, state, null /*Session.Info*/); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -1112,12 +1168,15 @@ public final class RemoteConnection { * @hide */ public void startRtt(@NonNull Connection.RttTextStream rttTextStream) { + Log.startSession("RC.sR", getActiveOwnerInfo()); try { if (mConnected) { mConnectionService.startRtt(mConnectionId, rttTextStream.getFdFromInCall(), rttTextStream.getFdToInCall(), null /*Session.Info*/); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -1127,11 +1186,14 @@ public final class RemoteConnection { * @hide */ public void stopRtt() { + Log.startSession("RC.stR", getActiveOwnerInfo()); try { if (mConnected) { mConnectionService.stopRtt(mConnectionId, null /*Session.Info*/); } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -1145,6 +1207,7 @@ public final class RemoteConnection { * the in-call app. */ public void sendRttUpgradeResponse(@Nullable Connection.RttTextStream rttTextStream) { + Log.startSession("RC.sRUR", getActiveOwnerInfo()); try { if (mConnected) { if (rttTextStream == null) { @@ -1157,6 +1220,8 @@ public final class RemoteConnection { } } } catch (RemoteException ignored) { + } finally { + Log.endSession(); } } @@ -1181,6 +1246,22 @@ public final class RemoteConnection { return mConference; } + /** + * Get the owner info for the currently active session. We want to make sure that any owner + * info from the original call into the connection manager gets retained so that the full + * context of the calls can be traced down to Telephony. + * Example: Telecom will provide owner info in it's external session info that indicates + * 'cast' as the calling owner. + * @return The active owner + */ + private String getActiveOwnerInfo() { + Session.Info info = Log.getExternalSession(); + if (info == null) { + return null; + } + return info.ownerInfo; + } + /** {@hide} */ String getId() { return mConnectionId; |