diff options
| -rw-r--r-- | src/com/android/ons/ONSProfileSelector.java | 5 | ||||
| -rw-r--r-- | src/com/android/ons/OpportunisticNetworkService.java | 24 |
2 files changed, 19 insertions, 10 deletions
diff --git a/src/com/android/ons/ONSProfileSelector.java b/src/com/android/ons/ONSProfileSelector.java index 127c8cb..04fd3dd 100644 --- a/src/com/android/ons/ONSProfileSelector.java +++ b/src/com/android/ons/ONSProfileSelector.java @@ -323,7 +323,9 @@ public class ONSProfileSelector { int subId = intent.getIntExtra("subId", SubscriptionManager.INVALID_SUBSCRIPTION_ID); logDebug("ACTION_SUB_SWITCH sequenceId: " + sequenceId - + " mSequenceId: " + mSequenceId); + + " mSequenceId: " + mSequenceId + + " mSubId: " + mSubId + + " subId: " + subId); Message message = Message.obtain(mHandler, MSG_SUB_SWITCH_COMPLETE, subId); message.sendToTarget(); } @@ -590,6 +592,7 @@ public class ONSProfileSelector { int phoneId = SubscriptionManager.getPhoneId(subId); if (mSubscriptionBoundTelephonyManager.isModemEnabledForSlot(phoneId) == enable) { + logDebug("modem is already enabled "); return true; } diff --git a/src/com/android/ons/OpportunisticNetworkService.java b/src/com/android/ons/OpportunisticNetworkService.java index f23b488..91a17b2 100644 --- a/src/com/android/ons/OpportunisticNetworkService.java +++ b/src/com/android/ons/OpportunisticNetworkService.java @@ -383,17 +383,23 @@ public class OpportunisticNetworkService extends Service { TelephonyManager.UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS); return; } - TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege( - availableNetworks.get(0).getSubId(), "updateAvailableNetworks"); - /* check if the app has opportunistic carrier permission */ - if (!hasOpportunisticSubPrivilege(callingPackage, - availableNetworks.get(0).getSubId())) { - log("No carrier privelege for opportunistic subscription"); - sendUpdateNetworksCallbackHelper(callbackStub, - TelephonyManager.UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE); - return; + for (AvailableNetworkInfo availableNetworkInfo : availableNetworks) { + if (mSubscriptionManager.isActiveSubId(availableNetworkInfo.getSubId())) { + TelephonyPermissions.enforceCallingOrSelfCarrierPrivilege( + availableNetworkInfo.getSubId(), "updateAvailableNetworks"); + } else { + /* check if the app has opportunistic carrier permission */ + if (!hasOpportunisticSubPrivilege(callingPackage, + availableNetworkInfo.getSubId())) { + log("No carrier privilege for opportunistic subscription"); + sendUpdateNetworksCallbackHelper(callbackStub, + TelephonyManager.UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE); + return; + } + } } + final long identity = Binder.clearCallingIdentity(); try { ONSConfigInput onsConfigInput = new ONSConfigInput(availableNetworks, callbackStub); |
