Revert "Revert "refactor radioPowerState""
This reverts commit 1bc99faa1a0e908a03fd09abb32c0e003ee5ad00.
Reason for revert: <INSERT REASONING HERE>
Change-Id: I86525a72cfd83eda4d5f282aac0a84a2f18bfe09
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index f2bc7d3..37090ba 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -4934,6 +4934,31 @@
}
/**
+ * Get the current modem radio state for the given slot.
+ * @param slotIndex slot index.
+ * @param callingPackage the name of the package making the call.
+ * @return the current radio power state from the modem
+ */
+ @Override
+ public int getRadioPowerState(int slotIndex, String callingPackage) {
+ Phone phone = PhoneFactory.getPhone(slotIndex);
+ if (phone != null) {
+ if (!TelephonyPermissions.checkCallingOrSelfReadPhoneState(
+ mApp, phone.getSubId(), callingPackage, "getRadioPowerState")) {
+ return TelephonyManager.RADIO_POWER_UNAVAILABLE;
+ }
+
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ return phone.getRadioPowerState();
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
+ }
+ return TelephonyManager.RADIO_POWER_UNAVAILABLE;
+ }
+
+ /**
* Checks if data roaming is enabled on the subscription with id {@code subId}.
*
* <p>Requires one of the following permissions: