Use new DEVICE_TO_DEVICE connection event to send received messages.
Pipe through incoming device to device messages via the new system API.
Test: Added new CTS tests
Bug: 163085177
Change-Id: Idea7d5bab82f5e7b3cd610c6701a826fbec5e8e2
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 97c2773..845c724 100755
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -3259,14 +3259,13 @@
@Override
public void onMessagesReceived(@NonNull Set<Communicator.Message> messages) {
Log.i(this, "onMessagesReceived: got d2d messages: %s", messages);
- // TODO: Actually do something WITH the messages.
-
- // TODO: Remove this prior to launch.
- // This is just here for debug purposes; send as a connection event so that it
- // will be output in the Telecom logs.
+ // Send connection events up to Telecom so that we can relay the messages to a valid
+ // CallDiagnosticService which is bound.
for (Communicator.Message msg : messages) {
- sendConnectionEvent("D2D_" + Communicator.messageToString(msg.getType())
- + "_" + Communicator.valueToString(msg.getType(), msg.getValue()), null);
+ Bundle extras = new Bundle();
+ extras.putInt(Connection.EXTRA_DEVICE_TO_DEVICE_MESSAGE_TYPE, msg.getType());
+ extras.putInt(Connection.EXTRA_DEVICE_TO_DEVICE_MESSAGE_VALUE, msg.getValue());
+ sendConnectionEvent(Connection.EVENT_DEVICE_TO_DEVICE_MESSAGE, extras);
}
}