Added getServiceState API to TelephonyManager.
Added the new API getServiceState to TelephonyManager so
the client can directly retrieve the service state without
being a phone state listener or broadcast receiver.
bug: 21207640
Change-Id: I54b6c9f4cd52794ce598fa113e073773f2552b81
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 64da1a5..d152e22 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -80,12 +80,9 @@
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Objects;
/**
* Implementation of the ITelephony interface.
@@ -2888,4 +2885,23 @@
public ModemActivityInfo getModemActivityInfo() {
return (ModemActivityInfo) sendRequest(CMD_GET_MODEM_ACTIVITY_INFO, null);
}
+
+ /**
+ * {@hide}
+ * Returns the service state information on specified subscription.
+ */
+ @Override
+ public ServiceState getServiceStateForSubscriber(int subId, String callingPackage) {
+
+ if (!canReadPhoneState(callingPackage, "getServiceStateForSubscriber")) {
+ return null;
+ }
+
+ final Phone phone = getPhone(subId);
+ if (phone == null) {
+ return null;
+ }
+
+ return phone.getServiceState();
+ }
}