Apply radio ON/OFF commands to all Phones
Bug: 275026938
Test: SMS, MMS, call with live network.
atest android.telephony.cts.TelephonyManagerTest
Change-Id: Ib2a1992ff23d3f917afb85c6d3e330d5c9f7c21b
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 469740c..796369a 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -3021,14 +3021,15 @@
+ ",reason=" + reason + ",callingPackage=" + getCurrentPackageName());
final long identity = Binder.clearCallingIdentity();
try {
- final Phone phone = getPhoneFromSubIdOrDefault(subId);
- if (phone != null) {
+ boolean result = false;
+ for (Phone phone : PhoneFactory.getPhones()) {
+ result = true;
phone.setRadioPowerForReason(false, reason);
- return true;
- } else {
- loge("requestRadioPowerOffForReason: phone is null");
- return false;
}
+ if (!result) {
+ loge("requestRadioPowerOffForReason: no phone exists");
+ }
+ return result;
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3048,14 +3049,15 @@
final long identity = Binder.clearCallingIdentity();
try {
- final Phone phone = getPhoneFromSubIdOrDefault(subId);
- if (phone != null) {
+ boolean result = false;
+ for (Phone phone : PhoneFactory.getPhones()) {
+ result = true;
phone.setRadioPowerForReason(true, reason);
- return true;
- } else {
- loge("clearRadioPowerOffForReason: phone is null");
- return false;
}
+ if (!result) {
+ loge("clearRadioPowerOffForReason: no phone exists");
+ }
+ return result;
} finally {
Binder.restoreCallingIdentity(identity);
}