Fix permission checking for IsDataRoamingEnabled
Per documentation, it should work with any of the following permission:
1) ACCESS_NETWORK_STATE
2) READ_PHONE_STATE
3) Carrier Privilege
Test: cts
Bug: 141865257
Change-Id: I20ca6ccf41e2b5658e71da6201f1c8faeb5b05e2
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 576e14c..f37420a 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -7520,17 +7520,19 @@
*/
@Override
public boolean isDataRoamingEnabled(int subId) {
- mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
- null /* message */);
+ try {
+ mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
+ null);
+ } catch (Exception e) {
+ TelephonyPermissions.enforeceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege(
+ mApp, subId, "isDataRoamingEnabled");
+ }
boolean isEnabled = false;
final long identity = Binder.clearCallingIdentity();
try {
Phone phone = getPhone(subId);
isEnabled = phone != null ? phone.getDataRoamingEnabled() : false;
- } catch (Exception e) {
- TelephonyPermissions.enforeceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege(
- mApp, subId, "isDataRoamingEnabled");
} finally {
Binder.restoreCallingIdentity(identity);
}