(Backport) Pipe though componentId from caller to permission checks
Test: atest TeleServiceTests
Bug: 136595429
Change-Id: I36f8a7bcaf33efd05429fb44f6349ef9f30a7461
Merged-In: I3e6a3b0bd1c443660d0dcd27b6c8af0388330dec
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 5f7b627..9f422e9 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1701,15 +1701,29 @@
}
}
+ @Deprecated
@Override
public boolean isRadioOn(String callingPackage) {
- return isRadioOnForSubscriber(getDefaultSubscription(), callingPackage);
+ return isRadioOnWithFeature(callingPackage, null);
}
@Override
+ public boolean isRadioOnWithFeature(String callingPackage, String callingFeatureId) {
+ return isRadioOnForSubscriberWithFeature(getDefaultSubscription(), callingPackage,
+ callingFeatureId);
+ }
+
+ @Deprecated
+ @Override
public boolean isRadioOnForSubscriber(int subId, String callingPackage) {
+ return isRadioOnForSubscriberWithFeature(subId, callingPackage, null);
+ }
+
+ @Override
+ public boolean isRadioOnForSubscriberWithFeature(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "isRadioOnForSubscriber")) {
+ mApp, subId, callingPackage, callingFeatureId, "isRadioOnForSubscriber")) {
return false;
}
@@ -1996,7 +2010,7 @@
}
@Override
- public Bundle getCellLocation(String callingPackage) {
+ public Bundle getCellLocation(String callingPackage, String callingFeatureId) {
mApp.getSystemService(AppOpsManager.class)
.checkPackage(Binder.getCallingUid(), callingPackage);
@@ -2004,6 +2018,7 @@
LocationAccessPolicy.checkLocationPermission(mApp,
new LocationAccessPolicy.LocationPermissionQuery.Builder()
.setCallingPackage(callingPackage)
+ .setCallingFeatureId(callingFeatureId)
.setCallingPid(Binder.getCallingPid())
.setCallingUid(Binder.getCallingUid())
.setMethod("getCellLocation")
@@ -2031,11 +2046,12 @@
}
@Override
- public String getNetworkCountryIsoForPhone(int phoneId, String callingPackage) {
+ public String getNetworkCountryIsoForPhone(int phoneId, String callingPackage,
+ String callingFeatureId) {
if (!TextUtils.isEmpty(callingPackage)) {
final int subId = mSubscriptionController.getSubIdUsingPhoneId(phoneId);
- if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getNetworkCountryIsoForPhone")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp, subId, callingPackage,
+ callingFeatureId, "getNetworkCountryIsoForPhone")) {
return "";
}
}
@@ -2052,7 +2068,8 @@
// Todo: fix this when we can get the actual cellular network info when the device
// is on IWLAN.
if (TelephonyManager.NETWORK_TYPE_IWLAN
- == getVoiceNetworkTypeForSubscriber(subId, mApp.getPackageName())) {
+ == getVoiceNetworkTypeForSubscriber(subId, mApp.getPackageName(),
+ null)) {
return "";
}
Phone phone = PhoneFactory.getPhone(phoneId);
@@ -2139,7 +2156,8 @@
@Override
@SuppressWarnings("unchecked")
- public List<NeighboringCellInfo> getNeighboringCellInfo(String callingPackage) {
+ public List<NeighboringCellInfo> getNeighboringCellInfo(String callingPackage,
+ String callingFeatureId) {
final int targetSdk = getTargetSdk(callingPackage);
if (targetSdk >= android.os.Build.VERSION_CODES.Q) {
throw new SecurityException(
@@ -2153,7 +2171,7 @@
if (DBG_LOC) log("getNeighboringCellInfo: is active user");
- List<CellInfo> info = getAllCellInfo(callingPackage);
+ List<CellInfo> info = getAllCellInfo(callingPackage, callingFeatureId);
if (info == null) return null;
List<NeighboringCellInfo> neighbors = new ArrayList<NeighboringCellInfo>();
@@ -2177,7 +2195,7 @@
}
@Override
- public List<CellInfo> getAllCellInfo(String callingPackage) {
+ public List<CellInfo> getAllCellInfo(String callingPackage, String callingFeatureId) {
mApp.getSystemService(AppOpsManager.class)
.checkPackage(Binder.getCallingUid(), callingPackage);
@@ -2185,6 +2203,7 @@
LocationAccessPolicy.checkLocationPermission(mApp,
new LocationAccessPolicy.LocationPermissionQuery.Builder()
.setCallingPackage(callingPackage)
+ .setCallingFeatureId(callingFeatureId)
.setCallingPid(Binder.getCallingPid())
.setCallingUid(Binder.getCallingUid())
.setMethod("getAllCellInfo")
@@ -2220,20 +2239,21 @@
}
@Override
- public void requestCellInfoUpdate(int subId, ICellInfoCallback cb, String callingPackage) {
- requestCellInfoUpdateInternal(
- subId, cb, callingPackage, getWorkSource(Binder.getCallingUid()));
+ public void requestCellInfoUpdate(int subId, ICellInfoCallback cb, String callingPackage,
+ String callingFeatureId) {
+ requestCellInfoUpdateInternal(subId, cb, callingPackage, callingFeatureId,
+ getWorkSource(Binder.getCallingUid()));
}
@Override
- public void requestCellInfoUpdateWithWorkSource(
- int subId, ICellInfoCallback cb, String callingPackage, WorkSource workSource) {
+ public void requestCellInfoUpdateWithWorkSource(int subId, ICellInfoCallback cb,
+ String callingPackage, String callingFeatureId, WorkSource workSource) {
enforceModifyPermission();
- requestCellInfoUpdateInternal(subId, cb, callingPackage, workSource);
+ requestCellInfoUpdateInternal(subId, cb, callingPackage, callingFeatureId, workSource);
}
- private void requestCellInfoUpdateInternal(
- int subId, ICellInfoCallback cb, String callingPackage, WorkSource workSource) {
+ private void requestCellInfoUpdateInternal(int subId, ICellInfoCallback cb,
+ String callingPackage, String callingFeatureId, WorkSource workSource) {
mApp.getSystemService(AppOpsManager.class)
.checkPackage(Binder.getCallingUid(), callingPackage);
@@ -2241,6 +2261,7 @@
LocationAccessPolicy.checkLocationPermission(mApp,
new LocationAccessPolicy.LocationPermissionQuery.Builder()
.setCallingPackage(callingPackage)
+ .setCallingFeatureId(callingFeatureId)
.setCallingPid(Binder.getCallingPid())
.setCallingUid(Binder.getCallingUid())
.setMethod("requestCellInfoUpdate")
@@ -2279,14 +2300,14 @@
}
@Override
- public String getImeiForSlot(int slotIndex, String callingPackage) {
+ public String getImeiForSlot(int slotIndex, String callingPackage, String callingFeatureId) {
Phone phone = PhoneFactory.getPhone(slotIndex);
if (phone == null) {
return null;
}
int subId = phone.getSubId();
if (!TelephonyPermissions.checkCallingOrSelfReadDeviceIdentifiers(mApp, subId,
- callingPackage, "getImeiForSlot")) {
+ callingPackage, callingFeatureId, "getImeiForSlot")) {
return null;
}
@@ -2310,7 +2331,7 @@
}
@Override
- public String getMeidForSlot(int slotIndex, String callingPackage) {
+ public String getMeidForSlot(int slotIndex, String callingPackage, String callingFeatureId) {
Phone phone = PhoneFactory.getPhone(slotIndex);
if (phone == null) {
return null;
@@ -2318,7 +2339,7 @@
int subId = phone.getSubId();
if (!TelephonyPermissions.checkCallingOrSelfReadDeviceIdentifiers(mApp, subId,
- callingPackage, "getMeidForSlot")) {
+ callingPackage, callingFeatureId, "getMeidForSlot")) {
return null;
}
@@ -2342,14 +2363,16 @@
}
@Override
- public String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage) {
+ public String getDeviceSoftwareVersionForSlot(int slotIndex, String callingPackage,
+ String callingFeatureId) {
Phone phone = PhoneFactory.getPhone(slotIndex);
if (phone == null) {
return null;
}
int subId = phone.getSubId();
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getDeviceSoftwareVersionForSlot")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getDeviceSoftwareVersionForSlot")) {
return null;
}
@@ -2498,14 +2521,17 @@
* Returns the CDMA ERI icon index to display
*/
@Override
- public int getCdmaEriIconIndex(String callingPackage) {
- return getCdmaEriIconIndexForSubscriber(getDefaultSubscription(), callingPackage);
+ public int getCdmaEriIconIndex(String callingPackage, String callingFeatureId) {
+ return getCdmaEriIconIndexForSubscriber(getDefaultSubscription(), callingPackage,
+ callingFeatureId);
}
@Override
- public int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage) {
+ public int getCdmaEriIconIndexForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getCdmaEriIconIndexForSubscriber")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getCdmaEriIconIndexForSubscriber")) {
return -1;
}
@@ -2528,14 +2554,17 @@
* 1 - FLASHING
*/
@Override
- public int getCdmaEriIconMode(String callingPackage) {
- return getCdmaEriIconModeForSubscriber(getDefaultSubscription(), callingPackage);
+ public int getCdmaEriIconMode(String callingPackage, String callingFeatureId) {
+ return getCdmaEriIconModeForSubscriber(getDefaultSubscription(), callingPackage,
+ callingFeatureId);
}
@Override
- public int getCdmaEriIconModeForSubscriber(int subId, String callingPackage) {
+ public int getCdmaEriIconModeForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getCdmaEriIconModeForSubscriber")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getCdmaEriIconModeForSubscriber")) {
return -1;
}
@@ -2556,14 +2585,17 @@
* Returns the CDMA ERI text,
*/
@Override
- public String getCdmaEriText(String callingPackage) {
- return getCdmaEriTextForSubscriber(getDefaultSubscription(), callingPackage);
+ public String getCdmaEriText(String callingPackage, String callingFeatureId) {
+ return getCdmaEriTextForSubscriber(getDefaultSubscription(), callingPackage,
+ callingFeatureId);
}
@Override
- public String getCdmaEriTextForSubscriber(int subId, String callingPackage) {
+ public String getCdmaEriTextForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getCdmaEriIconTextForSubscriber")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getCdmaEriIconTextForSubscriber")) {
return null;
}
@@ -2698,10 +2730,12 @@
}
@Override
- public String getVisualVoicemailPackageName(String callingPackage, int subId) {
+ public String getVisualVoicemailPackageName(String callingPackage, String callingFeatureId,
+ int subId) {
mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getVisualVoicemailPackageName")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getVisualVoicemailPackageName")) {
return null;
}
@@ -2864,9 +2898,11 @@
* Returns the unread count of voicemails for a subId
*/
@Override
- public int getVoiceMessageCountForSubscriber(int subId, String callingPackage) {
+ public int getVoiceMessageCountForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getVoiceMessageCountForSubscriber")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getVoiceMessageCountForSubscriber")) {
return 0;
}
final long identity = Binder.clearCallingIdentity();
@@ -3776,13 +3812,15 @@
* Returns the data network type for a subId; does not throw SecurityException.
*/
@Override
- public int getNetworkTypeForSubscriber(int subId, String callingPackage) {
+ public int getNetworkTypeForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
final int targetSdk = getTargetSdk(callingPackage);
if (targetSdk > android.os.Build.VERSION_CODES.Q) {
- return getDataNetworkTypeForSubscriber(subId, callingPackage);
+ return getDataNetworkTypeForSubscriber(subId, callingPackage, callingFeatureId);
} else if (targetSdk == android.os.Build.VERSION_CODES.Q
&& !TelephonyPermissions.checkCallingOrSelfReadPhoneStateNoThrow(
- mApp, subId, callingPackage, "getNetworkTypeForSubscriber")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getNetworkTypeForSubscriber")) {
return TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
@@ -3803,17 +3841,20 @@
* Returns the data network type
*/
@Override
- public int getDataNetworkType(String callingPackage) {
- return getDataNetworkTypeForSubscriber(getDefaultSubscription(), callingPackage);
+ public int getDataNetworkType(String callingPackage, String callingFeatureId) {
+ return getDataNetworkTypeForSubscriber(getDefaultSubscription(), callingPackage,
+ callingFeatureId);
}
/**
* Returns the data network type for a subId
*/
@Override
- public int getDataNetworkTypeForSubscriber(int subId, String callingPackage) {
+ public int getDataNetworkTypeForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getDataNetworkTypeForSubscriber")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getDataNetworkTypeForSubscriber")) {
return TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
@@ -3834,9 +3875,11 @@
* Returns the Voice network type for a subId
*/
@Override
- public int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage) {
+ public int getVoiceNetworkTypeForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getDataNetworkTypeForSubscriber")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getDataNetworkTypeForSubscriber")) {
return TelephonyManager.NETWORK_TYPE_UNKNOWN;
}
@@ -3890,14 +3933,17 @@
* or {@link Phone#LTE_ON_CDMA_TRUE}
*/
@Override
- public int getLteOnCdmaMode(String callingPackage) {
- return getLteOnCdmaModeForSubscriber(getDefaultSubscription(), callingPackage);
+ public int getLteOnCdmaMode(String callingPackage, String callingFeatureId) {
+ return getLteOnCdmaModeForSubscriber(getDefaultSubscription(), callingPackage,
+ callingFeatureId);
}
@Override
- public int getLteOnCdmaModeForSubscriber(int subId, String callingPackage) {
+ public int getLteOnCdmaModeForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getLteOnCdmaModeForSubscriber")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getLteOnCdmaModeForSubscriber")) {
return PhoneConstants.LTE_ON_CDMA_UNKNOWN;
}
@@ -4221,9 +4267,10 @@
* Get the forbidden PLMN List from the given app type (ex APPTYPE_USIM)
* on a particular subscription
*/
- public String[] getForbiddenPlmns(int subId, int appType, String callingPackage) {
+ public String[] getForbiddenPlmns(int subId, int appType, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getForbiddenPlmns")) {
+ mApp, subId, callingPackage, callingFeatureId, "getForbiddenPlmns")) {
return null;
}
@@ -4255,12 +4302,13 @@
* @param appType the uicc app type, must be USIM or SIM.
* @param fplmns the Forbiden plmns list that needed to be written to the SIM.
* @param callingPackage the op Package name.
+ * @param callingFeatureId the feature in the package.
* @return number of fplmns that is successfully written to the SIM.
*/
- public int setForbiddenPlmns(
- int subId, int appType, List<String> fplmns, String callingPackage) {
- if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "setForbiddenPlmns")) {
+ public int setForbiddenPlmns(int subId, int appType, List<String> fplmns, String callingPackage,
+ String callingFeatureId) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp, subId, callingPackage,
+ callingFeatureId, "setForbiddenPlmns")) {
if (DBG) logv("no permissions for setForbiddenplmns");
throw new IllegalStateException("No Permissions for setForbiddenPlmns");
}
@@ -4436,10 +4484,11 @@
return false;
}
- public String[] getPcscfAddress(String apnType, String callingPackage) {
+ public String[] getPcscfAddress(String apnType, String callingPackage,
+ String callingFeatureId) {
final Phone defaultPhone = getDefaultPhone();
- if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, defaultPhone.getSubId(), callingPackage, "getPcscfAddress")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp, defaultPhone.getSubId(),
+ callingPackage, callingFeatureId, "getPcscfAddress")) {
return new String[0];
}
@@ -4742,13 +4791,15 @@
* Scans for available networks.
*/
@Override
- public CellNetworkScanResult getCellNetworkScanResults(int subId, String callingPackage) {
+ public CellNetworkScanResult getCellNetworkScanResults(int subId, String callingPackage,
+ String callingFeatureId) {
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
mApp, subId, "getCellNetworkScanResults");
LocationAccessPolicy.LocationPermissionResult locationResult =
LocationAccessPolicy.checkLocationPermission(mApp,
new LocationAccessPolicy.LocationPermissionQuery.Builder()
.setCallingPackage(callingPackage)
+ .setCallingFeatureId(callingFeatureId)
.setCallingPid(Binder.getCallingPid())
.setCallingUid(Binder.getCallingUid())
.setMethod("getCellNetworkScanResults")
@@ -4782,13 +4833,14 @@
*/
@Override
public int requestNetworkScan(int subId, NetworkScanRequest request, Messenger messenger,
- IBinder binder, String callingPackage) {
+ IBinder binder, String callingPackage, String callingFeatureId) {
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
mApp, subId, "requestNetworkScan");
LocationAccessPolicy.LocationPermissionResult locationResult =
LocationAccessPolicy.checkLocationPermission(mApp,
new LocationAccessPolicy.LocationPermissionQuery.Builder()
.setCallingPackage(callingPackage)
+ .setCallingFeatureId(callingFeatureId)
.setCallingPid(Binder.getCallingPid())
.setCallingUid(Binder.getCallingUid())
.setMethod("requestNetworkScan")
@@ -4869,10 +4921,10 @@
* @return the preferred network type, defined in RILConstants.java.
*/
@Override
- public int getCalculatedPreferredNetworkType(String callingPackage) {
+ public int getCalculatedPreferredNetworkType(String callingPackage, String callingFeatureId) {
final Phone defaultPhone = getDefaultPhone();
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp, defaultPhone.getSubId(),
- callingPackage, "getCalculatedPreferredNetworkType")) {
+ callingPackage, callingFeatureId, "getCalculatedPreferredNetworkType")) {
return RILConstants.PREFERRED_NETWORK_MODE;
}
@@ -5329,10 +5381,11 @@
}
@Override
- public String getLine1NumberForDisplay(int subId, String callingPackage) {
+ public String getLine1NumberForDisplay(int subId, String callingPackage,
+ String callingFeatureId) {
// This is open to apps with WRITE_SMS.
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneNumber(
- mApp, subId, callingPackage, "getLine1NumberForDisplay")) {
+ mApp, subId, callingPackage, callingFeatureId, "getLine1NumberForDisplay")) {
if (DBG_MERGE) log("getLine1NumberForDisplay returning null due to permission");
return null;
}
@@ -5356,9 +5409,10 @@
}
@Override
- public String getLine1AlphaTagForDisplay(int subId, String callingPackage) {
+ public String getLine1AlphaTagForDisplay(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getLine1AlphaTagForDisplay")) {
+ mApp, subId, callingPackage, callingFeatureId, "getLine1AlphaTagForDisplay")) {
return null;
}
@@ -5376,12 +5430,13 @@
}
@Override
- public String[] getMergedSubscriberIds(int subId, String callingPackage) {
+ public String[] getMergedSubscriberIds(int subId, String callingPackage,
+ String callingFeatureId) {
// This API isn't public, so no need to provide a valid subscription ID - we're not worried
// about carrier-privileged callers not having access.
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
mApp, SubscriptionManager.INVALID_SUBSCRIPTION_ID, callingPackage,
- "getMergedSubscriberIds")) {
+ callingFeatureId, "getMergedSubscriberIds")) {
return null;
}
@@ -5486,7 +5541,8 @@
// Get all subscriberIds from the group.
final List<String> mergedSubscriberIds = new ArrayList<>();
final List<SubscriptionInfo> groupInfos = SubscriptionController.getInstance()
- .getSubscriptionsInGroup(groupUuid, mApp.getOpPackageName());
+ .getSubscriptionsInGroup(groupUuid, mApp.getOpPackageName(),
+ null);
for (SubscriptionInfo subInfo : groupInfos) {
subscriberId = telephonyManager.getSubscriberId(subInfo.getSubscriptionId());
if (subscriberId != null) {
@@ -5610,10 +5666,10 @@
}
@Override
- public boolean isVideoCallingEnabled(String callingPackage) {
+ public boolean isVideoCallingEnabled(String callingPackage, String callingFeatureId) {
final Phone defaultPhone = getDefaultPhone();
- if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, defaultPhone.getSubId(), callingPackage, "isVideoCallingEnabled")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp, defaultPhone.getSubId(),
+ callingPackage, callingFeatureId, "isVideoCallingEnabled")) {
return false;
}
@@ -5634,9 +5690,11 @@
}
@Override
- public boolean canChangeDtmfToneLength(int subId, String callingPackage) {
+ public boolean canChangeDtmfToneLength(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "isVideoCallingEnabled")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "isVideoCallingEnabled")) {
return false;
}
@@ -5652,9 +5710,9 @@
}
@Override
- public boolean isWorldPhone(int subId, String callingPackage) {
+ public boolean isWorldPhone(int subId, String callingPackage, String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "isVideoCallingEnabled")) {
+ mApp, subId, callingPackage, callingFeatureId, "isVideoCallingEnabled")) {
return false;
}
@@ -5724,6 +5782,12 @@
}
}
+ @Deprecated
+ @Override
+ public String getDeviceId(String callingPackage) {
+ return getDeviceIdWithFeature(callingPackage, null);
+ }
+
/**
* 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.
@@ -5732,14 +5796,14 @@
* {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
*/
@Override
- public String getDeviceId(String callingPackage) {
+ public String getDeviceIdWithFeature(String callingPackage, String callingFeatureId) {
final Phone phone = PhoneFactory.getPhone(0);
if (phone == null) {
return null;
}
int subId = phone.getSubId();
if (!TelephonyPermissions.checkCallingOrSelfReadDeviceIdentifiers(mApp, subId,
- callingPackage, "getDeviceId")) {
+ callingPackage, callingFeatureId, "getDeviceId")) {
return null;
}
@@ -5778,9 +5842,9 @@
@Override
public int getSubIdForPhoneAccountHandle(
- PhoneAccountHandle phoneAccountHandle, String callingPackage) {
+ PhoneAccountHandle phoneAccountHandle, String callingPackage, String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp, getDefaultSubscription(),
- callingPackage, "getSubIdForPhoneAccountHandle")) {
+ callingPackage, callingFeatureId, "getSubIdForPhoneAccountHandle")) {
throw new SecurityException("Requires READ_PHONE_STATE permission.");
}
final long identity = Binder.clearCallingIdentity();
@@ -5914,7 +5978,7 @@
final long identity = Binder.clearCallingIdentity();
try {
final SubscriptionInfo info = mSubscriptionController.getActiveSubscriptionInfo(subId,
- phone.getContext().getOpPackageName());
+ phone.getContext().getOpPackageName(), null);
if (info == null) {
log("getSimLocaleForSubscriber, inactive subId: " + subId);
return null;
@@ -5952,14 +6016,16 @@
}
private List<SubscriptionInfo> getAllSubscriptionInfoList() {
- return mSubscriptionController.getAllSubInfoList(mApp.getOpPackageName());
+ return mSubscriptionController.getAllSubInfoList(mApp.getOpPackageName(),
+ null);
}
/**
* NOTE: this method assumes permission checks are done and caller identity has been cleared.
*/
private List<SubscriptionInfo> getActiveSubscriptionInfoListPrivileged() {
- return mSubscriptionController.getActiveSubscriptionInfoList(mApp.getOpPackageName());
+ return mSubscriptionController.getActiveSubscriptionInfoList(mApp.getOpPackageName(),
+ null);
}
private final ModemActivityInfo mLastModemActivityInfo =
@@ -6042,9 +6108,10 @@
* Returns the service state information on specified subscription.
*/
@Override
- public ServiceState getServiceStateForSubscriber(int subId, String callingPackage) {
+ public ServiceState getServiceStateForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getServiceStateForSubscriber")) {
+ mApp, subId, callingPackage, callingFeatureId, "getServiceStateForSubscriber")) {
return null;
}
@@ -6052,6 +6119,7 @@
LocationAccessPolicy.checkLocationPermission(mApp,
new LocationAccessPolicy.LocationPermissionQuery.Builder()
.setCallingPackage(callingPackage)
+ .setCallingFeatureId(callingFeatureId)
.setCallingPid(Binder.getCallingPid())
.setCallingUid(Binder.getCallingUid())
.setMethod("getServiceStateForSubscriber")
@@ -6063,6 +6131,7 @@
LocationAccessPolicy.checkLocationPermission(mApp,
new LocationAccessPolicy.LocationPermissionQuery.Builder()
.setCallingPackage(callingPackage)
+ .setCallingFeatureId(callingFeatureId)
.setCallingPid(Binder.getCallingPid())
.setCallingUid(Binder.getCallingUid())
.setMethod("getServiceStateForSubscriber")
@@ -6592,9 +6661,10 @@
* @hide
*/
@Override
- public List<ClientRequestStats> getClientRequestStats(String callingPackage, int subId) {
+ public List<ClientRequestStats> getClientRequestStats(String callingPackage,
+ String callingFeatureId, int subId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getClientRequestStats")) {
+ mApp, subId, callingPackage, callingFeatureId, "getClientRequestStats")) {
return null;
}
Phone phone = getPhone(subId);
@@ -6705,14 +6775,15 @@
* Get the current modem radio state for the given slot.
* @param slotIndex slot index.
* @param callingPackage the name of the package making the call.
+ * @param callingFeatureId The feature in the package.
* @return the current radio power state from the modem
*/
@Override
- public int getRadioPowerState(int slotIndex, String callingPackage) {
+ public int getRadioPowerState(int slotIndex, String callingPackage, String callingFeatureId) {
Phone phone = PhoneFactory.getPhone(slotIndex);
if (phone != null) {
- if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, phone.getSubId(), callingPackage, "getRadioPowerState")) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp, phone.getSubId(),
+ callingPackage, callingFeatureId, "getRadioPowerState")) {
return TelephonyManager.RADIO_POWER_UNAVAILABLE;
}
@@ -7062,9 +7133,11 @@
}
@Override
- public int getNumberOfModemsWithSimultaneousDataConnections(int subId, String callingPackage) {
+ public int getNumberOfModemsWithSimultaneousDataConnections(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "getNumberOfModemsWithSimultaneousDataConnections")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "getNumberOfModemsWithSimultaneousDataConnections")) {
return -1;
}
@@ -7117,9 +7190,10 @@
@Override
public Map<Integer, List<EmergencyNumber>> getEmergencyNumberList(
- String callingPackage) {
+ String callingPackage, String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, getDefaultSubscription(), callingPackage, "getEmergencyNumberList")) {
+ mApp, getDefaultSubscription(), callingPackage, callingFeatureId,
+ "getEmergencyNumberList")) {
throw new SecurityException("Requires READ_PHONE_STATE permission.");
}
final long identity = Binder.clearCallingIdentity();
@@ -7305,12 +7379,14 @@
* Whether a modem stack is enabled or not.
*/
@Override
- public boolean isModemEnabledForSlot(int slotIndex, String callingPackage) {
+ public boolean isModemEnabledForSlot(int slotIndex, String callingPackage,
+ String callingFeatureId) {
Phone phone = PhoneFactory.getPhone(slotIndex);
if (phone == null) return false;
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, phone.getSubId(), callingPackage, "isModemEnabledForSlot")) {
+ mApp, phone.getSubId(), callingPackage, callingFeatureId,
+ "isModemEnabledForSlot")) {
throw new SecurityException("Requires READ_PHONE_STATE permission.");
}
@@ -7342,9 +7418,10 @@
@Override
@TelephonyManager.IsMultiSimSupportedResult
- public int isMultiSimSupported(String callingPackage) {
+ public int isMultiSimSupported(String callingPackage, String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(mApp,
- getDefaultPhone().getSubId(), callingPackage, "isMultiSimSupported")) {
+ getDefaultPhone().getSubId(), callingPackage, callingFeatureId,
+ "isMultiSimSupported")) {
return TelephonyManager.MULTISIM_NOT_SUPPORTED_BY_HARDWARE;
}
@@ -7445,9 +7522,11 @@
* Return value defaults to true.
*/
@Override
- public boolean doesSwitchMultiSimConfigTriggerReboot(int subId, String callingPackage) {
+ public boolean doesSwitchMultiSimConfigTriggerReboot(int subId, String callingPackage,
+ String callingFeatureId) {
if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
- mApp, subId, callingPackage, "doesSwitchMultiSimConfigTriggerReboot")) {
+ mApp, subId, callingPackage, callingFeatureId,
+ "doesSwitchMultiSimConfigTriggerReboot")) {
return false;
}
final long identity = Binder.clearCallingIdentity();