diff options
| author | 2019-07-10 16:52:49 -0700 | |
|---|---|---|
| committer | 2019-07-10 16:52:49 -0700 | |
| commit | 413b92a6a61352e828132645245f39b05f61dc17 (patch) | |
| tree | d8081bf22e53d2e1f6aaced20c6112d972e1055d | |
| parent | af49210c3451e1722baf3787d64673240a644c79 (diff) | |
| parent | 8a7ebca21bdd9f94bb73e6c1d3427aedaa443d76 (diff) | |
Merge "Send error if ONS is not available" into qt-r1-dev am: b5bf60eb09
am: 8a7ebca21b
Change-Id: I4f64cc383423f435d26d97d215fa2d72c1e463e6
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 22a8232d1a0b..ed70a81e01d6 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -10834,7 +10834,6 @@ public class TelephonyManager { * @param callback Callback will be triggered once it succeeds or failed. * See {@link TelephonyManager.SetOpportunisticSubscriptionResult} * for more details. Pass null if don't care about the result. - * */ public void setPreferredOpportunisticDataSubscription(int subId, boolean needValidation, @Nullable @CallbackExecutor Executor executor, @Nullable Consumer<Integer> callback) { @@ -10842,6 +10841,12 @@ public class TelephonyManager { try { IOns iOpportunisticNetworkService = getIOns(); if (iOpportunisticNetworkService == null) { + if (executor == null || callback == null) { + return; + } + Binder.withCleanCallingIdentity(() -> executor.execute(() -> { + callback.accept(SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION); + })); return; } ISetOpportunisticDataCallback callbackStub = new ISetOpportunisticDataCallback.Stub() { @@ -10923,9 +10928,16 @@ public class TelephonyManager { if (executor == null || callback == null) { return; } - Binder.withCleanCallingIdentity(() -> executor.execute(() -> { - callback.accept(UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS); - })); + if (iOpportunisticNetworkService == null) { + /* Todo<b/130595455> passing unknown due to lack of good error codes */ + Binder.withCleanCallingIdentity(() -> executor.execute(() -> { + callback.accept(UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE); + })); + } else { + Binder.withCleanCallingIdentity(() -> executor.execute(() -> { + callback.accept(UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS); + })); + } return; } IUpdateAvailableNetworksCallback callbackStub = |