summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanielwbhuang <danielwbhuang@google.com>2019-11-21 23:41:19 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-11-21 23:41:19 -0800
commitc72c08fc5a09a4b8eda4e0aeac55690a57e0eab0 (patch)
tree783e3477f2bb8d5c79ee180d8b8201b7faf31e3f
parentdf582accbd21e141e58dc5f10399ea2d1f5327be (diff)
parenteb000139c18760f7b444914e88ea16737703a6e0 (diff)
downloadplatform_packages_services_AlternativeNetworkAccess-c72c08fc5a09a4b8eda4e0aeac55690a57e0eab0.tar.gz
platform_packages_services_AlternativeNetworkAccess-c72c08fc5a09a4b8eda4e0aeac55690a57e0eab0.tar.bz2
platform_packages_services_AlternativeNetworkAccess-c72c08fc5a09a4b8eda4e0aeac55690a57e0eab0.zip
DO NOT MERGE Add callback for ONS.
am: eb000139c1 Change-Id: I25db31351136cd756ed404a31b2ebebe8bccd64d
-rw-r--r--src/com/android/ons/ONSProfileSelector.java4
-rw-r--r--src/com/android/ons/OpportunisticNetworkService.java12
2 files changed, 14 insertions, 2 deletions
diff --git a/src/com/android/ons/ONSProfileSelector.java b/src/com/android/ons/ONSProfileSelector.java
index 97c588b..4bf38b9 100644
--- a/src/com/android/ons/ONSProfileSelector.java
+++ b/src/com/android/ons/ONSProfileSelector.java
@@ -686,6 +686,10 @@ public class ONSProfileSelector {
IUpdateAvailableNetworksCallback callbackStub) {
logDebug("startProfileSelection availableNetworks: " + availableNetworks);
if (availableNetworks == null || availableNetworks.size() == 0) {
+ if (callbackStub != null) {
+ sendUpdateNetworksCallbackHelper(callbackStub,
+ TelephonyManager.UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS);
+ }
return;
}
Object[] objects = new Object[]{availableNetworks, callbackStub};
diff --git a/src/com/android/ons/OpportunisticNetworkService.java b/src/com/android/ons/OpportunisticNetworkService.java
index 72c0038..e55b62c 100644
--- a/src/com/android/ons/OpportunisticNetworkService.java
+++ b/src/com/android/ons/OpportunisticNetworkService.java
@@ -428,6 +428,9 @@ public class OpportunisticNetworkService extends Service {
if (mIsEnabled) {
/* if carrier is reporting availability, then it takes higher priority. */
mProfileSelector.startProfileSelection(availableNetworks, callbackStub);
+ } else {
+ sendUpdateNetworksCallbackHelper(callbackStub,
+ TelephonyManager.UPDATE_AVAILABLE_NETWORKS_ABORTED);
}
} finally {
Binder.restoreCallingIdentity(identity);
@@ -495,8 +498,13 @@ public class OpportunisticNetworkService extends Service {
new ONSConfigInput(availableNetworks, callbackStub));
/* reporting availability. proceed if carrier app has not requested any */
- if (mIsEnabled && mONSConfigInputHashMap.get(CARRIER_APP_CONFIG_NAME) == null) {
- mProfileSelector.startProfileSelection(availableNetworks, callbackStub);
+ if (mIsEnabled) {
+ if (mONSConfigInputHashMap.get(CARRIER_APP_CONFIG_NAME) == null) {
+ mProfileSelector.startProfileSelection(availableNetworks, callbackStub);
+ }
+ } else {
+ sendUpdateNetworksCallbackHelper(callbackStub,
+ TelephonyManager.UPDATE_AVAILABLE_NETWORKS_ABORTED);
}
} else {
if (!mIsEnabled) {