Merge "Make getSimCallManager msim aware"

This commit is contained in:
Brad Ebinger
2019-06-04 20:40:42 +00:00
committed by Gerrit Code Review
2 changed files with 37 additions and 10 deletions

View File

@@ -32,6 +32,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.RemoteException; import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
@@ -848,15 +849,18 @@ public class TelecomManager {
/** /**
* Returns the current SIM call manager. Apps must be prepared for this method to return * Returns the current SIM call manager. Apps must be prepared for this method to return
* {@code null}, indicating that there currently exists no user-chosen default * {@code null}, indicating that there currently exists no SIM call manager {@link PhoneAccount}
* {@code PhoneAccount}. * for the default voice subscription.
* *
* @return The phone account handle of the current sim call manager. * @return The phone account handle of the current sim call manager for the default voice
* subscription.
* @see SubscriptionManager#getDefaultVoiceSubscriptionId()
*/ */
public PhoneAccountHandle getSimCallManager() { public PhoneAccountHandle getSimCallManager() {
try { try {
if (isServiceConnected()) { if (isServiceConnected()) {
return getTelecomService().getSimCallManager(); return getTelecomService().getSimCallManager(
SubscriptionManager.getDefaultSubscriptionId());
} }
} catch (RemoteException e) { } catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#getSimCallManager"); Log.e(TAG, "Error calling ITelecomService#getSimCallManager");
@@ -865,9 +869,32 @@ public class TelecomManager {
} }
/** /**
* Returns the current SIM call manager for the specified user. Apps must be prepared for this * Returns current SIM call manager for the Telephony Subscription ID specified. Apps must be
* method to return {@code null}, indicating that there currently exists no user-chosen default * prepared for this method to return {@code null}, indicating that there currently exists no
* {@code PhoneAccount}. * SIM call manager {@link PhoneAccount} for the subscription specified.
*
* @param subscriptionId The Telephony Subscription ID that the SIM call manager should be
* queried for.
* @return The phone account handle of the current sim call manager.
* @see SubscriptionManager#getActiveSubscriptionInfoList()
* @hide
*/
public PhoneAccountHandle getSimCallManagerForSubscription(int subscriptionId) {
try {
if (isServiceConnected()) {
return getTelecomService().getSimCallManager(subscriptionId);
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelecomService#getSimCallManager");
}
return null;
}
/**
* Returns the current SIM call manager for the user-chosen default Telephony Subscription ID
* (see {@link SubscriptionManager#getDefaultSubscriptionId()}) and the specified user. Apps
* must be prepared for this method to return {@code null}, indicating that there currently
* exists no SIM call manager {@link PhoneAccount} for the default voice subscription.
* *
* @return The phone account handle of the current sim call manager. * @return The phone account handle of the current sim call manager.
* *
@@ -888,8 +915,8 @@ public class TelecomManager {
/** /**
* Returns the current connection manager. Apps must be prepared for this method to return * Returns the current connection manager. Apps must be prepared for this method to return
* {@code null}, indicating that there currently exists no user-chosen default * {@code null}, indicating that there currently exists no Connection Manager
* {@code PhoneAccount}. * {@link PhoneAccount} for the default voice subscription.
* *
* @return The phone account handle of the current connection manager. * @return The phone account handle of the current connection manager.
* @hide * @hide

View File

@@ -97,7 +97,7 @@ interface ITelecomService {
/** /**
* @see TelecomServiceImpl#getSimCallManager * @see TelecomServiceImpl#getSimCallManager
*/ */
PhoneAccountHandle getSimCallManager(); PhoneAccountHandle getSimCallManager(int subId);
/** /**
* @see TelecomServiceImpl#getSimCallManagerForUser * @see TelecomServiceImpl#getSimCallManagerForUser