Add CDMA Voice Privacy Property to TelephonyConnection
Register for updates on whether or not the current TelephonyConnection
supports CDMA Enhanced Voice Privacy. If so, add a property to the
TelephonyConnection indicating it.
Bug: 26931679
Change-Id: I6e9c17c396275e2436e2dc579669a65ca80a4398
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 0cc5d27..9e52773 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -79,6 +79,8 @@
private static final int MSG_CONNECTION_EXTRAS_CHANGED = 12;
private static final int MSG_SET_ORIGNAL_CONNECTION_CAPABILITIES = 13;
private static final int MSG_ON_HOLD_TONE = 14;
+ private static final int MSG_CDMA_VOICE_PRIVACY_ON = 15;
+ private static final int MSG_CDMA_VOICE_PRIVACY_OFF = 16;
private final Handler mHandler = new Handler() {
@Override
@@ -206,6 +208,15 @@
}
}
break;
+
+ case MSG_CDMA_VOICE_PRIVACY_ON:
+ Log.d(this, "MSG_CDMA_VOICE_PRIVACY_ON received");
+ setCdmaVoicePrivacy(true);
+ break;
+ case MSG_CDMA_VOICE_PRIVACY_OFF:
+ Log.d(this, "MSG_CDMA_VOICE_PRIVACY_OFF received");
+ setCdmaVoicePrivacy(false);
+ break;
}
}
};
@@ -388,6 +399,11 @@
private boolean mIsConferenceSupported;
/**
+ * Indicates whether or not this connection has CDMA Enhanced Voice Privacy enabled.
+ */
+ private boolean mIsCdmaVoicePrivacyEnabled;
+
+ /**
* Listeners to our TelephonyConnection specific callbacks
*/
private final Set<TelephonyConnectionListener> mTelephonyListeners = Collections.newSetFromMap(
@@ -662,6 +678,8 @@
newProperties = changeBitmask(newProperties, PROPERTY_WIFI, mIsWifi);
newProperties = changeBitmask(newProperties, PROPERTY_IS_EXTERNAL_CALL,
isExternalConnection());
+ newProperties = changeBitmask(newProperties, PROPERTY_HAS_CDMA_VOICE_PRIVACY,
+ mIsCdmaVoicePrivacyEnabled);
if (getConnectionProperties() != newProperties) {
setConnectionProperties(newProperties);
@@ -712,6 +730,8 @@
getPhone().registerForDisconnect(mHandler, MSG_DISCONNECT, null);
getPhone().registerForSuppServiceNotification(mHandler, MSG_SUPP_SERVICE_NOTIFY, null);
getPhone().registerForOnHoldTone(mHandler, MSG_ON_HOLD_TONE, null);
+ getPhone().registerForInCallVoicePrivacyOn(mHandler, MSG_CDMA_VOICE_PRIVACY_ON, null);
+ getPhone().registerForInCallVoicePrivacyOff(mHandler, MSG_CDMA_VOICE_PRIVACY_OFF, null);
mOriginalConnection.addPostDialListener(mPostDialListener);
mOriginalConnection.addListener(mOriginalConnectionListener);
@@ -778,6 +798,8 @@
getPhone().unregisterForDisconnect(mHandler);
getPhone().unregisterForSuppServiceNotification(mHandler);
getPhone().unregisterForOnHoldTone(mHandler);
+ getPhone().unregisterForInCallVoicePrivacyOn(mHandler);
+ getPhone().unregisterForInCallVoicePrivacyOff(mHandler);
}
mOriginalConnection.removePostDialListener(mPostDialListener);
mOriginalConnection.removeListener(mOriginalConnectionListener);
@@ -1140,6 +1162,16 @@
}
/**
+ * Sets whether or not CDMA enhanced call privacy is enabled for this connection.
+ */
+ private void setCdmaVoicePrivacy(boolean isEnabled) {
+ if(mIsCdmaVoicePrivacyEnabled != isEnabled) {
+ mIsCdmaVoicePrivacyEnabled = isEnabled;
+ updateConnectionProperties();
+ }
+ }
+
+ /**
* Applies capabilities specific to conferences termination to the
* {@code ConnectionCapabilities} bit-mask.
*