Refactor TelephonyPermission Method in AlternativeNetworkAccess
Test: manual
Bug: 145688189
Change-Id: Iad7c297a6039c60b0cdc5cd367cfd9daedbbee8e
diff --git a/src/com/android/ons/OpportunisticNetworkService.java b/src/com/android/ons/OpportunisticNetworkService.java
index b4a3b8f..a64ffca 100644
--- a/src/com/android/ons/OpportunisticNetworkService.java
+++ b/src/com/android/ons/OpportunisticNetworkService.java
@@ -229,10 +229,10 @@
ISetOpportunisticDataCallback callbackStub, String callingPackage) {
logDebug("setPreferredDataSubscriptionId subId:" + subId + "callingPackage: " + callingPackage);
if (!enforceModifyPhoneStatePermission(mContext)) {
- TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(
+ TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(mContext,
mSubscriptionManager.getDefaultSubscriptionId(), "setPreferredDataSubscriptionId");
if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
- TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(subId,
+ TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(mContext, subId,
"setPreferredDataSubscriptionId");
}
} else {
@@ -305,7 +305,7 @@
(ArrayList<AvailableNetworkInfo>) availableNetworks, callbackStub);
} else {
/* check if the app has primary carrier permission */
- TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(
+ TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(mContext,
mSubscriptionManager.getDefaultSubscriptionId(), "updateAvailableNetworks");
handleCarrierAppAvailableNetworks(
(ArrayList<AvailableNetworkInfo>) availableNetworks, callbackStub,
@@ -409,7 +409,7 @@
Binder.restoreCallingIdentity(identity);
}
if (isActiveSubId) {
- TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(
+ TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege(mContext,
availableNetworkInfo.getSubId(), "updateAvailableNetworks");
} else {
/* check if the app has opportunistic carrier permission */