Enforce permission check before identity clear
Bug: 129679835
Test: build
Change-Id: Ie393db9d7ebfce809eb2d3c79398f611f02938c3
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 0ecafa1..a1cc3ee 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -6154,11 +6154,12 @@
*/
@Override
public boolean isDataRoamingEnabled(int subId) {
+ mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
+ null /* message */);
+
boolean isEnabled = false;
final long identity = Binder.clearCallingIdentity();
try {
- mApp.enforceCallingOrSelfPermission(android.Manifest.permission.ACCESS_NETWORK_STATE,
- null /* message */);
Phone phone = getPhone(subId);
isEnabled = phone != null ? phone.getDataRoamingEnabled() : false;
} catch (Exception e) {
@@ -6183,11 +6184,11 @@
*/
@Override
public void setDataRoamingEnabled(int subId, boolean isEnabled) {
+ TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
+ mApp, subId, "setDataRoamingEnabled");
+
final long identity = Binder.clearCallingIdentity();
try {
- TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
- mApp, subId, "setDataRoamingEnabled");
-
Phone phone = getPhone(subId);
if (phone != null) {
phone.setDataRoamingEnabled(isEnabled);
@@ -6199,11 +6200,12 @@
@Override
public boolean isManualNetworkSelectionAllowed(int subId) {
+ TelephonyPermissions.enforeceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege(
+ mApp, subId, "isManualNetworkSelectionAllowed");
+
boolean isAllowed = true;
final long identity = Binder.clearCallingIdentity();
try {
- TelephonyPermissions.enforeceCallingOrSelfReadPhoneStatePermissionOrCarrierPrivilege(
- mApp, subId, "isManualNetworkSelectionAllowed");
Phone phone = getPhone(subId);
if (phone != null) {
isAllowed = phone.isCspPlmnEnabled();