From f3c7bf432dc5c21fdecbb44865c037313d21b4cf Mon Sep 17 00:00:00 2001 From: Junda Liu Date: Thu, 16 Apr 2015 17:18:07 -0700 Subject: [PATCH] Add multi-sim support for getCarrierPackageNamesForIntent. resbmit of change Id100b7c4606287a1daa90092cd3c8a5a6519247d Bug: 20268073 Change-Id: I852aac4da492e15f1dd7a3c88693fa14ec07b7c4 --- api/system-current.txt | 1 + .../java/android/telephony/TelephonyManager.java | 12 +++++++++--- .../com/android/internal/telephony/ITelephony.aidl | 9 +++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index f47620374ea54..f4e64612188aa 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -33173,6 +33173,7 @@ package android.telephony { method public java.util.List getAllCellInfo(); method public int getCallState(); method public java.util.List getCarrierPackageNamesForIntent(android.content.Intent); + method public java.util.List getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int); method public java.lang.String getCdmaMdn(); method public java.lang.String getCdmaMdn(int); method public java.lang.String getCdmaMin(); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 128f6e3c1eeab..6eb87b518a4ac 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -3630,14 +3630,20 @@ public class TelephonyManager { /** @hide */ @SystemApi public List getCarrierPackageNamesForIntent(Intent intent) { + return getCarrierPackageNamesForIntentAndPhone(intent, getDefaultPhone()); + } + + /** @hide */ + @SystemApi + public List getCarrierPackageNamesForIntentAndPhone(Intent intent, int phoneId) { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.getCarrierPackageNamesForIntent(intent); + return telephony.getCarrierPackageNamesForIntentAndPhone(intent, phoneId); } catch (RemoteException ex) { - Rlog.e(TAG, "getCarrierPackageNamesForIntent RemoteException", ex); + Rlog.e(TAG, "getCarrierPackageNamesForIntentAndPhone RemoteException", ex); } catch (NullPointerException ex) { - Rlog.e(TAG, "getCarrierPackageNamesForIntent NPE", ex); + Rlog.e(TAG, "getCarrierPackageNamesForIntentAndPhone NPE", ex); } return null; } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index a24859b2820a5..d24dba7b50f1d 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -740,15 +740,16 @@ interface ITelephony { int checkCarrierPrivilegesForPackage(String pkgname); /** - * Returns the package name of the carrier apps that should handle the input intent. + * Returns list of the package names of the carrier apps that should handle the input intent + * and have carrier privileges for the given phoneId. * - * @param packageManager PackageManager for getting receivers. * @param intent Intent that will be sent. - * @return list of carrier app package names that can handle the intent. + * @param phoneId The phoneId on which the carrier app has carrier privileges. + * @return list of carrier app package names that can handle the intent on phoneId. * Returns null if there is an error and an empty list if there * are no matching packages. */ - List getCarrierPackageNamesForIntent(in Intent intent); + List getCarrierPackageNamesForIntentAndPhone(in Intent intent, int phoneId); /** * Set the line 1 phone number string and its alphatag for the current ICCID