Add support for setSystemSelectionChannels
Create API plumbing for setSystemSelectionChannels.
Also update testapps to handle calling the method through the testapp.
Bug: 144595103
Test: manual, atest TelephonyManagerTest
Change-Id: I2dcffb3e5100cb4bfac23e82c9b26fa42c2d5c31
Merged-In: I2dcffb3e5100cb4bfac23e82c9b26fa42c2d5c31
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 009ea43..a4616e9 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -131,6 +131,7 @@
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.DefaultPhoneNotifier;
import com.android.internal.telephony.HalVersion;
+import com.android.internal.telephony.IBooleanConsumer;
import com.android.internal.telephony.IIntegerConsumer;
import com.android.internal.telephony.INumberVerificationCallback;
import com.android.internal.telephony.ITelephony;
@@ -189,6 +190,7 @@
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
+import java.util.function.Consumer;
/**
* Implementation of the ITelephony interface.
@@ -274,6 +276,8 @@
private static final int EVENT_CHANGE_ICC_LOCK_PASSWORD_DONE = 77;
private static final int CMD_SET_ICC_LOCK_ENABLED = 78;
private static final int EVENT_SET_ICC_LOCK_ENABLED_DONE = 79;
+ private static final int CMD_SET_SYSTEM_SELECTION_CHANNELS = 80;
+ private static final int EVENT_SET_SYSTEM_SELECTION_CHANNELS_DONE = 81;
private static final int CMD_GET_CALL_FORWARDING = 83;
private static final int EVENT_GET_CALL_FORWARDING_DONE = 84;
private static final int CMD_SET_CALL_FORWARDING = 85;
@@ -1336,6 +1340,23 @@
}
notifyRequester(request);
break;
+ case CMD_SET_SYSTEM_SELECTION_CHANNELS: {
+ request = (MainThreadRequest) msg.obj;
+ onCompleted = obtainMessage(EVENT_SET_SYSTEM_SELECTION_CHANNELS_DONE, request);
+ Pair<List<RadioAccessSpecifier>, Consumer<Boolean>> args =
+ (Pair<List<RadioAccessSpecifier>, Consumer<Boolean>>) request.argument;
+ request.phone.setSystemSelectionChannels(args.first, onCompleted);
+ break;
+ }
+ case EVENT_SET_SYSTEM_SELECTION_CHANNELS_DONE: {
+ ar = (AsyncResult) msg.obj;
+ request = (MainThreadRequest) ar.userObj;
+ Pair<List<RadioAccessSpecifier>, Consumer<Boolean>> args =
+ (Pair<List<RadioAccessSpecifier>, Consumer<Boolean>>) request.argument;
+ args.second.accept(ar.exception == null);
+ notifyRequester(request);
+ break;
+ }
case EVENT_SET_FORBIDDEN_PLMNS_DONE:
ar = (AsyncResult) msg.obj;
request = (MainThreadRequest) ar.userObj;
@@ -8158,6 +8179,39 @@
}
@Override
+ public void setSystemSelectionChannels(List<RadioAccessSpecifier> specifiers,
+ int subscriptionId, IBooleanConsumer resultCallback) {
+ enforceModifyPermission();
+ long token = Binder.clearCallingIdentity();
+ try {
+ Phone phone = getPhone(subscriptionId);
+ if (phone == null) {
+ try {
+ if (resultCallback != null) {
+ resultCallback.accept(false);
+ }
+ } catch (RemoteException e) {
+ // ignore
+ }
+ return;
+ }
+ Pair<List<RadioAccessSpecifier>, Consumer<Boolean>> argument =
+ Pair.create(specifiers, (x) -> {
+ try {
+ if (resultCallback != null) {
+ resultCallback.accept(x);
+ }
+ } catch (RemoteException e) {
+ // ignore
+ }
+ });
+ sendRequestAsync(CMD_SET_SYSTEM_SELECTION_CHANNELS, argument, phone, null);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ }
+
+ @Override
public boolean isMvnoMatched(int subId, int mvnoType, @NonNull String mvnoMatchData) {
IccRecords iccRecords = UiccController.getInstance().getIccRecords(
SubscriptionManager.getPhoneId(subId), UiccController.APP_FAM_3GPP);