Replace usages of hidden Telecom APIs
Replace usage of the putExtra(int) and the removeConnection() APIs --
use putExtras(Bundle) instead of putExtra(int), and move the
removeTelephonyConnectionListener call to close() instead of going
through removeConnection.
Test: manual
Bug: 141576153
Change-Id: I30bbb9e0bdabd18444fb6674c7b3b8f63a7d5282
diff --git a/src/com/android/services/telephony/TelephonyConferenceBase.java b/src/com/android/services/telephony/TelephonyConferenceBase.java
index a8bbf64..5e7ecf6 100644
--- a/src/com/android/services/telephony/TelephonyConferenceBase.java
+++ b/src/com/android/services/telephony/TelephonyConferenceBase.java
@@ -17,6 +17,7 @@
package com.android.services.telephony;
import android.annotation.NonNull;
+import android.os.Bundle;
import android.telecom.Conference;
import android.telecom.Connection;
import android.telecom.PhoneAccountHandle;
@@ -134,9 +135,11 @@
final Connection primaryConnection = getPrimaryConnection();
if (primaryConnection != null && primaryConnection instanceof TelephonyConnection) {
TelephonyConnection telephonyConnection = (TelephonyConnection) primaryConnection;
- putExtra(TelecomManager.EXTRA_CALL_NETWORK_TYPE,
+ Bundle newExtras = new Bundle();
+ newExtras.putInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE,
ServiceState.rilRadioTechnologyToNetworkType(
telephonyConnection.getCallRadioTech()));
+ putExtras(newExtras);
} else {
Log.w(TAG, "No primary connection found while updateCallRadioTechAfterCreation");
}
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 3282d06..94a2cd5 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -1834,6 +1834,10 @@
Log.v(this, "close");
clearOriginalConnection();
destroy();
+ if (mTelephonyConnectionService != null) {
+ removeTelephonyConnectionListener(
+ mTelephonyConnectionService.getTelephonyConnectionListener());
+ }
notifyDestroyed();
}
@@ -2579,8 +2583,11 @@
// For IMS PS call conference call, it can be updated via its host connection
// {@link #Listener.onExtrasChanged} event.
if (getConference() != null) {
- getConference().putExtra(TelecomManager.EXTRA_CALL_NETWORK_TYPE,
+ Bundle newExtras = new Bundle();
+ newExtras.putInt(
+ TelecomManager.EXTRA_CALL_NETWORK_TYPE,
ServiceState.rilRadioTechnologyToNetworkType(vrat));
+ getConference().putExtras(newExtras);
}
}
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 2d96c6b..c2c4c50 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -1708,13 +1708,8 @@
return true;
}
- @Override
- public void removeConnection(Connection connection) {
- super.removeConnection(connection);
- if (connection instanceof TelephonyConnection) {
- TelephonyConnection telephonyConnection = (TelephonyConnection) connection;
- telephonyConnection.removeTelephonyConnectionListener(mTelephonyConnectionListener);
- }
+ TelephonyConnection.TelephonyConnectionListener getTelephonyConnectionListener() {
+ return mTelephonyConnectionListener;
}
/**