Merge "Send error if ONS is not available" into qt-r1-dev

am: b5bf60eb09

Change-Id: Ifb13364e194a178612d74314424904eb8eeee01e
This commit is contained in:
Sooraj Sasindran
2019-07-10 16:14:33 -07:00
committed by android-build-merger

View File

@@ -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 =