Propogates the CDMA Voice Privacy Property to a Call
Allows the CDMA enhanced voice privacy connection property to be
propogated up as a Call Property.
Bug: 26931679
Change-Id: I2206d1e8091c39c8ceddb820f1c70671ed46a008
diff --git a/src/com/android/server/telecom/ParcelableCallUtils.java b/src/com/android/server/telecom/ParcelableCallUtils.java
index 9b65197..6f8b238 100644
--- a/src/com/android/server/telecom/ParcelableCallUtils.java
+++ b/src/com/android/server/telecom/ParcelableCallUtils.java
@@ -271,7 +271,10 @@
android.telecom.Call.Details.PROPERTY_EMERGENCY_CALLBACK_MODE,
Connection.PROPERTY_IS_EXTERNAL_CALL,
- android.telecom.Call.Details.PROPERTY_IS_EXTERNAL_CALL
+ android.telecom.Call.Details.PROPERTY_IS_EXTERNAL_CALL,
+
+ Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY,
+ android.telecom.Call.Details.PROPERTY_HAS_CDMA_VOICE_PRIVACY
};
private static int convertConnectionToCallProperties(int connectionProperties) {
diff --git a/tests/src/com/android/server/telecom/tests/BasicCallTests.java b/tests/src/com/android/server/telecom/tests/BasicCallTests.java
index 11a5624..2270f2f 100644
--- a/tests/src/com/android/server/telecom/tests/BasicCallTests.java
+++ b/tests/src/com/android/server/telecom/tests/BasicCallTests.java
@@ -843,6 +843,44 @@
}
/**
+ * Tests to make sure that the Call.Details.PROPERTY_HAS_CDMA_VOICE_PRIVACY property is set on a
+ * Call that is based on a Connection with the Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY
+ * property set.
+ */
+ @MediumTest
+ public void testCdmaEnhancedPrivacyVoiceCall() throws Exception {
+ mConnectionServiceFixtureA.mConnectionServiceDelegate.mProperties =
+ Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY;
+
+ IdPair ids = startAndMakeActiveOutgoingCall("650-555-1212",
+ mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA);
+ assertEquals(Call.STATE_ACTIVE, mInCallServiceFixtureX.getCall(ids.mCallId).getState());
+
+ assertTrue(Call.Details.hasProperty(
+ mInCallServiceFixtureX.getCall(ids.mCallId).getProperties(),
+ Call.Details.PROPERTY_HAS_CDMA_VOICE_PRIVACY));
+ }
+
+ /**
+ * Tests to make sure that Call.Details.PROPERTY_HAS_CDMA_VOICE_PRIVACY is dropped
+ * when the Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY property is removed from the Connection.
+ */
+ @MediumTest
+ public void testDropCdmaEnhancedPrivacyVoiceCall() throws Exception {
+ mConnectionServiceFixtureA.mConnectionServiceDelegate.mProperties =
+ Connection.PROPERTY_HAS_CDMA_VOICE_PRIVACY;
+
+ IdPair ids = startAndMakeActiveOutgoingCall("650-555-1212",
+ mPhoneAccountA0.getAccountHandle(), mConnectionServiceFixtureA);
+ assertEquals(Call.STATE_ACTIVE, mInCallServiceFixtureX.getCall(ids.mCallId).getState());
+ mConnectionServiceFixtureA.mLatestConnection.setConnectionProperties(0);
+
+ assertFalse(Call.Details.hasProperty(
+ mInCallServiceFixtureX.getCall(ids.mCallId).getProperties(),
+ Call.Details.PROPERTY_HAS_CDMA_VOICE_PRIVACY));
+ }
+
+ /**
* Tests the {@link Call#pullExternalCall()} API. Ensures that an external call which is
* pullable can be pulled.
*
diff --git a/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java b/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
index b58d2ce..0c0c42f 100644
--- a/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
+++ b/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
@@ -102,8 +102,16 @@
@Override
public Connection onCreateOutgoingConnection(
PhoneAccountHandle connectionManagerPhoneAccount, ConnectionRequest request) {
- mLatestConnection = new FakeConnection(request.getVideoState(), request.getAddress());
- return mLatestConnection;
+ FakeConnection fakeConnection = new FakeConnection(request.getVideoState(),
+ request.getAddress());
+ mLatestConnection = fakeConnection;
+ if (mCapabilities != NOT_SPECIFIED) {
+ fakeConnection.setConnectionCapabilities(mCapabilities);
+ }
+ if (mProperties != NOT_SPECIFIED) {
+ fakeConnection.setConnectionProperties(mProperties);
+ }
+ return fakeConnection;
}
@Override
diff --git a/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java b/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
index cee5882..fc8e1a5 100644
--- a/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
+++ b/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
@@ -44,6 +44,7 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
+import android.os.Looper;
import android.os.Process;
import android.os.UserHandle;
import android.provider.BlockedNumberContract;
@@ -545,9 +546,9 @@
verify(connectionServiceFixture.getTestDouble())
.createConnection(eq(phoneAccountHandle), anyString(), any(ConnectionRequest.class),
- anyBoolean(), anyBoolean());
- connectionServiceFixture.sendHandleCreateConnectionComplete(
- connectionServiceFixture.mLatestConnectionId);
+ eq(false)/*isIncoming*/, anyBoolean());
+ // Wait for handleCreateConnectionComplete
+ waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);
assertEquals(startingNumCalls + 1, mInCallServiceFixtureX.mCallById.size());
assertEquals(startingNumCalls + 1, mInCallServiceFixtureY.mCallById.size());