diff options
| author | 2020-01-08 19:06:27 -0800 | |
|---|---|---|
| committer | 2020-01-08 19:06:27 -0800 | |
| commit | f5a037d685a5aac48462273de9b0dff5c45d051a (patch) | |
| tree | 6a2999ebb58f9837e3143d245978c7084ca59b57 | |
| parent | fd67572055d94cbd40439c13e3bdfd44238bea6d (diff) | |
| parent | 0104ce52934df0a2f8a544d7e32f4e73aa1d4f54 (diff) | |
Merge "(Backport) Pipe through featureId from caller to permission checks in telephony code"
am: 0104ce5293
Change-Id: I8eee2a26fd6f397098edd4a673752d087c70edb6
20 files changed, 407 insertions, 224 deletions
diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 1d25bc1db6bc..46b497d064f9 100755 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -161,7 +161,7 @@ public class Build { try { Application application = ActivityThread.currentApplication(); String callingPackage = application != null ? application.getPackageName() : null; - return service.getSerialForPackage(callingPackage); + return service.getSerialForPackage(callingPackage, null); } catch (RemoteException e) { e.rethrowFromSystemServer(); } diff --git a/core/java/android/os/IDeviceIdentifiersPolicyService.aidl b/core/java/android/os/IDeviceIdentifiersPolicyService.aidl index 87d358f50e74..d11aa0c0bac6 100644 --- a/core/java/android/os/IDeviceIdentifiersPolicyService.aidl +++ b/core/java/android/os/IDeviceIdentifiersPolicyService.aidl @@ -21,5 +21,5 @@ package android.os; */ interface IDeviceIdentifiersPolicyService { String getSerial(); - String getSerialForPackage(in String callingPackage); -}
\ No newline at end of file + String getSerialForPackage(in String callingPackage, String callingFeatureId); +} diff --git a/core/java/android/telephony/TelephonyRegistryManager.java b/core/java/android/telephony/TelephonyRegistryManager.java index fc2dfb833a8f..8507e1207393 100644 --- a/core/java/android/telephony/TelephonyRegistryManager.java +++ b/core/java/android/telephony/TelephonyRegistryManager.java @@ -118,7 +118,8 @@ public class TelephonyRegistryManager { }; mSubscriptionChangedListenerMap.put(listener, callback); try { - sRegistry.addOnSubscriptionsChangedListener(mContext.getOpPackageName(), callback); + sRegistry.addOnSubscriptionsChangedListener(mContext.getOpPackageName(), + null, callback); } catch (RemoteException ex) { // system server crash } @@ -177,7 +178,7 @@ public class TelephonyRegistryManager { mOpportunisticSubscriptionChangedListenerMap.put(listener, callback); try { sRegistry.addOnOpportunisticSubscriptionsChangedListener(mContext.getOpPackageName(), - callback); + null, callback); } catch (RemoteException ex) { // system server crash } diff --git a/core/java/com/android/internal/telephony/ITelephonyRegistry.aidl b/core/java/com/android/internal/telephony/ITelephonyRegistry.aidl index b1bc2d9b510a..5228584610b9 100644 --- a/core/java/com/android/internal/telephony/ITelephonyRegistry.aidl +++ b/core/java/com/android/internal/telephony/ITelephonyRegistry.aidl @@ -33,16 +33,22 @@ import com.android.internal.telephony.IPhoneStateListener; import com.android.internal.telephony.IOnSubscriptionsChangedListener; interface ITelephonyRegistry { - void addOnSubscriptionsChangedListener(String pkg, + void addOnSubscriptionsChangedListener(String pkg, String featureId, IOnSubscriptionsChangedListener callback); - void addOnOpportunisticSubscriptionsChangedListener(String pkg, + void addOnOpportunisticSubscriptionsChangedListener(String pkg, String featureId, IOnSubscriptionsChangedListener callback); void removeOnSubscriptionsChangedListener(String pkg, IOnSubscriptionsChangedListener callback); + /** + * @deprecated Use {@link #listenWithFeature(String, String, IPhoneStateListener, int, + * boolean) instead + */ @UnsupportedAppUsage void listen(String pkg, IPhoneStateListener callback, int events, boolean notifyNow); - void listenForSubscriber(in int subId, String pkg, IPhoneStateListener callback, int events, + void listenWithFeature(String pkg, String featureId, IPhoneStateListener callback, int events, boolean notifyNow); + void listenForSubscriber(in int subId, String pkg, String featureId, + IPhoneStateListener callback, int events, boolean notifyNow); @UnsupportedAppUsage void notifyCallStateForAllSubs(int state, String incomingNumber); void notifyCallState(in int phoneId, in int subId, int state, String incomingNumber); diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java index 6a4ef4cd12dd..a788fc87b498 100644 --- a/services/core/java/com/android/server/TelephonyRegistry.java +++ b/services/core/java/com/android/server/TelephonyRegistry.java @@ -23,6 +23,7 @@ import static android.telephony.TelephonyRegistryManager.SIM_ACTIVATION_TYPE_VOI import static java.util.Arrays.copyOf; +import android.annotation.Nullable; import android.app.ActivityManager; import android.app.AppOpsManager; import android.content.BroadcastReceiver; @@ -114,6 +115,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { Context context; String callingPackage; + String callingFeatureId; IBinder binder; @@ -147,7 +149,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { boolean canReadCallLog() { try { return TelephonyPermissions.checkReadCallLog( - context, subId, callerPid, callerUid, callingPackage); + context, subId, callerPid, callerUid, callingPackage, callingFeatureId); } catch (SecurityException e) { return false; } @@ -570,7 +572,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } @Override - public void addOnSubscriptionsChangedListener(String callingPackage, + public void addOnSubscriptionsChangedListener(String callingPackage, String callingFeatureId, IOnSubscriptionsChangedListener callback) { int callerUserId = UserHandle.getCallingUserId(); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); @@ -592,6 +594,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { r.context = mContext; r.onSubscriptionsChangedListenerCallback = callback; r.callingPackage = callingPackage; + r.callingFeatureId = callingFeatureId; r.callerUid = Binder.getCallingUid(); r.callerPid = Binder.getCallingPid(); r.events = 0; @@ -624,7 +627,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { @Override public void addOnOpportunisticSubscriptionsChangedListener(String callingPackage, - IOnSubscriptionsChangedListener callback) { + String callingFeatureId, IOnSubscriptionsChangedListener callback) { int callerUserId = UserHandle.getCallingUserId(); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); if (VDBG) { @@ -645,6 +648,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { r.context = mContext; r.onOpportunisticSubscriptionsChangedListenerCallback = callback; r.callingPackage = callingPackage; + r.callingFeatureId = callingFeatureId; r.callerUid = Binder.getCallingUid(); r.callerPid = Binder.getCallingPid(); r.events = 0; @@ -720,21 +724,28 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } + @Deprecated @Override - public void listen(String pkgForDebug, IPhoneStateListener callback, int events, + public void listen(String callingPackage, IPhoneStateListener callback, int events, boolean notifyNow) { - listenForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, pkgForDebug, callback, - events, notifyNow); + listenWithFeature(callingPackage, null, callback, events, notifyNow); + } + + @Override + public void listenWithFeature(String callingPackage, String callingFeatureId, + IPhoneStateListener callback, int events, boolean notifyNow) { + listenForSubscriber(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID, callingPackage, + callingFeatureId, callback, events, notifyNow); } @Override - public void listenForSubscriber(int subId, String pkgForDebug, IPhoneStateListener callback, - int events, boolean notifyNow) { - listen(pkgForDebug, callback, events, notifyNow, subId); + public void listenForSubscriber(int subId, String callingPackage, String callingFeatureId, + IPhoneStateListener callback, int events, boolean notifyNow) { + listen(callingPackage, callingFeatureId, callback, events, notifyNow, subId); } - private void listen(String callingPackage, IPhoneStateListener callback, int events, - boolean notifyNow, int subId) { + private void listen(String callingPackage, @Nullable String callingFeatureId, + IPhoneStateListener callback, int events, boolean notifyNow, int subId) { int callerUserId = UserHandle.getCallingUserId(); mAppOps.checkPackage(Binder.getCallingUid(), callingPackage); String str = "listen: E pkg=" + callingPackage + " events=0x" + Integer.toHexString(events) @@ -749,7 +760,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { // Checks permission and throws SecurityException for disallowed operations. For pre-M // apps whose runtime permission has been revoked, we return immediately to skip sending // events to the app without crashing it. - if (!checkListenerPermission(events, subId, callingPackage, "listen")) { + if (!checkListenerPermission(events, subId, callingPackage, callingFeatureId, + "listen")) { return; } @@ -766,6 +778,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { r.context = mContext; r.callback = callback; r.callingPackage = callingPackage; + r.callingFeatureId = callingFeatureId; r.callerUid = Binder.getCallingUid(); r.callerPid = Binder.getCallingPid(); // Legacy applications pass SubscriptionManager.DEFAULT_SUB_ID, @@ -2286,8 +2299,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { == PackageManager.PERMISSION_GRANTED; } - private boolean checkListenerPermission( - int events, int subId, String callingPackage, String message) { + private boolean checkListenerPermission(int events, int subId, String callingPackage, + @Nullable String callingFeatureId, String message) { LocationAccessPolicy.LocationPermissionQuery.Builder locationQueryBuilder = new LocationAccessPolicy.LocationPermissionQuery.Builder() .setCallingPackage(callingPackage) @@ -2322,7 +2335,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { if ((events & ENFORCE_PHONE_STATE_PERMISSION_MASK) != 0) { if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState( - mContext, subId, callingPackage, message)) { + mContext, subId, callingPackage, callingFeatureId, message)) { return false; } } diff --git a/services/core/java/com/android/server/os/DeviceIdentifiersPolicyService.java b/services/core/java/com/android/server/os/DeviceIdentifiersPolicyService.java index 9c1ac346ce32..947405ed2a78 100644 --- a/services/core/java/com/android/server/os/DeviceIdentifiersPolicyService.java +++ b/services/core/java/com/android/server/os/DeviceIdentifiersPolicyService.java @@ -56,16 +56,17 @@ public final class DeviceIdentifiersPolicyService extends SystemService { // for any device / profile owner checks. The majority of requests for the serial number // should use the getSerialForPackage method with the calling package specified. if (!TelephonyPermissions.checkCallingOrSelfReadDeviceIdentifiers(mContext, - /* callingPackage */ null, "getSerial")) { + /* callingPackage */ null, null, "getSerial")) { return Build.UNKNOWN; } return SystemProperties.get("ro.serialno", Build.UNKNOWN); } @Override - public @Nullable String getSerialForPackage(String callingPackage) throws RemoteException { + public @Nullable String getSerialForPackage(String callingPackage, + String callingFeatureId) throws RemoteException { if (!TelephonyPermissions.checkCallingOrSelfReadDeviceIdentifiers(mContext, - callingPackage, "getSerial")) { + callingPackage, callingFeatureId, "getSerial")) { return Build.UNKNOWN; } return SystemProperties.get("ro.serialno", Build.UNKNOWN); diff --git a/telephony/common/android/telephony/LocationAccessPolicy.java b/telephony/common/android/telephony/LocationAccessPolicy.java index 825ce2fc1a00..8ac675502527 100644 --- a/telephony/common/android/telephony/LocationAccessPolicy.java +++ b/telephony/common/android/telephony/LocationAccessPolicy.java @@ -18,6 +18,7 @@ package android.telephony; import android.Manifest; import android.annotation.NonNull; +import android.annotation.Nullable; import android.annotation.UserIdInt; import android.app.ActivityManager; import android.app.AppOpsManager; @@ -62,6 +63,7 @@ public final class LocationAccessPolicy { /** Data structure for location permission query */ public static class LocationPermissionQuery { public final String callingPackage; + public final String callingFeatureId; public final int callingUid; public final int callingPid; public final int minSdkVersionForCoarse; @@ -69,10 +71,11 @@ public final class LocationAccessPolicy { public final boolean logAsInfo; public final String method; - private LocationPermissionQuery(String callingPackage, int callingUid, int callingPid, - int minSdkVersionForCoarse, int minSdkVersionForFine, boolean logAsInfo, - String method) { + private LocationPermissionQuery(String callingPackage, @Nullable String callingFeatureId, + int callingUid, int callingPid, int minSdkVersionForCoarse, + int minSdkVersionForFine, boolean logAsInfo, String method) { this.callingPackage = callingPackage; + this.callingFeatureId = callingFeatureId; this.callingUid = callingUid; this.callingPid = callingPid; this.minSdkVersionForCoarse = minSdkVersionForCoarse; @@ -84,6 +87,7 @@ public final class LocationAccessPolicy { /** Builder for LocationPermissionQuery */ public static class Builder { private String mCallingPackage; + private String mCallingFeatureId; private int mCallingUid; private int mCallingPid; private int mMinSdkVersionForCoarse = Integer.MAX_VALUE; @@ -102,6 +106,11 @@ public final class LocationAccessPolicy { /** * Mandatory parameter, used for performing permission checks. */ + public Builder setCallingFeatureId(@Nullable String callingFeatureId) { + mCallingFeatureId = callingFeatureId; + return this; + } + public Builder setCallingUid(int callingUid) { mCallingUid = callingUid; return this; @@ -153,8 +162,8 @@ public final class LocationAccessPolicy { /** build LocationPermissionQuery */ public LocationPermissionQuery build() { - return new LocationPermissionQuery(mCallingPackage, mCallingUid, - mCallingPid, mMinSdkVersionForCoarse, mMinSdkVersionForFine, + return new LocationPermissionQuery(mCallingPackage, mCallingFeatureId, + mCallingUid, mCallingPid, mMinSdkVersionForCoarse, mMinSdkVersionForFine, mLogAsInfo, mMethod); } } diff --git a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java index 606fd5b89791..f5dffbc68996 100644 --- a/telephony/common/com/android/internal/telephony/TelephonyPermissions.java +++ b/telephony/common/com/android/internal/telephony/TelephonyPermissions.java @@ -18,6 +18,7 @@ package com.android.internal.telephony; import static android.content.pm.PackageManager.PERMISSION_GRANTED; import android.Manifest; +import android.annotation.Nullable; import android.app.AppOpsManager; import android.app.admin.DevicePolicyManager; import android.content.Context; @@ -95,16 +96,19 @@ public final class TelephonyPermissions { * inaccesible to carrier-privileged apps). */ public static boolean checkCallingOrSelfReadPhoneState( - Context context, int subId, String callingPackage, String message) { + Context context, int subId, String callingPackage, @Nullable String callingFeatureId, + String message) { return checkReadPhoneState(context, subId, Binder.getCallingPid(), Binder.getCallingUid(), - callingPackage, message); + callingPackage, callingFeatureId, message); } /** Identical to checkCallingOrSelfReadPhoneState but never throws SecurityException */ public static boolean checkCallingOrSelfReadPhoneStateNoThrow( - Context context, int subId, String callingPackage, String message) { + Context context, int subId, String callingPackage, @Nullable String callingFeatureId, + String message) { try { - return checkCallingOrSelfReadPhoneState(context, subId, callingPackage, message); + return checkCallingOrSelfReadPhoneState(context, subId, callingPackage, + callingFeatureId, message); } catch (SecurityException se) { return false; } @@ -132,9 +136,11 @@ public final class TelephonyPermissions { * devices. */ public static boolean checkReadPhoneState( - Context context, int subId, int pid, int uid, String callingPackage, String message) { + Context context, int subId, int pid, int uid, String callingPackage, + @Nullable String callingFeatureId, String message) { return checkReadPhoneState( - context, TELEPHONY_SUPPLIER, subId, pid, uid, callingPackage, message); + context, TELEPHONY_SUPPLIER, subId, pid, uid, callingPackage, callingFeatureId, + message); } /** @@ -174,7 +180,7 @@ public final class TelephonyPermissions { @VisibleForTesting public static boolean checkReadPhoneState( Context context, Supplier<ITelephony> telephonySupplier, int subId, int pid, int uid, - String callingPackage, String message) { + String callingPackage, @Nullable String callingFeatureId, String message) { try { context.enforcePermission( android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, pid, uid, message); @@ -217,10 +223,10 @@ public final class TelephonyPermissions { * @return {@code true} if the app can read phone state or has carrier privilege; * {@code false} otherwise. */ - public static boolean checkReadPhoneStateOnAnyActiveSub( - Context context, int pid, int uid, String callingPackage, String message) { + public static boolean checkReadPhoneStateOnAnyActiveSub(Context context, int pid, int uid, + String callingPackage, @Nullable String callingFeatureId, String message) { return checkReadPhoneStateOnAnyActiveSub(context, TELEPHONY_SUPPLIER, pid, uid, - callingPackage, message); + callingPackage, callingFeatureId, message); } /** @@ -240,7 +246,7 @@ public final class TelephonyPermissions { @VisibleForTesting public static boolean checkReadPhoneStateOnAnyActiveSub( Context context, Supplier<ITelephony> telephonySupplier, int pid, int uid, - String callingPackage, String message) { + String callingPackage, @Nullable String callingFeatureId, String message) { try { context.enforcePermission( android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, pid, uid, message); @@ -283,9 +289,10 @@ public final class TelephonyPermissions { * </ul> */ public static boolean checkCallingOrSelfReadDeviceIdentifiers(Context context, - String callingPackage, String message) { + String callingPackage, @Nullable String callingFeatureId, String message) { return checkCallingOrSelfReadDeviceIdentifiers(context, - SubscriptionManager.INVALID_SUBSCRIPTION_ID, callingPackage, message); + SubscriptionManager.INVALID_SUBSCRIPTION_ID, callingPackage, callingFeatureId, + message); } /** @@ -306,9 +313,9 @@ public final class TelephonyPermissions { * </ul> */ public static boolean checkCallingOrSelfReadDeviceIdentifiers(Context context, int subId, - String callingPackage, String message) { + String callingPackage, @Nullable String callingFeatureId, String message) { return checkPrivilegedReadPermissionOrCarrierPrivilegePermission( - context, subId, callingPackage, message, true); + context, subId, callingPackage, callingFeatureId, message, true); } /** @@ -328,9 +335,9 @@ public final class TelephonyPermissions { * </ul> */ public static boolean checkCallingOrSelfReadSubscriberIdentifiers(Context context, int subId, - String callingPackage, String message) { + String callingPackage, @Nullable String callingFeatureId, String message) { return checkPrivilegedReadPermissionOrCarrierPrivilegePermission( - context, subId, callingPackage, message, false); + context, subId, callingPackage, callingFeatureId, message, false); } /** @@ -352,8 +359,8 @@ public final class TelephonyPermissions { * </ul> */ private static boolean checkPrivilegedReadPermissionOrCarrierPrivilegePermission( - Context context, int subId, String callingPackage, String message, - boolean allowCarrierPrivilegeOnAnySub) { + Context context, int subId, String callingPackage, @Nullable String callingFeatureId, + String message, boolean allowCarrierPrivilegeOnAnySub) { int uid = Binder.getCallingUid(); int pid = Binder.getCallingPid(); // Allow system and root access to the device identifiers. @@ -479,9 +486,10 @@ public final class TelephonyPermissions { * to it, {@code false} otherwise. */ public static boolean checkReadCallLog( - Context context, int subId, int pid, int uid, String callingPackage) { + Context context, int subId, int pid, int uid, String callingPackage, + @Nullable String callingPackageName) { return checkReadCallLog( - context, TELEPHONY_SUPPLIER, subId, pid, uid, callingPackage); + context, TELEPHONY_SUPPLIER, subId, pid, uid, callingPackage, callingPackageName); } /** @@ -492,7 +500,7 @@ public final class TelephonyPermissions { @VisibleForTesting public static boolean checkReadCallLog( Context context, Supplier<ITelephony> telephonySupplier, int subId, int pid, int uid, - String callingPackage) { + String callingPackage, @Nullable String callingFeatureId) { if (context.checkPermission(Manifest.permission.READ_CALL_LOG, pid, uid) != PERMISSION_GRANTED) { @@ -519,10 +527,11 @@ public final class TelephonyPermissions { * default SMS app and apps with READ_SMS or READ_PHONE_NUMBERS can also read phone numbers. */ public static boolean checkCallingOrSelfReadPhoneNumber( - Context context, int subId, String callingPackage, String message) { + Context context, int subId, String callingPackage, @Nullable String callingFeatureId, + String message) { return checkReadPhoneNumber( context, TELEPHONY_SUPPLIER, subId, Binder.getCallingPid(), Binder.getCallingUid(), - callingPackage, message); + callingPackage, callingFeatureId, message); } /** @@ -534,7 +543,7 @@ public final class TelephonyPermissions { @VisibleForTesting public static boolean checkReadPhoneNumber( Context context, Supplier<ITelephony> telephonySupplier, int subId, int pid, int uid, - String callingPackage, String message) { + String callingPackage, @Nullable String callingFeatureId, String message) { // Default SMS app can always read it. AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); if (appOps.noteOp(AppOpsManager.OPSTR_WRITE_SMS, uid, callingPackage) == @@ -548,7 +557,8 @@ public final class TelephonyPermissions { // First, check if we can read the phone state. try { return checkReadPhoneState( - context, telephonySupplier, subId, pid, uid, callingPackage, message); + context, telephonySupplier, subId, pid, uid, callingPackage, callingFeatureId, + message); } catch (SecurityException readPhoneStateSecurityException) { } // Can be read with READ_SMS too. diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 57a80183c4c2..236a209e6f58 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -3896,7 +3896,8 @@ public class CarrierConfigManager { + " ICarrierConfigLoader is null"); return null; } - return loader.getConfigForSubId(subId, mContext.getOpPackageName()); + return loader.getConfigForSubIdWithFeature(subId, mContext.getOpPackageName(), + null); } catch (RemoteException ex) { Rlog.e(TAG, "Error getting config for subId " + subId + ": " + ex.toString()); diff --git a/telephony/java/android/telephony/SmsManager.java b/telephony/java/android/telephony/SmsManager.java index 34966865089b..19571706e230 100644 --- a/telephony/java/android/telephony/SmsManager.java +++ b/telephony/java/android/telephony/SmsManager.java @@ -2684,7 +2684,7 @@ public final class SmsManager { ISms iccISms = getISmsServiceOrThrow(); if (iccISms != null) { return iccISms.checkSmsShortCodeDestination(getSubscriptionId(), - ActivityThread.currentPackageName(), destAddress, countryIso); + ActivityThread.currentPackageName(), null, destAddress, countryIso); } } catch (RemoteException e) { Log.e(TAG, "checkSmsShortCodeDestination() RemoteException", e); diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 15c1807cd532..08d7d8dd13d7 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -1186,7 +1186,8 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - subInfo = iSub.getActiveSubscriptionInfo(subId, mContext.getOpPackageName()); + subInfo = iSub.getActiveSubscriptionInfo(subId, mContext.getOpPackageName(), + null); } } catch (RemoteException ex) { // ignore it @@ -1219,7 +1220,8 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getActiveSubscriptionInfoForIccId(iccId, mContext.getOpPackageName()); + result = iSub.getActiveSubscriptionInfoForIccId(iccId, mContext.getOpPackageName(), + null); } } catch (RemoteException ex) { // ignore it @@ -1253,7 +1255,7 @@ public class SubscriptionManager { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { result = iSub.getActiveSubscriptionInfoForSimSlotIndex(slotIndex, - mContext.getOpPackageName()); + mContext.getOpPackageName(), null); } } catch (RemoteException ex) { // ignore it @@ -1276,7 +1278,8 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getAllSubInfoList(mContext.getOpPackageName()); + result = iSub.getAllSubInfoList(mContext.getOpPackageName(), + null); } } catch (RemoteException ex) { // ignore it @@ -1351,7 +1354,8 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - activeList = iSub.getActiveSubscriptionInfoList(mContext.getOpPackageName()); + activeList = iSub.getActiveSubscriptionInfoList(mContext.getOpPackageName(), + null); } } catch (RemoteException ex) { // ignore it @@ -1401,7 +1405,8 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getAvailableSubscriptionInfoList(mContext.getOpPackageName()); + result = iSub.getAvailableSubscriptionInfoList(mContext.getOpPackageName(), + null); } } catch (RemoteException ex) { // ignore it @@ -1518,7 +1523,8 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getAllSubInfoCount(mContext.getOpPackageName()); + result = iSub.getAllSubInfoCount(mContext.getOpPackageName(), + null); } } catch (RemoteException ex) { // ignore it @@ -1546,7 +1552,8 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getActiveSubInfoCount(mContext.getOpPackageName()); + result = iSub.getActiveSubInfoCount(mContext.getOpPackageName(), + null); } } catch (RemoteException ex) { // ignore it @@ -2283,7 +2290,7 @@ public class SubscriptionManager { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { resultValue = iSub.getSubscriptionProperty(subId, propKey, - context.getOpPackageName()); + context.getOpPackageName(), null); } } catch (RemoteException ex) { // ignore it @@ -2424,7 +2431,8 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - return iSub.isActiveSubId(subId, mContext.getOpPackageName()); + return iSub.isActiveSubId(subId, mContext.getOpPackageName(), + null); } } catch (RemoteException ex) { } @@ -2791,13 +2799,14 @@ public class SubscriptionManager { @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public @NonNull List<SubscriptionInfo> getOpportunisticSubscriptions() { - String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>"; + String contextPkg = mContext != null ? mContext.getOpPackageName() : "<unknown>"; + String contextFeature = null; List<SubscriptionInfo> subInfoList = null; try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - subInfoList = iSub.getOpportunisticSubscriptions(pkgForDebug); + subInfoList = iSub.getOpportunisticSubscriptions(contextPkg, contextFeature); } } catch (RemoteException ex) { // ignore it @@ -3035,7 +3044,8 @@ public class SubscriptionManager { @RequiresPermission(Manifest.permission.READ_PHONE_STATE) public @NonNull List<SubscriptionInfo> getSubscriptionsInGroup(@NonNull ParcelUuid groupUuid) { Preconditions.checkNotNull(groupUuid, "groupUuid can't be null"); - String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>"; + String contextPkg = mContext != null ? mContext.getOpPackageName() : "<unknown>"; + String contextFeature = null; if (VDBG) { logd("[getSubscriptionsInGroup]+ groupUuid:" + groupUuid); } @@ -3044,7 +3054,7 @@ public class SubscriptionManager { try { ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub")); if (iSub != null) { - result = iSub.getSubscriptionsInGroup(groupUuid, pkgForDebug); + result = iSub.getSubscriptionsInGroup(groupUuid, contextPkg, contextFeature); } else { if (!isSystemProcess()) { throw new IllegalStateException("telephony service is null."); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index b8ce32f79c34..e3f2787f1c8c 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -379,6 +379,10 @@ public class TelephonyManager { return ActivityThread.currentOpPackageName(); } + private String getFeatureId() { + return null; + } + private boolean isSystemProcess() { return Process.myUid() == Process.SYSTEM_UID; } @@ -1487,7 +1491,8 @@ public class TelephonyManager { if (telephony == null) return null; try { - return telephony.getDeviceSoftwareVersionForSlot(slotIndex, getOpPackageName()); + return telephony.getDeviceSoftwareVersionForSlot(slotIndex, getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1528,7 +1533,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return null; - return telephony.getDeviceId(mContext.getOpPackageName()); + return telephony.getDeviceIdWithFeature(mContext.getOpPackageName(), + null); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1572,7 +1578,8 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getDeviceIdForPhone(slotIndex, mContext.getOpPackageName()); + return info.getDeviceIdForPhone(slotIndex, mContext.getOpPackageName(), + null); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1630,7 +1637,7 @@ public class TelephonyManager { if (telephony == null) return null; try { - return telephony.getImeiForSlot(slotIndex, getOpPackageName()); + return telephony.getImeiForSlot(slotIndex, getOpPackageName(), getFeatureId()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -1724,7 +1731,7 @@ public class TelephonyManager { if (telephony == null) return null; try { - String meid = telephony.getMeidForSlot(slotIndex, getOpPackageName()); + String meid = telephony.getMeidForSlot(slotIndex, getOpPackageName(), getFeatureId()); if (TextUtils.isEmpty(meid)) { Log.d(TAG, "getMeid: return null because MEID is not available"); return null; @@ -1825,7 +1832,8 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - String nai = info.getNaiForSubscriber(subId, mContext.getOpPackageName()); + String nai = info.getNaiForSubscriber(subId, mContext.getOpPackageName(), + null); if (Log.isLoggable(TAG, Log.VERBOSE)) { Rlog.v(TAG, "Nai = " + nai); } @@ -1858,7 +1866,7 @@ public class TelephonyManager { return null; } - Bundle bundle = telephony.getCellLocation(mContext.getOpPackageName()); + Bundle bundle = telephony.getCellLocation(mContext.getOpPackageName(), null); if (bundle == null || bundle.isEmpty()) { Rlog.d(TAG, "getCellLocation returning null because CellLocation is unavailable"); return null; @@ -1946,7 +1954,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return null; - return telephony.getNeighboringCellInfo(mContext.getOpPackageName()); + return telephony.getNeighboringCellInfo(mContext.getOpPackageName(), + null); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -2374,7 +2383,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return ""; return telephony.getNetworkCountryIsoForPhone(getPhoneId(), - null /* no permission check */); + null /* no permission check */, null); } catch (RemoteException ex) { return ""; } @@ -2414,7 +2423,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return ""; - return telephony.getNetworkCountryIsoForPhone(slotIndex, getOpPackageName()); + return telephony.getNetworkCountryIsoForPhone(slotIndex, getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { return ""; } @@ -2546,7 +2556,8 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.getNetworkTypeForSubscriber(subId, getOpPackageName()); + return telephony.getNetworkTypeForSubscriber(subId, getOpPackageName(), + getFeatureId()); } else { // This can happen when the ITelephony interface is not up yet. return NETWORK_TYPE_UNKNOWN; @@ -2610,7 +2621,8 @@ public class TelephonyManager { try{ ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.getDataNetworkTypeForSubscriber(subId, getOpPackageName()); + return telephony.getDataNetworkTypeForSubscriber(subId, getOpPackageName(), + getFeatureId()); } else { // This can happen when the ITelephony interface is not up yet. return NETWORK_TYPE_UNKNOWN; @@ -2646,7 +2658,8 @@ public class TelephonyManager { try{ ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.getVoiceNetworkTypeForSubscriber(subId, getOpPackageName()); + return telephony.getVoiceNetworkTypeForSubscriber(subId, getOpPackageName(), + getFeatureId()); } else { // This can happen when the ITelephony interface is not up yet. return NETWORK_TYPE_UNKNOWN; @@ -3440,7 +3453,8 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getIccSerialNumberForSubscriber(subId, mContext.getOpPackageName()); + return info.getIccSerialNumberForSubscriber(subId, mContext.getOpPackageName(), + null); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -3484,7 +3498,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return PhoneConstants.LTE_ON_CDMA_UNKNOWN; - return telephony.getLteOnCdmaModeForSubscriber(subId, getOpPackageName()); + return telephony.getLteOnCdmaModeForSubscriber(subId, getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { // Assume no ICC card if remote exception which shouldn't happen return PhoneConstants.LTE_ON_CDMA_UNKNOWN; @@ -3712,7 +3727,8 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getSubscriberIdForSubscriber(subId, mContext.getOpPackageName()); + return info.getSubscriberIdForSubscriber(subId, mContext.getOpPackageName(), + null); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -3879,7 +3895,8 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getGroupIdLevel1ForSubscriber(getSubId(), mContext.getOpPackageName()); + return info.getGroupIdLevel1ForSubscriber(getSubId(), mContext.getOpPackageName(), + null); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -3902,7 +3919,8 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getGroupIdLevel1ForSubscriber(subId, mContext.getOpPackageName()); + return info.getGroupIdLevel1ForSubscriber(subId, mContext.getOpPackageName(), + null); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -3952,7 +3970,8 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - number = telephony.getLine1NumberForDisplay(subId, mContext.getOpPackageName()); + number = telephony.getLine1NumberForDisplay(subId, mContext.getOpPackageName(), + null); } catch (RemoteException ex) { } catch (NullPointerException ex) { } @@ -3963,7 +3982,8 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getLine1NumberForSubscriber(subId, mContext.getOpPackageName()); + return info.getLine1NumberForSubscriber(subId, mContext.getOpPackageName(), + null); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -4042,7 +4062,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony != null) alphaTag = telephony.getLine1AlphaTagForDisplay(subId, - getOpPackageName()); + getOpPackageName(), getFeatureId()); } catch (RemoteException ex) { } catch (NullPointerException ex) { } @@ -4053,7 +4073,8 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getLine1AlphaTagForSubscriber(subId, getOpPackageName()); + return info.getLine1AlphaTagForSubscriber(subId, getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -4082,7 +4103,8 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.getMergedSubscriberIds(getSubId(), getOpPackageName()); + return telephony.getMergedSubscriberIds(getSubId(), getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { } catch (NullPointerException ex) { } @@ -4137,7 +4159,7 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getMsisdnForSubscriber(subId, getOpPackageName()); + return info.getMsisdnForSubscriber(subId, getOpPackageName(), getFeatureId()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -4171,7 +4193,8 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getVoiceMailNumberForSubscriber(subId, getOpPackageName()); + return info.getVoiceMailNumberForSubscriber(subId, getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -4295,8 +4318,8 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony - .getVisualVoicemailPackageName(mContext.getOpPackageName(), getSubId()); + return telephony.getVisualVoicemailPackageName(mContext.getOpPackageName(), + getFeatureId(), getSubId()); } } catch (RemoteException ex) { } catch (NullPointerException ex) { @@ -4732,7 +4755,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return 0; - return telephony.getVoiceMessageCountForSubscriber(subId, getOpPackageName()); + return telephony.getVoiceMessageCountForSubscriber(subId, getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { return 0; } catch (NullPointerException ex) { @@ -4768,7 +4792,8 @@ public class TelephonyManager { IPhoneSubInfo info = getSubscriberInfo(); if (info == null) return null; - return info.getVoiceMailAlphaTagForSubscriber(subId, getOpPackageName()); + return info.getVoiceMailAlphaTagForSubscriber(subId, getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -5164,7 +5189,7 @@ public class TelephonyManager { } else if (listener.mSubId != null) { subId = listener.mSubId; } - registry.listenForSubscriber(subId, getOpPackageName(), + registry.listenForSubscriber(subId, getOpPackageName(), getFeatureId(), listener.callback, events, notifyNow); } else { Rlog.w(TAG, "telephony registry not ready."); @@ -5194,7 +5219,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return -1; - return telephony.getCdmaEriIconIndexForSubscriber(subId, getOpPackageName()); + return telephony.getCdmaEriIconIndexForSubscriber(subId, getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { // the phone process is restarting. return -1; @@ -5229,7 +5255,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return -1; - return telephony.getCdmaEriIconModeForSubscriber(subId, getOpPackageName()); + return telephony.getCdmaEriIconModeForSubscriber(subId, getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { // the phone process is restarting. return -1; @@ -5260,7 +5287,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return null; - return telephony.getCdmaEriTextForSubscriber(subId, getOpPackageName()); + return telephony.getCdmaEriTextForSubscriber(subId, getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { // the phone process is restarting. return null; @@ -5352,8 +5380,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return null; - return telephony.getAllCellInfo( - getOpPackageName()); + return telephony.getAllCellInfo(getOpPackageName(), getFeatureId()); } catch (RemoteException ex) { } catch (NullPointerException ex) { } @@ -5453,7 +5480,7 @@ public class TelephonyManager { Binder.restoreCallingIdentity(identity); } } - }, getOpPackageName()); + }, getOpPackageName(), getFeatureId()); } catch (RemoteException ex) { } } @@ -5504,7 +5531,7 @@ public class TelephonyManager { Binder.restoreCallingIdentity(identity); } } - }, getOpPackageName(), workSource); + }, getOpPackageName(), getFeatureId(), workSource); } catch (RemoteException ex) { } } @@ -6720,7 +6747,8 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return null; - return telephony.getForbiddenPlmns(subId, appType, mContext.getOpPackageName()); + return telephony.getForbiddenPlmns(subId, appType, mContext.getOpPackageName(), + getFeatureId()); } catch (RemoteException ex) { return null; } catch (NullPointerException ex) { @@ -6754,7 +6782,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return -1; return telephony.setForbiddenPlmns( - getSubId(), APPTYPE_USIM, fplmns, getOpPackageName()); + getSubId(), APPTYPE_USIM, fplmns, getOpPackageName(), getFeatureId()); } catch (RemoteException ex) { Rlog.e(TAG, "setForbiddenPlmns RemoteException: " + ex.getMessage()); } catch (NullPointerException ex) { @@ -6775,7 +6803,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony == null) return new String[0]; - return telephony.getPcscfAddress(apnType, getOpPackageName()); + return telephony.getPcscfAddress(apnType, getOpPackageName(), getFeatureId()); } catch (RemoteException e) { return new String[0]; } @@ -7286,7 +7314,8 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.getCellNetworkScanResults(getSubId(), getOpPackageName()); + return telephony.getCellNetworkScanResults(getSubId(), getOpPackageName(), + getFeatureId()); } } catch (RemoteException ex) { Rlog.e(TAG, "getAvailableNetworks RemoteException", ex); @@ -7341,7 +7370,7 @@ public class TelephonyManager { } } return mTelephonyScanManager.requestNetworkScan(getSubId(), request, executor, callback, - getOpPackageName()); + getOpPackageName(), getFeatureId()); } /** @@ -8013,7 +8042,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.isRadioOn(getOpPackageName()); + return telephony.isRadioOnWithFeature(getOpPackageName(), getFeatureId()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isRadioOn", e); } @@ -8326,7 +8355,8 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.getRadioPowerState(getSlotIndex(), mContext.getOpPackageName()); + return telephony.getRadioPowerState(getSlotIndex(), mContext.getOpPackageName(), + null); } } catch (RemoteException ex) { // This could happen if binder process crashes. @@ -8684,7 +8714,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) - return telephony.isVideoCallingEnabled(getOpPackageName()); + return telephony.isVideoCallingEnabled(getOpPackageName(), getFeatureId()); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isVideoCallingEnabled", e); } @@ -8700,7 +8730,8 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.canChangeDtmfToneLength(mSubId, getOpPackageName()); + return telephony.canChangeDtmfToneLength(mSubId, getOpPackageName(), + getFeatureId()); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#canChangeDtmfToneLength", e); @@ -8719,7 +8750,7 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.isWorldPhone(mSubId, getOpPackageName()); + return telephony.isWorldPhone(mSubId, getOpPackageName(), getFeatureId()); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#isWorldPhone", e); @@ -9445,7 +9476,7 @@ public class TelephonyManager { ITelephony service = getITelephony(); if (service != null) { retval = service.getSubIdForPhoneAccountHandle( - phoneAccountHandle, mContext.getOpPackageName()); + phoneAccountHandle, mContext.getOpPackageName(), null); } } catch (RemoteException ex) { Log.e(TAG, "getSubscriptionId RemoteException", ex); @@ -9583,7 +9614,8 @@ public class TelephonyManager { try { ITelephony service = getITelephony(); if (service != null) { - return service.getServiceStateForSubscriber(subId, getOpPackageName()); + return service.getServiceStateForSubscriber(subId, getOpPackageName(), + getFeatureId()); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#getServiceStateForSubscriber", e); @@ -10323,7 +10355,7 @@ public class TelephonyManager { try { ITelephony service = getITelephony(); if (service != null) { - return service.getClientRequestStats(getOpPackageName(), subId); + return service.getClientRequestStats(getOpPackageName(), getFeatureId(), subId); } } catch (RemoteException e) { Log.e(TAG, "Error calling ITelephony#getClientRequestStats", e); @@ -10612,7 +10644,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony != null) { return telephony.getNumberOfModemsWithSimultaneousDataConnections( - getSubId(), getOpPackageName()); + getSubId(), getOpPackageName(), getFeatureId()); } } catch (RemoteException ex) { // This could happen if binder process crashes. @@ -10968,7 +11000,8 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.getEmergencyNumberList(mContext.getOpPackageName()); + return telephony.getEmergencyNumberList(mContext.getOpPackageName(), + null); } else { throw new IllegalStateException("telephony service is null."); } @@ -11023,7 +11056,7 @@ public class TelephonyManager { ITelephony telephony = getITelephony(); if (telephony != null) { emergencyNumberList = telephony.getEmergencyNumberList( - mContext.getOpPackageName()); + mContext.getOpPackageName(), null); if (emergencyNumberList != null) { for (Integer subscriptionId : emergencyNumberList.keySet()) { List<EmergencyNumber> numberList = emergencyNumberList.get(subscriptionId); @@ -11329,12 +11362,14 @@ public class TelephonyManager { android.Manifest.permission.READ_PHONE_STATE }) public int getPreferredOpportunisticDataSubscription() { - String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>"; + String packageName = mContext != null ? mContext.getOpPackageName() : "<unknown>"; + String featureId = null; int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID; try { IOns iOpportunisticNetworkService = getIOns(); if (iOpportunisticNetworkService != null) { - subId = iOpportunisticNetworkService.getPreferredDataSubscriptionId(pkgForDebug); + subId = iOpportunisticNetworkService.getPreferredDataSubscriptionId( + packageName, featureId); } } catch (RemoteException ex) { Rlog.e(TAG, "getPreferredDataSubscriptionId RemoteException", ex); @@ -11461,7 +11496,8 @@ public class TelephonyManager { try { ITelephony telephony = getITelephony(); if (telephony != null) { - return telephony.isModemEnabledForSlot(slotIndex, mContext.getOpPackageName()); + return telephony.isModemEnabledForSlot(slotIndex, mContext.getOpPackageName(), + null); } } catch (RemoteException ex) { Log.e(TAG, "enableModem RemoteException", ex); @@ -11566,7 +11602,7 @@ public class TelephonyManager { try { ITelephony service = getITelephony(); if (service != null) { - return service.isMultiSimSupported(getOpPackageName()); + return service.isMultiSimSupported(getOpPackageName(), getFeatureId()); } } catch (RemoteException e) { Log.e(TAG, "isMultiSimSupported RemoteException", e); @@ -11618,7 +11654,7 @@ public class TelephonyManager { ITelephony service = getITelephony(); if (service != null) { return service.doesSwitchMultiSimConfigTriggerReboot(getSubId(), - getOpPackageName()); + getOpPackageName(), getFeatureId()); } } catch (RemoteException e) { Log.e(TAG, "doesSwitchMultiSimConfigTriggerReboot RemoteException", e); diff --git a/telephony/java/android/telephony/TelephonyScanManager.java b/telephony/java/android/telephony/TelephonyScanManager.java index 9ff851598648..6a473a728ce6 100644 --- a/telephony/java/android/telephony/TelephonyScanManager.java +++ b/telephony/java/android/telephony/TelephonyScanManager.java @@ -200,13 +200,14 @@ public final class TelephonyScanManager { */ public NetworkScan requestNetworkScan(int subId, NetworkScanRequest request, Executor executor, NetworkScanCallback callback, - String callingPackage) { + String callingPackage, String callingFeatureId) { try { ITelephony telephony = getITelephony(); if (telephony != null) { synchronized (mScanInfo) { int scanId = telephony.requestNetworkScan( - subId, request, mMessenger, new Binder(), callingPackage); + subId, request, mMessenger, new Binder(), callingPackage, + callingFeatureId); if (scanId == INVALID_SCAN_ID) { Rlog.e(TAG, "Failed to initiate network scan"); return null; diff --git a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl index 4e79660df479..76ebc0f3ac2f 100644 --- a/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl +++ b/telephony/java/com/android/internal/telephony/ICarrierConfigLoader.aidl @@ -23,9 +23,13 @@ import android.os.PersistableBundle; */ interface ICarrierConfigLoader { + /** @deprecated Use {@link #getConfigForSubIdWithFeature(int, String, String) instead */ @UnsupportedAppUsage PersistableBundle getConfigForSubId(int subId, String callingPackage); + PersistableBundle getConfigForSubIdWithFeature(int subId, String callingPackage, + String callingFeatureId); + void overrideConfig(int subId, in PersistableBundle overrides, boolean persistent); void notifyConfigChangedForSubId(int subId); diff --git a/telephony/java/com/android/internal/telephony/IOns.aidl b/telephony/java/com/android/internal/telephony/IOns.aidl index 2c48b6512421..76b6951f213d 100755 --- a/telephony/java/com/android/internal/telephony/IOns.aidl +++ b/telephony/java/com/android/internal/telephony/IOns.aidl @@ -83,7 +83,7 @@ interface IOns { * subscription id * */ - int getPreferredDataSubscriptionId(String callingPackage); + int getPreferredDataSubscriptionId(String callingPackage, String callingFeatureId); /** * Update availability of a list of networks in the current location. diff --git a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl index 5b509b7260ba..28ef235bf398 100644 --- a/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl +++ b/telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl @@ -24,113 +24,128 @@ import android.telephony.ImsiEncryptionInfo; */ interface IPhoneSubInfo { + /** @deprecated Use {@link #getDeviceIdWithFeature(String, String) instead */ + @UnsupportedAppUsage + String getDeviceId(String callingPackage); + /** * Retrieves the unique device ID, e.g., IMEI for GSM phones. */ - String getDeviceId(String callingPackage); + String getDeviceIdWithFeature(String callingPackage, String callingFeatureId); /** * Retrieves the unique Network Access ID */ - String getNaiForSubscriber(int subId, String callingPackage); + String getNaiForSubscriber(int subId, String callingPackage, String callingFeatureId); /** * Retrieves the unique device ID of a phone for the device, e.g., IMEI * for GSM phones. */ - String getDeviceIdForPhone(int phoneId, String callingPackage); + String getDeviceIdForPhone(int phoneId, String callingPackage, String callingFeatureId); /** * Retrieves the IMEI. */ - String getImeiForSubscriber(int subId, String callingPackage); + String getImeiForSubscriber(int subId, String callingPackage, String callingFeatureId); /** * Retrieves the software version number for the device, e.g., IMEI/SV * for GSM phones. */ - String getDeviceSvn(String callingPackage); + String getDeviceSvn(String callingPackage, String callingFeatureId); /** * Retrieves the software version number of a subId for the device, e.g., IMEI/SV * for GSM phones. */ - String getDeviceSvnUsingSubId(int subId, String callingPackage); + String getDeviceSvnUsingSubId(int subId, String callingPackage, String callingFeatureId); + + /** @deprecated Use {@link #getSubscriberIdWithFeature(String, String) instead */ + @UnsupportedAppUsage + String getSubscriberId(String callingPackage); /** * Retrieves the unique sbuscriber ID, e.g., IMSI for GSM phones. */ - @UnsupportedAppUsage - String getSubscriberId(String callingPackage); + String getSubscriberIdWithFeature(String callingPackage, String callingComponenId); /** * Retrieves the unique subscriber ID of a given subId, e.g., IMSI for GSM phones. */ - String getSubscriberIdForSubscriber(int subId, String callingPackage); + String getSubscriberIdForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Retrieves the Group Identifier Level1 for GSM phones of a subId. */ - String getGroupIdLevel1ForSubscriber(int subId, String callingPackage); + String getGroupIdLevel1ForSubscriber(int subId, String callingPackage, + String callingFeatureId); + + /** @deprecared Use {@link getIccSerialNumberWithFeature(String, String)} instead */ + @UnsupportedAppUsage + String getIccSerialNumber(String callingPackage); /** * Retrieves the serial number of the ICC, if applicable. */ - @UnsupportedAppUsage - String getIccSerialNumber(String callingPackage); + String getIccSerialNumberWithFeature(String callingPackage, String callingFeatureId); /** * Retrieves the serial number of a given subId. */ - String getIccSerialNumberForSubscriber(int subId, String callingPackage); + String getIccSerialNumberForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Retrieves the phone number string for line 1. */ - String getLine1Number(String callingPackage); + String getLine1Number(String callingPackage, String callingFeatureId); /** * Retrieves the phone number string for line 1 of a subcription. */ - String getLine1NumberForSubscriber(int subId, String callingPackage); + String getLine1NumberForSubscriber(int subId, String callingPackage, String callingFeatureId); /** * Retrieves the alpha identifier for line 1. */ - String getLine1AlphaTag(String callingPackage); + String getLine1AlphaTag(String callingPackage, String callingFeatureId); /** * Retrieves the alpha identifier for line 1 of a subId. */ - String getLine1AlphaTagForSubscriber(int subId, String callingPackage); + String getLine1AlphaTagForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Retrieves MSISDN Number. */ - String getMsisdn(String callingPackage); + String getMsisdn(String callingPackage, String callingFeatureId); /** * Retrieves the Msisdn of a subId. */ - String getMsisdnForSubscriber(int subId, String callingPackage); + String getMsisdnForSubscriber(int subId, String callingPackage, String callingFeatureId); /** * Retrieves the voice mail number. */ - String getVoiceMailNumber(String callingPackage); + String getVoiceMailNumber(String callingPackage, String callingFeatureId); /** * Retrieves the voice mail number of a given subId. */ - String getVoiceMailNumberForSubscriber(int subId, String callingPackage); + String getVoiceMailNumberForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Retrieves the Carrier information used to encrypt IMSI and IMPI. */ ImsiEncryptionInfo getCarrierInfoForImsiEncryption(int subId, int keyType, - String callingPackage); + String callingPackage); /** * Stores the Carrier information used to encrypt IMSI and IMPI. @@ -148,13 +163,14 @@ interface IPhoneSubInfo { /** * Retrieves the alpha identifier associated with the voice mail number. */ - String getVoiceMailAlphaTag(String callingPackage); + String getVoiceMailAlphaTag(String callingPackage, String callingFeatureId); /** * Retrieves the alpha identifier associated with the voice mail number * of a subId. */ - String getVoiceMailAlphaTagForSubscriber(int subId, String callingPackage); + String getVoiceMailAlphaTagForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Returns the IMS private user identity (IMPI) that was loaded from the ISIM. diff --git a/telephony/java/com/android/internal/telephony/ISms.aidl b/telephony/java/com/android/internal/telephony/ISms.aidl index 2dc59e6a7c3f..c07a1711b32e 100644 --- a/telephony/java/com/android/internal/telephony/ISms.aidl +++ b/telephony/java/com/android/internal/telephony/ISms.aidl @@ -580,7 +580,8 @@ interface ISms { * * @param destAddress the destination address to test for possible short code */ - int checkSmsShortCodeDestination(int subId, String callingApk, String destAddress, String countryIso); + int checkSmsShortCodeDestination(int subId, String callingApk, String callingFeatureId, + String destAddress, String countryIso); /** * Gets the SMSC address from (U)SIM. diff --git a/telephony/java/com/android/internal/telephony/ISmsImplBase.java b/telephony/java/com/android/internal/telephony/ISmsImplBase.java index 98095bbc12ac..ddd3457b3b4d 100644 --- a/telephony/java/com/android/internal/telephony/ISmsImplBase.java +++ b/telephony/java/com/android/internal/telephony/ISmsImplBase.java @@ -202,8 +202,8 @@ public class ISmsImplBase extends ISms.Stub { } @Override - public int checkSmsShortCodeDestination( - int subid, String callingApk, String destAddress, String countryIso) { + public int checkSmsShortCodeDestination(int subid, String callingPackage, + String callingFeatureId, String destAddress, String countryIso) { throw new UnsupportedOperationException(); } diff --git a/telephony/java/com/android/internal/telephony/ISub.aidl b/telephony/java/com/android/internal/telephony/ISub.aidl index 5a26232c8892..cc02a409c16d 100755 --- a/telephony/java/com/android/internal/telephony/ISub.aidl +++ b/telephony/java/com/android/internal/telephony/ISub.aidl @@ -23,47 +23,56 @@ import com.android.internal.telephony.ISetOpportunisticDataCallback; interface ISub { /** * @param callingPackage The package maing the call. + * @param callingFeatureId The feature in the package * @return a list of all subscriptions in the database, this includes * all subscriptions that have been seen. */ - List<SubscriptionInfo> getAllSubInfoList(String callingPackage); + List<SubscriptionInfo> getAllSubInfoList(String callingPackage, String callingFeatureId); /** * @param callingPackage The package maing the call. + * @param callingFeatureId The feature in the package * @return the count of all subscriptions in the database, this includes * all subscriptions that have been seen. */ - int getAllSubInfoCount(String callingPackage); + int getAllSubInfoCount(String callingPackage, String callingFeatureId); /** * Get the active SubscriptionInfo with the subId key * @param subId The unique SubscriptionInfo key in database * @param callingPackage The package maing the call. + * @param callingFeatureId The feature in the package * @return SubscriptionInfo, maybe null if its not active */ - SubscriptionInfo getActiveSubscriptionInfo(int subId, String callingPackage); + SubscriptionInfo getActiveSubscriptionInfo(int subId, String callingPackage, + String callingFeatureId); /** * Get the active SubscriptionInfo associated with the iccId * @param iccId the IccId of SIM card * @param callingPackage The package maing the call. + * @param callingFeatureId The feature in the package * @return SubscriptionInfo, maybe null if its not active */ - SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId, String callingPackage); + SubscriptionInfo getActiveSubscriptionInfoForIccId(String iccId, String callingPackage, + String callingFeatureId); /** * Get the active SubscriptionInfo associated with the slotIndex * @param slotIndex the slot which the subscription is inserted * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package * @return SubscriptionInfo, null for Remote-SIMs or non-active slotIndex. */ - SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIndex, String callingPackage); + SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int slotIndex, String callingPackage, + String callingFeatureId); /** * Get the SubscriptionInfo(s) of the active subscriptions. The records will be sorted * by {@link SubscriptionInfo#getSimSlotIndex} then by {@link SubscriptionInfo#getSubscriptionId}. * * @param callingPackage The package maing the call. + * @param callingFeatureId The feature in the package * @return Sorted list of the currently {@link SubscriptionInfo} records available on the device. * <ul> * <li> @@ -80,13 +89,15 @@ interface ISub { * </li> * </ul> */ - List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage); + List<SubscriptionInfo> getActiveSubscriptionInfoList(String callingPackage, + String callingFeatureId); /** * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package. * @return the number of active subscriptions */ - int getActiveSubInfoCount(String callingPackage); + int getActiveSubInfoCount(String callingPackage, String callingFeatureId); /** * @return the maximum number of subscriptions this device will support at any one time. @@ -96,7 +107,8 @@ interface ISub { /** * @see android.telephony.SubscriptionManager#getAvailableSubscriptionInfoList */ - List<SubscriptionInfo> getAvailableSubscriptionInfoList(String callingPackage); + List<SubscriptionInfo> getAvailableSubscriptionInfoList(String callingPackage, + String callingFeatureId); /** * @see android.telephony.SubscriptionManager#getAccessibleSubscriptionInfoList @@ -225,7 +237,8 @@ interface ISub { * Return opportunistic subscriptions that can be visible to the caller. * @return the list of opportunistic subscription info. If none exists, an empty list. */ - List<SubscriptionInfo> getOpportunisticSubscriptions(String callingPackage); + List<SubscriptionInfo> getOpportunisticSubscriptions(String callingPackage, + String callingFeatureId); void removeSubscriptionsFromGroup(in int[] subIdList, in ParcelUuid groupUuid, String callingPackage); @@ -233,7 +246,8 @@ interface ISub { void addSubscriptionsIntoGroup(in int[] subIdList, in ParcelUuid groupUuid, String callingPackage); - List<SubscriptionInfo> getSubscriptionsInGroup(in ParcelUuid groupUuid, String callingPackage); + List<SubscriptionInfo> getSubscriptionsInGroup(in ParcelUuid groupUuid, String callingPackage, + String callingFeatureId); int getSlotIndex(int subId); @@ -265,7 +279,8 @@ interface ISub { int setSubscriptionProperty(int subId, String propKey, String propValue); - String getSubscriptionProperty(int subId, String propKey, String callingPackage); + String getSubscriptionProperty(int subId, String propKey, String callingPackage, + String callingFeatureId); boolean setSubscriptionEnabled(boolean enable, int subId); @@ -278,7 +293,7 @@ interface ISub { */ int getSimStateForSlotIndex(int slotIndex); - boolean isActiveSubId(int subId, String callingPackage); + boolean isActiveSubId(int subId, String callingPackage, String callingFeatureId); boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow); diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index feb1368e7d47..97b24aef4af5 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -89,21 +89,32 @@ interface ITelephony { @UnsupportedAppUsage void call(String callingPackage, String number); + /** @deprecated Use {@link #isRadioOnWithFeature(String, String) instead */ + @UnsupportedAppUsage + boolean isRadioOn(String callingPackage); + /** * Check to see if the radio is on or not. * @param callingPackage the name of the package making the call. + * @param callingFeatureId The feature in the package. * @return returns true if the radio is on. */ - boolean isRadioOn(String callingPackage); + boolean isRadioOnWithFeature(String callingPackage, String callingFeatureId); + + /** + * @deprecated Use {@link #isRadioOnForSubscriberWithFeature(int, String, String) instead + */ + @UnsupportedAppUsage + boolean isRadioOnForSubscriber(int subId, String callingPackage); /** * Check to see if the radio is on or not on particular subId. * @param subId user preferred subId. * @param callingPackage the name of the package making the call. + * @param callingFeatureId The feature in the package. * @return returns true if the radio is on. */ - @UnsupportedAppUsage - boolean isRadioOnForSubscriber(int subId, String callingPackage); + boolean isRadioOnForSubscriberWithFeature(int subId, String callingPackage, String callingFeatureId); /** * Supply a pin to unlock the SIM. Blocks until a result is determined. @@ -294,19 +305,19 @@ interface ITelephony { */ boolean isDataConnectivityPossible(int subId); - Bundle getCellLocation(String callingPkg); + Bundle getCellLocation(String callingPkg, String callingFeatureId); /** * Returns the ISO country code equivalent of the current registered * operator's MCC (Mobile Country Code). * @see android.telephony.TelephonyManager#getNetworkCountryIso */ - String getNetworkCountryIsoForPhone(int phoneId, String callingPkg); + String getNetworkCountryIsoForPhone(int phoneId, String callingPkg, String callingFeatureId); /** * Returns the neighboring cell information of the device. */ - List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg); + List<NeighboringCellInfo> getNeighboringCellInfo(String callingPkg, String callingFeatureId); @UnsupportedAppUsage int getCallState(); @@ -370,23 +381,27 @@ interface ITelephony { /** * Returns the CDMA ERI icon index to display * @param callingPackage package making the call. + * @param callingFeatureId The feature in the package. */ - int getCdmaEriIconIndex(String callingPackage); + int getCdmaEriIconIndex(String callingPackage, String callingFeatureId); /** * Returns the CDMA ERI icon index to display on particular subId. * @param subId user preferred subId. * @param callingPackage package making the call. + * @param callingFeatureId The feature in the package. */ - int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage); + int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Returns the CDMA ERI icon mode, * 0 - ON * 1 - FLASHING * @param callingPackage package making the call. + * @param callingFeatureId The feature in the package. */ - int getCdmaEriIconMode(String callingPackage); + int getCdmaEriIconMode(String callingPackage, String callingFeatureId); /** * Returns the CDMA ERI icon mode on particular subId, @@ -394,21 +409,25 @@ interface ITelephony { * 1 - FLASHING * @param subId user preferred subId. * @param callingPackage package making the call. + * @param callingFeatureId The feature in the package. */ - int getCdmaEriIconModeForSubscriber(int subId, String callingPackage); + int getCdmaEriIconModeForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Returns the CDMA ERI text, * @param callingPackage package making the call. + * @param callingFeatureId The feature in the package. */ - String getCdmaEriText(String callingPackage); + String getCdmaEriText(String callingPackage, String callingFeatureId); /** * Returns the CDMA ERI text for particular subId, * @param subId user preferred subId. * @param callingPackage package making the call. + * @param callingFeatureId The feature in the package. */ - String getCdmaEriTextForSubscriber(int subId, String callingPackage); + String getCdmaEriTextForSubscriber(int subId, String callingPackage, String callingFeatureId); /** * Returns true if OTA service provisioning needs to run. @@ -451,7 +470,8 @@ interface ITelephony { * @param subId user preferred subId. * Returns the unread count of voicemails */ - int getVoiceMessageCountForSubscriber(int subId, String callingPackage); + int getVoiceMessageCountForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Returns true if current state supports both voice and data @@ -461,7 +481,7 @@ interface ITelephony { Bundle getVisualVoicemailSettings(String callingPackage, int subId); - String getVisualVoicemailPackageName(String callingPackage, int subId); + String getVisualVoicemailPackageName(String callingPackage, String callingFeatureId, int subId); // Not oneway, caller needs to make sure the vaule is set before receiving a SMS void enableVisualVoicemailSmsFilter(String callingPackage, int subId, @@ -493,29 +513,35 @@ interface ITelephony { * Returns the network type of a subId. * @param subId user preferred subId. * @param callingPackage package making the call. + * @param callingFeatureId The feature in the package. */ - int getNetworkTypeForSubscriber(int subId, String callingPackage); + int getNetworkTypeForSubscriber(int subId, String callingPackage, String callingFeatureId); /** * Returns the network type for data transmission * @param callingPackage package making the call. + * @param callingFeatureId The feature in the package. */ - int getDataNetworkType(String callingPackage); + int getDataNetworkType(String callingPackage, String callingFeatureId); /** * Returns the data network type of a subId * @param subId user preferred subId. * @param callingPackage package making the call. + * @param callingFeatureId The feature in the package. */ - int getDataNetworkTypeForSubscriber(int subId, String callingPackage); + int getDataNetworkTypeForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Returns the voice network type of a subId * @param subId user preferred subId. - * @param callingPackage package making the call. + * @param callingPackage package making the call.getLteOnCdmaMode + * @param callingFeatureId The feature in the package. * Returns the network type */ - int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage); + int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Return true if an ICC card is present @@ -536,10 +562,11 @@ interface ITelephony { * the mode may be unknown. * * @param callingPackage the name of the calling package + * @param callingFeatureId The feature in the package. * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} * or {@link PHone#LTE_ON_CDMA_TRUE} */ - int getLteOnCdmaMode(String callingPackage); + int getLteOnCdmaMode(String callingPackage, String callingFeatureId); /** * Return if the current radio is LTE on CDMA. This @@ -547,21 +574,23 @@ interface ITelephony { * the mode may be unknown. * * @param callingPackage the name of the calling package + * @param callingFeatureId The feature in the package. * @return {@link Phone#LTE_ON_CDMA_UNKNOWN}, {@link Phone#LTE_ON_CDMA_FALSE} * or {@link PHone#LTE_ON_CDMA_TRUE} */ - int getLteOnCdmaModeForSubscriber(int subId, String callingPackage); + int getLteOnCdmaModeForSubscriber(int subId, String callingPackage, String callingFeatureId); /** * Returns all observed cell information of the device. */ - List<CellInfo> getAllCellInfo(String callingPkg); + List<CellInfo> getAllCellInfo(String callingPkg, String callingFeatureId); /** * Request a cell information update for the specified subscription, * reported via the CellInfoCallback. */ - void requestCellInfoUpdate(int subId, in ICellInfoCallback cb, String callingPkg); + void requestCellInfoUpdate(int subId, in ICellInfoCallback cb, String callingPkg, + String callingFeatureId); /** * Request a cell information update for the specified subscription, @@ -569,8 +598,8 @@ interface ITelephony { * * @param workSource the requestor to whom the power consumption for this should be attributed. */ - void requestCellInfoUpdateWithWorkSource( - int subId, in ICellInfoCallback cb, in String callingPkg, in WorkSource ws); + void requestCellInfoUpdateWithWorkSource(int subId, in ICellInfoCallback cb, + in String callingPkg, String callingFeatureId, in WorkSource ws); /** * Sets minimum time in milli-seconds between onCellInfoChanged @@ -798,10 +827,11 @@ interface ITelephony { * Get the calculated preferred network type. * Used for device configuration by some CDMA operators. * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package. * * @return the calculated preferred network type, defined in RILConstants.java. */ - int getCalculatedPreferredNetworkType(String callingPackage); + int getCalculatedPreferredNetworkType(String callingPackage, String callingFeatureId); /* * Get the preferred network type. @@ -882,9 +912,12 @@ interface ITelephony { * Perform a radio scan and return the list of avialble networks. * * @param subId the id of the subscription. + * @param callingPackage the calling package + * @param callingFeatureId The feature in the package * @return CellNetworkScanResult containing status of scan and networks. */ - CellNetworkScanResult getCellNetworkScanResults(int subId, String callingPackage); + CellNetworkScanResult getCellNetworkScanResults(int subId, String callingPackage, + String callingFeatureId); /** * Perform a radio network scan and return the id of this scan. @@ -894,10 +927,11 @@ interface ITelephony { * @param messenger Callback messages will be sent using this messenger. * @param binder the binder object instantiated in TelephonyManager. * @param callingPackage the calling package + * @param callingFeatureId The feature in the package * @return An id for this scan. */ int requestNetworkScan(int subId, in NetworkScanRequest request, in Messenger messenger, - in IBinder binder, in String callingPackage); + in IBinder binder, in String callingPackage, String callingFeatureId); /** * Stop an existing radio network scan. @@ -976,8 +1010,9 @@ interface ITelephony { * Get P-CSCF address from PCO after data connection is established or modified. * @param apnType the apnType, "ims" for IMS APN, "emergency" for EMERGENCY APN * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package. */ - String[] getPcscfAddress(String apnType, String callingPackage); + String[] getPcscfAddress(String apnType, String callingPackage, String callingFeatureId); /** * Set IMS registration state @@ -1067,9 +1102,10 @@ interface ITelephony { * * @param subId whose dialing number for line 1 is returned. * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package. * @return the displayed dialing number if set, or null if not set. */ - String getLine1NumberForDisplay(int subId, String callingPackage); + String getLine1NumberForDisplay(int subId, String callingPackage, String callingFeatureId); /** * Returns the displayed alphatag of the dialing number if it was set @@ -1077,10 +1113,11 @@ interface ITelephony { * * @param subId whose alphatag associated with line 1 is returned. * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package. * @return the displayed alphatag of the dialing number if set, or null if * not set. */ - String getLine1AlphaTagForDisplay(int subId, String callingPackage); + String getLine1AlphaTagForDisplay(int subId, String callingPackage, String callingFeatureId); /** * Return the set of subscriber IDs that should be considered "merged together" for data usage @@ -1092,7 +1129,7 @@ interface ITelephony { * * @hide */ - String[] getMergedSubscriberIds(int subId, String callingPackage); + String[] getMergedSubscriberIds(int subId, String callingPackage, String callingFeatureId); /** * @hide @@ -1191,26 +1228,29 @@ interface ITelephony { * Whether video calling has been enabled by the user. * * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package. * @return {@code true} if the user has enabled video calling, {@code false} otherwise. */ - boolean isVideoCallingEnabled(String callingPackage); + boolean isVideoCallingEnabled(String callingPackage, String callingFeatureId); /** * Whether the DTMF tone length can be changed. * * @param subId The subscription to use. * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package. * @return {@code true} if the DTMF tone length can be changed. */ - boolean canChangeDtmfToneLength(int subId, String callingPackage); + boolean canChangeDtmfToneLength(int subId, String callingPackage, String callingFeatureId); /** * Whether the device is a world phone. * * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package. * @return {@code true} if the devices is a world phone. */ - boolean isWorldPhone(int subId, String callingPackage); + boolean isWorldPhone(int subId, String callingPackage, String callingFeatureId); /** * Whether the phone supports TTY mode. @@ -1252,25 +1292,31 @@ interface ITelephony { */ int getImsRegTechnologyForMmTel(int subId); + /** @deprecated Use {@link #getDeviceIdWithFeature(String, String) instead */ + @UnsupportedAppUsage + String getDeviceId(String callingPackage); + /** * Returns the unique device ID of phone, for example, the IMEI for * GSM and the MEID for CDMA phones. Return null if device ID is not available. * * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package * <p>Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ - String getDeviceId(String callingPackage); + String getDeviceIdWithFeature(String callingPackage, String callingFeatureId); /** * Returns the IMEI for the given slot. * * @param slotIndex - device slot. * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package * <p>Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ - String getImeiForSlot(int slotIndex, String callingPackage); + String getImeiForSlot(int slotIndex, String callingPackage, String callingFeatureId); /** * Returns the Type Allocation Code from the IMEI for the given slot. @@ -1284,10 +1330,11 @@ interface ITelephony { * * @param slotIndex - device slot. * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package * <p>Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ - String getMeidForSlot(int slotIndex, String callingPackage); + String getMeidForSlot(int slotIndex, String callingPackage, String callingFeatureId); /** * Returns the Manufacturer Code from the MEID for the given slot. @@ -1301,10 +1348,12 @@ interface ITelephony { * * @param slotIndex - device slot. * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package. * <p>Requires Permission: * {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE} */ - String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage); + String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage, + String callingFeatureId); /** * Returns the subscription ID associated with the specified PhoneAccount. @@ -1315,7 +1364,7 @@ interface ITelephony { * Returns the subscription ID associated with the specified PhoneAccountHandle. */ int getSubIdForPhoneAccountHandle(in PhoneAccountHandle phoneAccountHandle, - String callingPackage); + String callingPackage, String callingFeatureId); /** * Returns the PhoneAccountHandle associated with a subscription ID. @@ -1345,9 +1394,11 @@ interface ITelephony { * Get the service state on specified subscription * @param subId Subscription id * @param callingPackage The package making the call + * @param callingFeatureId The feature in the package * @return Service state on specified subscription. */ - ServiceState getServiceStateForSubscriber(int subId, String callingPackage); + ServiceState getServiceStateForSubscriber(int subId, String callingPackage, + String callingFeatureId); /** * Returns the URI for the per-account voicemail ringtone set in Phone settings. @@ -1597,10 +1648,12 @@ interface ITelephony { * Get Client request stats which will contain statistical information * on each request made by client. * @param callingPackage package making the call. + * @param callingFeatureId The feature in the package. * @param subId Subscription index * @hide */ - List<ClientRequestStats> getClientRequestStats(String callingPackage, int subid); + List<ClientRequestStats> getClientRequestStats(String callingPackage, String callingFeatureId, + int subid); /** * Set SIM card power state. @@ -1619,7 +1672,8 @@ interface ITelephony { * @param subId subscription ID used for authentication * @param appType the icc application type, like {@link #APPTYPE_USIM} */ - String[] getForbiddenPlmns(int subId, int appType, String callingPackage); + String[] getForbiddenPlmns(int subId, int appType, String callingPackage, + String callingFeatureId); /** * Set the forbidden PLMN list from the givven app type (ex APPTYPE_USIM) on a particular @@ -1628,10 +1682,12 @@ interface ITelephony { * @param subId subId the id of the subscription * @param appType appType the uicc app type, must be USIM or SIM. * @param fplmns plmns the Forbiden plmns list that needed to be written to the SIM. - * @param content callingPackage the op Package name. + * @param callingPackage the op Package name. + * @param callingFeatureId the feature in the package. * @return number of fplmns that is successfully written to the SIM */ - int setForbiddenPlmns(int subId, int appType, in List<String> fplmns, String callingPackage); + int setForbiddenPlmns(int subId, int appType, in List<String> fplmns, String callingPackage, + String callingFeatureId); /** * Check if phone is in emergency callback mode @@ -1775,7 +1831,8 @@ interface ITelephony { * How many modems can have simultaneous data connections. * @hide */ - int getNumberOfModemsWithSimultaneousDataConnections(int subId, String callingPackage); + int getNumberOfModemsWithSimultaneousDataConnections(int subId, String callingPackage, + String callingFeatureId); /** * Return the network selection mode on the subscription with id {@code subId}. @@ -1791,7 +1848,7 @@ interface ITelephony { * Return the modem radio power state for slot index. * */ - int getRadioPowerState(int slotIndex, String callingPackage); + int getRadioPowerState(int slotIndex, String callingPackage, String callingFeatureId); // IMS specific AIDL commands, see ImsMmTelManager.java @@ -1921,7 +1978,7 @@ interface ITelephony { /** * Return the emergency number list from all the active subscriptions. */ - Map getEmergencyNumberList(String callingPackage); + Map getEmergencyNumberList(String callingPackage, String callingFeatureId); /** * Identify if the number is emergency number, based on all the active subscriptions. @@ -2021,12 +2078,13 @@ interface ITelephony { * Returns if the usage of multiple SIM cards at the same time is supported. * * @param callingPackage The package making the call. + * @param callingFeatureId The feature in the package. * @return {@link #MULTISIM_ALLOWED} if the device supports multiple SIMs. * {@link #MULTISIM_NOT_SUPPORTED_BY_HARDWARE} if the device does not support multiple SIMs. * {@link #MULTISIM_NOT_SUPPORTED_BY_CARRIER} in the device supports multiple SIMs, but the * functionality is restricted by the carrier. */ - int isMultiSimSupported(String callingPackage); + int isMultiSimSupported(String callingPackage, String callingFeatureId); /** * Switch configs to enable multi-sim or switch back to single-sim @@ -2038,7 +2096,8 @@ interface ITelephony { * Get if altering modems configurations will trigger reboot. * @hide */ - boolean doesSwitchMultiSimConfigTriggerReboot(int subId, String callingPackage); + boolean doesSwitchMultiSimConfigTriggerReboot(int subId, String callingPackage, + String callingFeatureId); /** * Get the mapping from logical slots to physical slots. @@ -2057,7 +2116,7 @@ interface ITelephony { */ boolean isApplicationOnUicc(int subId, int appType); - boolean isModemEnabledForSlot(int slotIndex, String callingPackage); + boolean isModemEnabledForSlot(int slotIndex, String callingPackage, String callingFeatureId); boolean isDataEnabledForApn(int apnType, int subId, String callingPackage); |