Telephony mainline updates.
- Remove uses of TelecomManager#from and replace with proper
Context#getSystemService invocations.
- In NotificationManager#getShowVoicemailIntentForDefaultDialer, use a new
Telecom system API to get the dialer for a specific user instead of using
DefaultDialerManager directly.
- Update references to ConferenceParticipant which is not internal to
IMS.
- Remove Telecom logging references.
Bug: 141576016
Test: Manual smoke test.
Test: Run unit tests.
Test: Run CTS tests.
Change-Id: If1090036d349cc72f86d523b781e09cd37cf0871
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 17a1734..3858595 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -214,7 +214,7 @@
mSubscriptionInfoHelper.setActionBarTitle(
getActionBar(), getResources(), R.string.call_settings_with_label);
mPhone = mSubscriptionInfoHelper.getPhone();
- mTelecomManager = TelecomManager.from(this);
+ mTelecomManager = getSystemService(TelecomManager.class);
}
private void updateImsManager(Phone phone) {
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index 6486ae2..410965b 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -42,7 +42,6 @@
import android.preference.PreferenceManager;
import android.provider.ContactsContract.PhoneLookup;
import android.provider.Settings;
-import android.telecom.DefaultDialerManager;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -165,7 +164,7 @@
(StatusBarManager) app.getSystemService(Context.STATUS_BAR_SERVICE);
mUserManager = (UserManager) app.getSystemService(Context.USER_SERVICE);
mSubscriptionManager = SubscriptionManager.from(mContext);
- mTelecomManager = TelecomManager.from(mContext);
+ mTelecomManager = app.getSystemService(TelecomManager.class);
mTelephonyManager = (TelephonyManager) app.getSystemService(Context.TELEPHONY_SERVICE);
}
@@ -479,8 +478,8 @@
}
private Intent getShowVoicemailIntentForDefaultDialer(UserHandle userHandle) {
- String dialerPackage = DefaultDialerManager
- .getDefaultDialerApplication(mContext, userHandle.getIdentifier());
+ String dialerPackage = mContext.getSystemService(TelecomManager.class)
+ .getDefaultDialerPackage(userHandle.getIdentifier());
return new Intent(TelephonyManager.ACTION_SHOW_VOICEMAIL_NOTIFICATION)
.setPackage(dialerPackage);
}
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 238e853..bce2e82 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -2646,7 +2646,8 @@
@Override
public Bundle getVisualVoicemailSettings(String callingPackage, int subId) {
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
- String systemDialer = TelecomManager.from(mApp).getSystemDialerPackage();
+ TelecomManager tm = mApp.getSystemService(TelecomManager.class);
+ String systemDialer = tm.getSystemDialerPackage();
if (!TextUtils.equals(callingPackage, systemDialer)) {
throw new SecurityException("caller must be system dialer");
}
@@ -2872,8 +2873,8 @@
public void sendDialerSpecialCode(String callingPackage, String inputCode) {
final Phone defaultPhone = getDefaultPhone();
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
- String defaultDialer = TelecomManager.from(defaultPhone.getContext())
- .getDefaultDialerPackage();
+ TelecomManager tm = defaultPhone.getContext().getSystemService(TelecomManager.class);
+ String defaultDialer = tm.getDefaultDialerPackage();
if (!TextUtils.equals(callingPackage, defaultDialer)) {
TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(
getDefaultSubscription(), "sendDialerSpecialCode");
@@ -5629,7 +5630,7 @@
@Override
public boolean isTtyModeSupported() {
- TelecomManager telecomManager = TelecomManager.from(mApp);
+ TelecomManager telecomManager = mApp.getSystemService(TelecomManager.class);
return telecomManager.isTtySupported();
}
@@ -6092,8 +6093,8 @@
PhoneAccountHandle phoneAccountHandle, Uri uri) {
final Phone defaultPhone = getDefaultPhone();
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
- if (!TextUtils.equals(callingPackage,
- TelecomManager.from(defaultPhone.getContext()).getDefaultDialerPackage())) {
+ TelecomManager tm = defaultPhone.getContext().getSystemService(TelecomManager.class);
+ if (!TextUtils.equals(callingPackage, tm.getDefaultDialerPackage())) {
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
mApp, PhoneUtils.getSubIdForPhoneAccountHandle(phoneAccountHandle),
"setVoicemailRingtoneUri");
@@ -6149,8 +6150,8 @@
PhoneAccountHandle phoneAccountHandle, boolean enabled) {
final Phone defaultPhone = getDefaultPhone();
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
- if (!TextUtils.equals(callingPackage,
- TelecomManager.from(defaultPhone.getContext()).getDefaultDialerPackage())) {
+ TelecomManager tm = defaultPhone.getContext().getSystemService(TelecomManager.class);
+ if (!TextUtils.equals(callingPackage, tm.getDefaultDialerPackage())) {
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
mApp, PhoneUtils.getSubIdForPhoneAccountHandle(phoneAccountHandle),
"setVoicemailVibrationEnabled");
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 6c3f0bf..d4fe450 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -31,6 +31,7 @@
import android.telecom.VideoProfile;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneNumberUtils;
+import android.telephony.Rlog;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
import android.util.Log;
@@ -299,7 +300,7 @@
MmiCode mmiCode,
Message buttonCallbackMessage,
Dialog previousAlert) {
- log("displayMMIInitiate: " + android.telecom.Log.pii(mmiCode.toString()));
+ log("displayMMIInitiate: " + Rlog.pii(LOG_TAG, mmiCode.toString()));
if (previousAlert != null) {
previousAlert.dismiss();
}
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
index aa6b155..3811a77 100644
--- a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
+++ b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
@@ -101,7 +101,7 @@
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- mTelecomManager = TelecomManager.from(getActivity());
+ mTelecomManager = getActivity().getSystemService(TelecomManager.class);
mTelephonyManager = TelephonyManager.from(getActivity());
mSubscriptionManager = SubscriptionManager.from(getActivity());
}
diff --git a/src/com/android/phone/vvm/VvmDumpHandler.java b/src/com/android/phone/vvm/VvmDumpHandler.java
index 866927e..82c5bb5 100644
--- a/src/com/android/phone/vvm/VvmDumpHandler.java
+++ b/src/com/android/phone/vvm/VvmDumpHandler.java
@@ -19,7 +19,7 @@
indentedWriter.println("******* OmtpVvm *******");
indentedWriter.println("======= Configs =======");
indentedWriter.increaseIndent();
- for (PhoneAccountHandle handle : TelecomManager.from(context)
+ for (PhoneAccountHandle handle : context.getSystemService(TelecomManager.class)
.getCallCapablePhoneAccounts()) {
int subId = PhoneAccountHandleConverter.toSubId(handle);
indentedWriter.println(
diff --git a/src/com/android/services/telephony/ConferenceParticipantConnection.java b/src/com/android/services/telephony/ConferenceParticipantConnection.java
index b1f1b23..ed92e7f 100644
--- a/src/com/android/services/telephony/ConferenceParticipantConnection.java
+++ b/src/com/android/services/telephony/ConferenceParticipantConnection.java
@@ -17,15 +17,13 @@
package com.android.services.telephony;
import android.net.Uri;
-import android.telecom.ConferenceParticipant;
import android.telecom.Connection;
import android.telecom.DisconnectCause;
-import android.telecom.PhoneAccount;
-import android.telephony.PhoneNumberUtils;
+import android.telephony.Rlog;
import android.telephony.SubscriptionInfo;
import android.text.TextUtils;
-import com.android.internal.annotations.VisibleForTesting;
+import com.android.ims.internal.ConferenceParticipant;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
@@ -34,6 +32,8 @@
*/
public class ConferenceParticipantConnection extends Connection {
+ private static final String LOG_TAG = "ConferenceParticipantConnection";
+
/**
* The user entity URI For the conference participant.
*/
@@ -88,7 +88,7 @@
* @param newState The new state.
*/
public void updateState(int newState) {
- Log.v(this, "updateState endPoint: %s state: %s", Log.pii(mEndpoint),
+ Log.v(this, "updateState endPoint: %s state: %s", Rlog.pii(LOG_TAG, mEndpoint),
Connection.stateToString(newState));
if (newState == getState()) {
return;
@@ -203,13 +203,13 @@
sb.append("[ConferenceParticipantConnection objId:");
sb.append(System.identityHashCode(this));
sb.append(" endPoint:");
- sb.append(Log.pii(mEndpoint));
+ sb.append(Rlog.pii(LOG_TAG, mEndpoint));
sb.append(" address:");
- sb.append(Log.pii(getAddress()));
+ sb.append(Rlog.pii(LOG_TAG, getAddress()));
sb.append(" addressPresentation:");
sb.append(getAddressPresentation());
sb.append(" parentConnection:");
- sb.append(Log.pii(mParentConnection.getAddress()));
+ sb.append(Rlog.pii(LOG_TAG, mParentConnection.getAddress()));
sb.append(" state:");
sb.append(Connection.stateToString(getState()));
sb.append(" connectTime:");
diff --git a/src/com/android/services/telephony/HoldTracker.java b/src/com/android/services/telephony/HoldTracker.java
index 805802f..5032b41 100644
--- a/src/com/android/services/telephony/HoldTracker.java
+++ b/src/com/android/services/telephony/HoldTracker.java
@@ -16,7 +16,6 @@
package com.android.services.telephony;
-import android.telecom.Log;
import android.telecom.PhoneAccountHandle;
import java.util.ArrayList;
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 17549cf..b47adb2 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -21,19 +21,19 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.PersistableBundle;
-import android.telecom.ConferenceParticipant;
import android.telecom.Connection;
import android.telecom.Connection.VideoProvider;
import android.telecom.DisconnectCause;
-import android.telecom.Log;
import android.telecom.PhoneAccountHandle;
import android.telecom.StatusHints;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneNumberUtils;
+import android.telephony.Rlog;
import android.util.Pair;
+import com.android.ims.internal.ConferenceParticipant;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallStateException;
@@ -69,6 +69,8 @@
*/
public class ImsConference extends TelephonyConferenceBase implements Holdable {
+ private static final String LOG_TAG = "ImsConference";
+
/**
* Abstracts out fetching a feature flag. Makes testing easier.
*/
@@ -168,7 +170,7 @@
return;
}
- sendConnectionEvent(event, extras);
+ sendConferenceEvent(event, extras);
}
@Override
@@ -328,15 +330,15 @@
conferenceCapabilities = changeBitmask(conferenceCapabilities,
Connection.CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL,
- can(capabilities, Connection.CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL));
+ (capabilities & Connection.CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL) != 0);
if (isVideoConferencingSupported) {
conferenceCapabilities = changeBitmask(conferenceCapabilities,
Connection.CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL,
- can(capabilities, Connection.CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL));
+ (capabilities & Connection.CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL) != 0);
conferenceCapabilities = changeBitmask(conferenceCapabilities,
Connection.CAPABILITY_CAN_UPGRADE_TO_VIDEO,
- can(capabilities, Connection.CAPABILITY_CAN_UPGRADE_TO_VIDEO));
+ (capabilities & Connection.CAPABILITY_CAN_UPGRADE_TO_VIDEO) != 0);
} else {
// If video conferencing is not supported, explicitly turn off the remote video
// capability and the ability to upgrade to video.
@@ -349,7 +351,7 @@
conferenceCapabilities = changeBitmask(conferenceCapabilities,
Connection.CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO,
- can(capabilities, Connection.CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO));
+ (capabilities & Connection.CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO) != 0);
conferenceCapabilities = changeBitmask(conferenceCapabilities,
Connection.CAPABILITY_CAN_PAUSE_VIDEO,
@@ -368,15 +370,15 @@
private int applyHostProperties(int conferenceProperties, int properties) {
conferenceProperties = changeBitmask(conferenceProperties,
Connection.PROPERTY_HIGH_DEF_AUDIO,
- can(properties, Connection.PROPERTY_HIGH_DEF_AUDIO));
+ (properties & Connection.PROPERTY_HIGH_DEF_AUDIO) != 0);
conferenceProperties = changeBitmask(conferenceProperties,
Connection.PROPERTY_WIFI,
- can(properties, Connection.PROPERTY_WIFI));
+ (properties & Connection.PROPERTY_WIFI) != 0);
conferenceProperties = changeBitmask(conferenceProperties,
Connection.PROPERTY_IS_EXTERNAL_CALL,
- can(properties, Connection.PROPERTY_IS_EXTERNAL_CALL));
+ (properties & Connection.PROPERTY_IS_EXTERNAL_CALL) != 0);
conferenceProperties = changeBitmask(conferenceProperties,
Connection.PROPERTY_REMOTELY_HOSTED, !isConferenceHost());
@@ -602,7 +604,8 @@
* that the conference is represented appropriately on Bluetooth devices.
*/
private void updateManageConference() {
- boolean couldManageConference = can(Connection.CAPABILITY_MANAGE_CONFERENCE);
+ boolean couldManageConference =
+ (getConnectionCapabilities() & Connection.CAPABILITY_MANAGE_CONFERENCE) != 0;
boolean canManageConference = mFeatureFlagProxy.isUsingSinglePartyCallEmulation()
&& mIsEmulatingSinglePartyCall
? mConferenceParticipantConnections.size() > 1
@@ -822,8 +825,8 @@
if (!participantUserEntities.contains(entry.getKey())) {
ConferenceParticipantConnection participant = entry.getValue();
participant.setDisconnected(new DisconnectCause(DisconnectCause.CANCELED));
- mTelephonyConnectionService.removeConnection(participant);
removeTelephonyConnection(participant);
+ participant.destroy();
entryIterator.remove();
oldParticipantsRemoved = true;
}
@@ -940,8 +943,8 @@
// again anyways.
entry.setDisconnected(new DisconnectCause(DisconnectCause.CANCELED,
DisconnectCause.REASON_EMULATING_SINGLE_CALL));
- mTelephonyConnectionService.removeConnection(entry);
removeTelephonyConnection(entry);
+ entry.destroy();
valueIterator.remove();
}
@@ -949,7 +952,8 @@
setConferenceState(false);
// Remove manage conference capability.
- mCouldManageConference = can(Connection.CAPABILITY_MANAGE_CONFERENCE);
+ mCouldManageConference =
+ (getConnectionCapabilities() & Connection.CAPABILITY_MANAGE_CONFERENCE) != 0;
int currentCapabilities = getConnectionCapabilities();
currentCapabilities &= ~Connection.CAPABILITY_MANAGE_CONFERENCE;
setConnectionCapabilities(currentCapabilities);
@@ -1009,7 +1013,7 @@
mConferenceParticipantConnections.remove(new Pair<>(participant.getUserEntity(),
participant.getEndpoint()));
}
- mTelephonyConnectionService.removeConnection(participant);
+ participant.destroy();
}
/**
@@ -1025,7 +1029,6 @@
// Mark disconnect cause as cancelled to ensure that the call is not logged in the
// call log.
connection.setDisconnected(new DisconnectCause(DisconnectCause.CANCELED));
- mTelephonyConnectionService.removeConnection(connection);
connection.destroy();
handleConnectionDestruction(connection);
}
@@ -1086,7 +1089,7 @@
boolean isHost = PhoneNumberUtils.compare(hostNumber, number);
Log.v(this, "isParticipantHost(%s) : host: %s, participant %s", (isHost ? "Y" : "N"),
- Log.pii(hostNumber), Log.pii(number));
+ Rlog.pii(LOG_TAG, hostNumber), Rlog.pii(LOG_TAG, number));
if (isHost) {
return true;
@@ -1209,8 +1212,8 @@
*/
private boolean isVideoCapable() {
int capabilities = mConferenceHost.getConnectionCapabilities();
- return can(capabilities, Connection.CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL)
- && can(capabilities, Connection.CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL);
+ return (capabilities & Connection.CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL) != 0
+ && (capabilities & Connection.CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL) != 0;
}
private void updateStatusHints() {
diff --git a/src/com/android/services/telephony/ImsConferenceController.java b/src/com/android/services/telephony/ImsConferenceController.java
index 315aaad..1fb377c 100644
--- a/src/com/android/services/telephony/ImsConferenceController.java
+++ b/src/com/android/services/telephony/ImsConferenceController.java
@@ -22,6 +22,7 @@
import android.telecom.ConnectionService;
import android.telecom.DisconnectCause;
import android.telecom.PhoneAccountHandle;
+import android.telephony.Rlog;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
@@ -38,11 +39,13 @@
* Manages conferences for IMS connections.
*/
public class ImsConferenceController {
+ private static final String LOG_TAG = "ImsConferenceController";
/**
* Conference listener; used to receive notification when a conference has been disconnected.
*/
- private final Conference.Listener mConferenceListener = new Conference.Listener() {
+ private final TelephonyConferenceBase.TelephonyConferenceListener mConferenceListener =
+ new TelephonyConferenceBase.TelephonyConferenceListener() {
@Override
public void onDestroyed(Conference conference) {
if (Log.VERBOSE) {
@@ -69,13 +72,13 @@
@Override
public void onStateChanged(Connection c, int state) {
- Log.v(this, "onStateChanged: %s", Log.pii(c.getAddress()));
+ Log.v(this, "onStateChanged: %s", Rlog.pii(LOG_TAG, c.getAddress()));
recalculate();
}
@Override
public void onDisconnected(Connection c, DisconnectCause disconnectCause) {
- Log.v(this, "onDisconnected: %s", Log.pii(c.getAddress()));
+ Log.v(this, "onDisconnected: %s", Rlog.pii(LOG_TAG, c.getAddress()));
recalculate();
}
@@ -379,7 +382,7 @@
ImsConference conference = new ImsConference(mTelecomAccountRegistry, mConnectionService,
conferenceHostConnection, phoneAccountHandle, mFeatureFlagProxy);
conference.setState(conferenceHostConnection.getState());
- conference.addListener(mConferenceListener);
+ conference.addTelephonyConferenceListener(mConferenceListener);
conference.updateConferenceParticipantsAfterCreation();
mConnectionService.addConference(conference);
conferenceHostConnection.setTelecomCallId(conference.getTelecomCallId());
diff --git a/src/com/android/services/telephony/Log.java b/src/com/android/services/telephony/Log.java
index 9941a59..57bf849 100644
--- a/src/com/android/services/telephony/Log.java
+++ b/src/com/android/services/telephony/Log.java
@@ -16,8 +16,6 @@
package com.android.services.telephony;
-import android.content.Context;
-
/**
* Manages logging for the entire module.
*/
@@ -39,72 +37,80 @@
return FORCE_LOGGING || android.util.Log.isLoggable(TAG, level);
}
- public static void initLogging(Context context) {
- // Register Telephony with the Telecom Logger.
- android.telecom.Log.setTag(TAG);
- android.telecom.Log.setSessionContext(context);
- }
-
// Relay log messages to Telecom
// TODO: Redo namespace of Telephony to use these methods directly.
public static void d(String prefix, String format, Object... args) {
- android.telecom.Log.d(prefix, format, args);
+ android.util.Log.d(TAG, (args == null || args.length == 0) ? format :
+ String.format(prefix + ": " + format, args));
}
public static void d(Object objectPrefix, String format, Object... args) {
- android.telecom.Log.d(objectPrefix, format, args);
+ android.util.Log.d(TAG, (args == null || args.length == 0) ? format :
+ String.format(getPrefixFromObject(objectPrefix) + ": " + format, args));
}
public static void i(String prefix, String format, Object... args) {
- android.telecom.Log.i(prefix, format, args);
+ android.util.Log.i(TAG, (args == null || args.length == 0) ? format :
+ String.format(prefix + ": " + format, args));
}
public static void i(Object objectPrefix, String format, Object... args) {
- android.telecom.Log.i(objectPrefix, format, args);
+ android.util.Log.i(TAG, (args == null || args.length == 0) ? format :
+ String.format(getPrefixFromObject(objectPrefix) + ": " + format, args));
}
public static void v(String prefix, String format, Object... args) {
- android.telecom.Log.v(prefix, format, args);
+ android.util.Log.v(TAG, (args == null || args.length == 0) ? format :
+ String.format(prefix + ": " + format, args));
}
public static void v(Object objectPrefix, String format, Object... args) {
- android.telecom.Log.v(objectPrefix, format, args);
+ android.util.Log.v(TAG, (args == null || args.length == 0) ? format :
+ String.format(getPrefixFromObject(objectPrefix) + ": " + format, args));
}
public static void w(String prefix, String format, Object... args) {
- android.telecom.Log.w(prefix, format, args);
+ android.util.Log.w(TAG, (args == null || args.length == 0) ? format :
+ String.format(prefix + ": " + format, args));
}
public static void w(Object objectPrefix, String format, Object... args) {
- android.telecom.Log.w(objectPrefix, format, args);
+ android.util.Log.w(TAG, (args == null || args.length == 0) ? format :
+ String.format(getPrefixFromObject(objectPrefix) + ": " + format, args));
}
public static void e(String prefix, Throwable tr, String format, Object... args) {
- android.telecom.Log.e(prefix, tr, format, args);
+ android.util.Log.e(TAG, (args == null || args.length == 0) ? format :
+ String.format(prefix + ": " + format, args), tr);
}
public static void e(Object objectPrefix, Throwable tr, String format, Object... args) {
- android.telecom.Log.e(objectPrefix, tr, format, args);
+ android.util.Log.e(TAG, (args == null || args.length == 0) ? format :
+ String.format(getPrefixFromObject(objectPrefix) + ": " + format, args), tr);
}
public static void wtf(String prefix, Throwable tr, String format, Object... args) {
- android.telecom.Log.wtf(prefix, tr, format, args);
+ android.util.Log.wtf(TAG, (args == null || args.length == 0) ? format :
+ String.format(prefix + ": " + format, args), tr);
}
public static void wtf(Object objectPrefix, Throwable tr, String format, Object... args) {
- android.telecom.Log.wtf(objectPrefix, tr, format, args);
+ android.util.Log.wtf(TAG, (args == null || args.length == 0) ? format :
+ String.format(getPrefixFromObject(objectPrefix) + ": " + format, args), tr);
}
public static void wtf(String prefix, String format, Object... args) {
- android.telecom.Log.wtf(prefix, format, args);
+ android.util.Log.wtf(TAG, (args == null || args.length == 0) ? format :
+ String.format(prefix + ": " + format, args));
}
public static void wtf(Object objectPrefix, String format, Object... args) {
- android.telecom.Log.wtf(objectPrefix, format, args);
+ android.util.Log.wtf(TAG, (args == null || args.length == 0) ? format :
+ String.format(getPrefixFromObject(objectPrefix) + ": " + format, args));
}
- public static String pii(Object pii) {
- return android.telecom.Log.pii(pii);
+ private static String getPrefixFromObject(Object obj) {
+ return obj == null ? "<null>" : obj.getClass().getSimpleName();
}
}
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index 0ce0a19..2dfeaed 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -25,6 +25,7 @@
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
+import android.telephony.Rlog;
import android.text.TextUtils;
import com.android.internal.telephony.Call;
@@ -47,6 +48,8 @@
* occurence. One instance of these exists for each of the telephony-based call services.
*/
final class PstnIncomingCallNotifier {
+ private static final String LOG_TAG = "PstnIncomingCallNotifier";
+
/** New ringing connection event code. */
private static final int EVENT_NEW_RINGING_CONNECTION = 100;
private static final int EVENT_CDMA_CALL_WAITING = 101;
@@ -181,7 +184,7 @@
// Presentation of the number is allowed, so we ensure the number matches the
// one in the call waiting information.
Log.i(this, "handleCdmaCallWaiting: inform telecom of waiting call; "
- + "number = %s", Log.pii(number));
+ + "number = %s", Rlog.pii(LOG_TAG, number));
sendIncomingCallIntent(connection);
} else {
Log.w(this, "handleCdmaCallWaiting: presentation or number do not match, not"
@@ -248,7 +251,8 @@
// connection already disconnected. Do nothing
}
} else {
- TelecomManager.from(mPhone.getContext()).addNewUnknownCall(handle, extras);
+ TelecomManager tm = mPhone.getContext().getSystemService(TelecomManager.class);
+ tm.addNewUnknownCall(handle, extras);
}
} else {
Log.i(this, "swapped an old connection, new one is: %s", connection);
@@ -283,7 +287,8 @@
// connection already disconnected. Do nothing
}
} else {
- TelecomManager.from(mPhone.getContext()).addNewIncomingCall(handle, extras);
+ TelecomManager tm = mPhone.getContext().getSystemService(TelecomManager.class);
+ tm.addNewIncomingCall(handle, extras);
}
}
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 3102b0b..730bee5 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -41,6 +41,7 @@
import android.telecom.TelecomManager;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneStateListener;
+import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
@@ -71,6 +72,7 @@
*/
public class TelecomAccountRegistry {
private static final boolean DBG = false; /* STOP SHIP if true */
+ private static final String LOG_TAG = "TelecomAccountRegistry";
// This icon is the one that is used when the Slot ID that we have for a particular SIM
// is not supported, i.e. SubscriptionManager.INVALID_SLOT_ID or the 5th SIM in a phone.
@@ -389,7 +391,7 @@
}
if(isMergedSim) {
groupId = GROUP_PREFIX + line1Number;
- Log.i(this, "Adding Merged Account with group: " + Log.pii(groupId));
+ Log.i(this, "Adding Merged Account with group: " + Rlog.pii(LOG_TAG, groupId));
}
PhoneAccount account = PhoneAccount.builder(phoneAccountHandle, label)
@@ -872,7 +874,7 @@
TelecomAccountRegistry(Context context) {
mContext = context;
- mTelecomManager = TelecomManager.from(context);
+ mTelecomManager = context.getSystemService(TelecomManager.class);
mTelephonyManager = TelephonyManager.from(context);
mSubscriptionManager = SubscriptionManager.from(context);
}
@@ -1144,7 +1146,7 @@
R.bool.config_emergency_account_emergency_calls_only);
List<PhoneAccountHandle> accountHandles = emergencyCallsOnlyEmergencyAccount
? mTelecomManager.getAllPhoneAccountHandles()
- : mTelecomManager.getCallCapablePhoneAccounts(true /* includeDisabled */);
+ : mTelecomManager.getCallCapablePhoneAccounts();
for (PhoneAccountHandle handle : accountHandles) {
if (telephonyComponentName.equals(handle.getComponentName()) &&
diff --git a/src/com/android/services/telephony/TelephonyConferenceBase.java b/src/com/android/services/telephony/TelephonyConferenceBase.java
index 31d0f56..a8bbf64 100644
--- a/src/com/android/services/telephony/TelephonyConferenceBase.java
+++ b/src/com/android/services/telephony/TelephonyConferenceBase.java
@@ -20,6 +20,8 @@
import android.telecom.Conference;
import android.telecom.Connection;
import android.telecom.PhoneAccountHandle;
+import android.telecom.TelecomManager;
+import android.telephony.ServiceState;
import java.util.Collections;
import java.util.Iterator;
@@ -32,6 +34,8 @@
* all of these conferences use.
*/
public class TelephonyConferenceBase extends Conference {
+ private static final String TAG = "TelephonyConferenceBase";
+
/**
* Listener for conference events.
*/
@@ -40,7 +44,13 @@
* Listener called when a connection is added or removed from a conference.
* @param connection The connection.
*/
- public void onConferenceMembershipChanged(Connection connection) {};
+ public void onConferenceMembershipChanged(Connection connection) {}
+
+ /**
+ * Listener called when a conference is destroyed.
+ * @param conference The conference.
+ */
+ public void onDestroyed(Conference conference) {}
}
private final Set<TelephonyConferenceListener> mListeners = Collections.newSetFromMap(
@@ -50,7 +60,7 @@
* Adds a listener to this conference.
* @param listener The listener.
*/
- public void addListener(@NonNull TelephonyConferenceListener listener) {
+ public void addTelephonyConferenceListener(@NonNull TelephonyConferenceListener listener) {
mListeners.add(listener);
}
@@ -58,7 +68,7 @@
* Removes a listener from this conference.
* @param listener The listener.
*/
- public void removeListener(@NonNull TelephonyConferenceListener listener) {
+ public void removeTelephonyConferenceListener(@NonNull TelephonyConferenceListener listener) {
mListeners.remove(listener);
}
@@ -114,6 +124,46 @@
removeTelephonyConnection(connectionIterator.next());
}
destroy();
+ notifyDestroyed();
+ }
+
+ /**
+ * Updates RIL voice radio technology used for current conference after its creation.
+ */
+ public void updateCallRadioTechAfterCreation() {
+ final Connection primaryConnection = getPrimaryConnection();
+ if (primaryConnection != null && primaryConnection instanceof TelephonyConnection) {
+ TelephonyConnection telephonyConnection = (TelephonyConnection) primaryConnection;
+ putExtra(TelecomManager.EXTRA_CALL_NETWORK_TYPE,
+ ServiceState.rilRadioTechnologyToNetworkType(
+ telephonyConnection.getCallRadioTech()));
+ } else {
+ Log.w(TAG, "No primary connection found while updateCallRadioTechAfterCreation");
+ }
+ }
+
+ /**
+ * Removes the specified capability from the set of capabilities of this {@code Conference}.
+ *
+ * @param capability The capability to remove from the set.
+ */
+ public void removeCapability(int capability) {
+ int newCapabilities = getConnectionCapabilities();
+ newCapabilities &= ~capability;
+
+ setConnectionCapabilities(newCapabilities);
+ }
+
+ /**
+ * Adds the specified capability to the set of capabilities of this {@code Conference}.
+ *
+ * @param capability The capability to add to the set.
+ */
+ public void addCapability(int capability) {
+ int newCapabilities = getConnectionCapabilities();
+ newCapabilities |= capability;
+
+ setConnectionCapabilities(newCapabilities);
}
/**
@@ -126,4 +176,13 @@
listener.onConferenceMembershipChanged(connection);
}
}
+
+ /**
+ * Notifies {@link TelephonyConferenceListener}s of a conference being destroyed
+ */
+ private void notifyDestroyed() {
+ for (TelephonyConferenceListener listener : mListeners) {
+ listener.onDestroyed(this);
+ }
+ }
}
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index a9dfb7b..87941b0 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -29,7 +29,6 @@
import android.os.PersistableBundle;
import android.telecom.CallAudioState;
import android.telecom.Conference;
-import android.telecom.ConferenceParticipant;
import android.telecom.Connection;
import android.telecom.ConnectionService;
import android.telecom.PhoneAccount;
@@ -41,6 +40,7 @@
import android.telephony.CarrierConfigManager;
import android.telephony.DisconnectCause;
import android.telephony.PhoneNumberUtils;
+import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.telephony.ims.ImsCallProfile;
@@ -48,6 +48,7 @@
import android.util.Pair;
import com.android.ims.ImsCall;
+import com.android.ims.internal.ConferenceParticipant;
import com.android.internal.os.SomeArgs;
import com.android.internal.telephony.Call;
import com.android.internal.telephony.CallFailCause;
@@ -79,6 +80,8 @@
* Base class for CDMA and GSM connections.
*/
abstract class TelephonyConnection extends Connection implements Holdable {
+ private static final String LOG_TAG = "TelephonyConnection";
+
private static final int MSG_PRECISE_CALL_STATE_CHANGED = 1;
private static final int MSG_RINGBACK_TONE = 2;
private static final int MSG_HANDOVER_STATE_CHANGED = 3;
@@ -1609,8 +1612,8 @@
for (String key : extras.keySet()) {
Object value = extras.get(key);
if (value instanceof String) {
- Log.d(this, "updateExtras Key=" + Log.pii(key) +
- " value=" + Log.pii((String)value));
+ Log.d(this, "updateExtras Key=" + Rlog.pii(LOG_TAG, key)
+ + " value=" + Rlog.pii(LOG_TAG, value));
}
}
}
@@ -1633,7 +1636,7 @@
Log.d(this, "Extras update not required");
}
} else {
- Log.d(this, "updateExtras extras: " + Log.pii(extras));
+ Log.d(this, "updateExtras extras: " + Rlog.pii(LOG_TAG, extras));
}
}
}
@@ -2393,7 +2396,7 @@
sb.append(" properties:");
sb.append(propertiesToString(getConnectionProperties()));
sb.append(" address:");
- sb.append(Log.pii(getAddress()));
+ sb.append(Rlog.pii(LOG_TAG, getAddress()));
sb.append(" originalConnection:");
sb.append(mOriginalConnection);
sb.append(" partOfConf:");
@@ -2557,6 +2560,50 @@
}
/**
+ * Sets RIL voice radio technology used for current connection.
+ * <p>
+ * This property is set by the Telephony {@link ConnectionService}.
+ *
+ * @param vrat the RIL Voice Radio Technology used for current connection,
+ * see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}.
+ */
+ public final void setCallRadioTech(@RilRadioTechnology int vrat) {
+ Bundle extras = getExtras();
+ if (extras == null) {
+ extras = new Bundle();
+ }
+ extras.putInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE,
+ ServiceState.rilRadioTechnologyToNetworkType(vrat));
+ putExtras(extras);
+ // Propagates the call radio technology to its parent {@link android.telecom.Conference}
+ // This action only covers non-IMS CS conference calls.
+ // 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,
+ ServiceState.rilRadioTechnologyToNetworkType(vrat));
+ }
+ }
+
+ /**
+ * Returns RIL voice radio technology used for current connection.
+ * <p>
+ * Used by the Telephony {@link ConnectionService}.
+ *
+ * @return the RIL voice radio technology used for current connection,
+ * see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}.
+ */
+ public final @RilRadioTechnology int getCallRadioTech() {
+ int voiceNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN;
+ Bundle extras = getExtras();
+ if (extras != null) {
+ voiceNetworkType = extras.getInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE,
+ TelephonyManager.NETWORK_TYPE_UNKNOWN);
+ }
+ return ServiceState.networkTypeToRilRadioTechnology(voiceNetworkType);
+ }
+
+ /**
* Notifies {@link TelephonyConnectionListener}s of a change to conference participant data
* received via the {@link ImsConference} (i.e. conference event package).
*
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 7b55bfc..2d96c6b 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -110,10 +110,6 @@
TelephonyConnectionService.this.addTelephonyConference(mImsConference);
}
@Override
- public void removeConnection(Connection connection) {
- TelephonyConnectionService.this.removeConnection(connection);
- }
- @Override
public void addExistingConnection(PhoneAccountHandle phoneAccountHandle,
Connection connection) {
TelephonyConnectionService.this
@@ -129,11 +125,6 @@
public void addConnectionToConferenceController(TelephonyConnection connection) {
TelephonyConnectionService.this.addConnectionToConferenceController(connection);
}
-
- @Override
- public void onConferenceMembershipChanged(Connection connection) {
- mHoldTracker.updateHoldCapability(connection.getPhoneAccountHandle());
- }
};
private final BroadcastReceiver mTtyBroadcastReceiver = new BroadcastReceiver() {
@@ -329,7 +320,6 @@
@Override
public void onCreate() {
super.onCreate();
- Log.initLogging(this);
setTelephonyManagerProxy(new TelephonyManagerProxyImpl(getApplicationContext()));
mExpectedComponentName = new ComponentName(this, this.getClass());
mEmergencyTonePlayer = new EmergencyTonePlayer(this);
@@ -1784,7 +1774,8 @@
// If the CDMA conference has not been merged, add-call will not work, so fail
// this request to add a call.
- if (cdmaConf.can(Connection.CAPABILITY_MERGE_CONFERENCE)) {
+ if ((cdmaConf.getConnectionCapabilities()
+ & Connection.CAPABILITY_MERGE_CONFERENCE) != 0) {
return Connection.createFailedConnection(new DisconnectCause(
DisconnectCause.RESTRICTED,
null,
@@ -1861,6 +1852,6 @@
*/
public void addTelephonyConference(@NonNull TelephonyConferenceBase conference) {
addConference(conference);
- conference.addListener(mTelephonyConferenceListener);
+ conference.addTelephonyConferenceListener(mTelephonyConferenceListener);
}
}
diff --git a/src/com/android/services/telephony/TelephonyConnectionServiceProxy.java b/src/com/android/services/telephony/TelephonyConnectionServiceProxy.java
index 604cf03..6c29bd2 100644
--- a/src/com/android/services/telephony/TelephonyConnectionServiceProxy.java
+++ b/src/com/android/services/telephony/TelephonyConnectionServiceProxy.java
@@ -30,16 +30,9 @@
Collection<Connection> getAllConnections();
void addConference(TelephonyConference mTelephonyConference);
void addConference(ImsConference mImsConference);
- void removeConnection(Connection connection);
void addExistingConnection(PhoneAccountHandle phoneAccountHandle,
Connection connection);
void addExistingConnection(PhoneAccountHandle phoneAccountHandle,
Connection connection, Conference conference);
void addConnectionToConferenceController(TelephonyConnection connection);
-
- /**
- * Called when a connection's conference membership changes.
- * @param connection The connection.
- */
- void onConferenceMembershipChanged(Connection connection);
}