Loading proto/telecom.proto +4 −0 Original line number Diff line number Diff line Loading @@ -273,4 +273,8 @@ message CallLog { // A list of the in-call services bound during the call. repeated InCallServiceInfo in_call_services = 16; // A bitmask of the properties that were set at any point during the call. // Bits are defined by android.telecom.Connection.PROPERTY_* constants. optional int32 connection_properties = 17; } src/com/android/server/telecom/Analytics.java +16 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.telecom; import android.telecom.Connection; import android.telecom.DisconnectCause; import android.telecom.ParcelableCallAnalytics; import android.telecom.TelecomAnalytics; Loading Loading @@ -179,6 +180,9 @@ public class Analytics { public void addInCallService(String serviceName, int type) { } public void addCallProperties(int properties) { } } /** Loading Loading @@ -211,6 +215,8 @@ public class Analytics { public boolean isVideo = false; public List<TelecomLogClass.VideoEvent> videoEvents; public List<TelecomLogClass.InCallServiceInfo> inCallServiceInfos; public int callProperties = 0; private long mTimeOfLastVideoEvent = -1; CallInfoImpl(String callId, int callDirection) { Loading Loading @@ -238,6 +244,7 @@ public class Analytics { this.callEvents = other.callEvents; this.isVideo = other.isVideo; this.videoEvents = other.videoEvents; this.callProperties = other.callProperties; if (other.callTerminationReason != null) { this.callTerminationReason = new DisconnectCause( Loading Loading @@ -335,6 +342,11 @@ public class Analytics { .setInCallServiceType(type)); } @Override public void addCallProperties(int properties) { this.callProperties |= properties; } @Override public String toString() { return "{\n" Loading @@ -348,6 +360,8 @@ public class Analytics { + " connectionService: " + connectionService + '\n' + " isVideoCall: " + isVideo + '\n' + " inCallServices: " + getInCallServicesString() + '\n' + " callProperties: " + Connection.propertiesToStringShort(callProperties) + '\n' + "}\n"; } Loading Loading @@ -415,7 +429,8 @@ public class Analytics { .setIsEmergencyCall(isEmergency) .setIsCreatedFromExistingConnection(createdFromExistingConnection) .setIsEmergencyCall(isEmergency) .setIsVideoCall(isVideo); .setIsVideoCall(isVideo) .setConnectionProperties(callProperties); result.connectionService = new String[] {connectionService}; if (callEvents != null) { Loading src/com/android/server/telecom/Call.java +2 −0 Original line number Diff line number Diff line Loading @@ -1052,6 +1052,8 @@ public class Call implements CreateConnectionResponse { } mAnalytics.addCallProperties(mConnectionProperties); int xorProps = previousProperties ^ mConnectionProperties; Log.event(this, Log.Events.PROPERTY_CHANGE, "Current: [%s], Removed [%s], Added [%s]", Loading tests/src/com/android/server/telecom/tests/AnalyticsTests.java +37 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.telecom.tests; import android.content.Context; import android.telecom.Connection; import android.telecom.DisconnectCause; import android.telecom.InCallService; import android.telecom.ParcelableCallAnalytics; Loading Loading @@ -54,6 +55,7 @@ public class AnalyticsTests extends TelecomSystemTest { "650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Map<String, Analytics.CallInfoImpl> analyticsMap = Analytics.cloneData(); assertTrue(analyticsMap.containsKey(testCall.mCallId)); Loading Loading @@ -300,6 +302,41 @@ public class AnalyticsTests extends TelecomSystemTest { ParcelableCallAnalytics.AnalyticsEvent.FILTERING_INITIATED)); } @MediumTest public void testAnalyticsConnectionProperties() throws Exception { Analytics.reset(); IdPair testCall = startAndMakeActiveIncomingCall( "650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); int properties1 = Connection.PROPERTY_IS_DOWNGRADED_CONFERENCE | Connection.PROPERTY_WIFI | Connection.PROPERTY_EMERGENCY_CALLBACK_MODE; int properties2 = Connection.PROPERTY_HIGH_DEF_AUDIO | Connection.PROPERTY_WIFI; int expectedProperties = properties1 | properties2; mConnectionServiceFixtureA.mConnectionById.get(testCall.mConnectionId).properties = properties1; mConnectionServiceFixtureA.sendSetConnectionProperties(testCall.mConnectionId); mConnectionServiceFixtureA.mConnectionById.get(testCall.mConnectionId).properties = properties2; mConnectionServiceFixtureA.sendSetConnectionProperties(testCall.mConnectionId); mConnectionServiceFixtureA. sendSetDisconnected(testCall.mConnectionId, DisconnectCause.ERROR); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); Analytics.dumpToEncodedProto(pw, new String[]{}); TelecomLogClass.TelecomLog analyticsProto = TelecomLogClass.TelecomLog.parseFrom(Base64.decode(sw.toString(), Base64.DEFAULT)); assertEquals(expectedProperties, analyticsProto.callLogs[0].getConnectionProperties() & expectedProperties); } private void assertIsRoundedToOneSigFig(long x) { assertEquals(x, Analytics.roundToOneSigFig(x)); } Loading tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java +5 −0 Original line number Diff line number Diff line Loading @@ -434,6 +434,11 @@ public class ConnectionServiceFixture implements TestFixture<IConnectionService> } } public void sendSetConnectionProperties(String id) throws Exception { for (IConnectionServiceAdapter a : mConnectionServiceAdapters) { a.setConnectionProperties(id, mConnectionById.get(id).properties); } } public void sendSetIsConferenced(String id) throws Exception { for (IConnectionServiceAdapter a : mConnectionServiceAdapters) { a.setIsConferenced(id, mConnectionById.get(id).conferenceId); Loading Loading
proto/telecom.proto +4 −0 Original line number Diff line number Diff line Loading @@ -273,4 +273,8 @@ message CallLog { // A list of the in-call services bound during the call. repeated InCallServiceInfo in_call_services = 16; // A bitmask of the properties that were set at any point during the call. // Bits are defined by android.telecom.Connection.PROPERTY_* constants. optional int32 connection_properties = 17; }
src/com/android/server/telecom/Analytics.java +16 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.telecom; import android.telecom.Connection; import android.telecom.DisconnectCause; import android.telecom.ParcelableCallAnalytics; import android.telecom.TelecomAnalytics; Loading Loading @@ -179,6 +180,9 @@ public class Analytics { public void addInCallService(String serviceName, int type) { } public void addCallProperties(int properties) { } } /** Loading Loading @@ -211,6 +215,8 @@ public class Analytics { public boolean isVideo = false; public List<TelecomLogClass.VideoEvent> videoEvents; public List<TelecomLogClass.InCallServiceInfo> inCallServiceInfos; public int callProperties = 0; private long mTimeOfLastVideoEvent = -1; CallInfoImpl(String callId, int callDirection) { Loading Loading @@ -238,6 +244,7 @@ public class Analytics { this.callEvents = other.callEvents; this.isVideo = other.isVideo; this.videoEvents = other.videoEvents; this.callProperties = other.callProperties; if (other.callTerminationReason != null) { this.callTerminationReason = new DisconnectCause( Loading Loading @@ -335,6 +342,11 @@ public class Analytics { .setInCallServiceType(type)); } @Override public void addCallProperties(int properties) { this.callProperties |= properties; } @Override public String toString() { return "{\n" Loading @@ -348,6 +360,8 @@ public class Analytics { + " connectionService: " + connectionService + '\n' + " isVideoCall: " + isVideo + '\n' + " inCallServices: " + getInCallServicesString() + '\n' + " callProperties: " + Connection.propertiesToStringShort(callProperties) + '\n' + "}\n"; } Loading Loading @@ -415,7 +429,8 @@ public class Analytics { .setIsEmergencyCall(isEmergency) .setIsCreatedFromExistingConnection(createdFromExistingConnection) .setIsEmergencyCall(isEmergency) .setIsVideoCall(isVideo); .setIsVideoCall(isVideo) .setConnectionProperties(callProperties); result.connectionService = new String[] {connectionService}; if (callEvents != null) { Loading
src/com/android/server/telecom/Call.java +2 −0 Original line number Diff line number Diff line Loading @@ -1052,6 +1052,8 @@ public class Call implements CreateConnectionResponse { } mAnalytics.addCallProperties(mConnectionProperties); int xorProps = previousProperties ^ mConnectionProperties; Log.event(this, Log.Events.PROPERTY_CHANGE, "Current: [%s], Removed [%s], Added [%s]", Loading
tests/src/com/android/server/telecom/tests/AnalyticsTests.java +37 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.telecom.tests; import android.content.Context; import android.telecom.Connection; import android.telecom.DisconnectCause; import android.telecom.InCallService; import android.telecom.ParcelableCallAnalytics; Loading Loading @@ -54,6 +55,7 @@ public class AnalyticsTests extends TelecomSystemTest { "650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); Map<String, Analytics.CallInfoImpl> analyticsMap = Analytics.cloneData(); assertTrue(analyticsMap.containsKey(testCall.mCallId)); Loading Loading @@ -300,6 +302,41 @@ public class AnalyticsTests extends TelecomSystemTest { ParcelableCallAnalytics.AnalyticsEvent.FILTERING_INITIATED)); } @MediumTest public void testAnalyticsConnectionProperties() throws Exception { Analytics.reset(); IdPair testCall = startAndMakeActiveIncomingCall( "650-555-1212", mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA); int properties1 = Connection.PROPERTY_IS_DOWNGRADED_CONFERENCE | Connection.PROPERTY_WIFI | Connection.PROPERTY_EMERGENCY_CALLBACK_MODE; int properties2 = Connection.PROPERTY_HIGH_DEF_AUDIO | Connection.PROPERTY_WIFI; int expectedProperties = properties1 | properties2; mConnectionServiceFixtureA.mConnectionById.get(testCall.mConnectionId).properties = properties1; mConnectionServiceFixtureA.sendSetConnectionProperties(testCall.mConnectionId); mConnectionServiceFixtureA.mConnectionById.get(testCall.mConnectionId).properties = properties2; mConnectionServiceFixtureA.sendSetConnectionProperties(testCall.mConnectionId); mConnectionServiceFixtureA. sendSetDisconnected(testCall.mConnectionId, DisconnectCause.ERROR); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); Analytics.dumpToEncodedProto(pw, new String[]{}); TelecomLogClass.TelecomLog analyticsProto = TelecomLogClass.TelecomLog.parseFrom(Base64.decode(sw.toString(), Base64.DEFAULT)); assertEquals(expectedProperties, analyticsProto.callLogs[0].getConnectionProperties() & expectedProperties); } private void assertIsRoundedToOneSigFig(long x) { assertEquals(x, Analytics.roundToOneSigFig(x)); } Loading
tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java +5 −0 Original line number Diff line number Diff line Loading @@ -434,6 +434,11 @@ public class ConnectionServiceFixture implements TestFixture<IConnectionService> } } public void sendSetConnectionProperties(String id) throws Exception { for (IConnectionServiceAdapter a : mConnectionServiceAdapters) { a.setConnectionProperties(id, mConnectionById.get(id).properties); } } public void sendSetIsConferenced(String id) throws Exception { for (IConnectionServiceAdapter a : mConnectionServiceAdapters) { a.setIsConferenced(id, mConnectionById.get(id).conferenceId); Loading