diff options
author | Santos Cordon <santoscordon@google.com> | 2015-06-09 14:57:07 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2015-06-10 11:42:27 -0700 |
commit | 8c332b727523ce0dbb9256f0f43a9c655d71a3ea (patch) | |
tree | 40a2a2e46779e3c3ab4c2c79e7acf590f14a2e49 /telephony/java/android | |
parent | cc87cfa29c4b38d1f119bdce652918565b0fed0f (diff) | |
download | frameworks_base-8c332b727523ce0dbb9256f0f43a9c655d71a3ea.zip frameworks_base-8c332b727523ce0dbb9256f0f43a9c655d71a3ea.tar.gz frameworks_base-8c332b727523ce0dbb9256f0f43a9c655d71a3ea.tar.bz2 |
TelephonyManager should use TelecomManager's getCallState().
Telecom's version includes non-cellular calls in its result. Many apps
compile against TelephonyManager's existing API so we should update it
to use telecom instead.
We kept the implementation as cellular-only for
getCallState[ForSubscription](...) version of the API (which is hidden
anyway).
Bug: 21732997
Change-Id: Ifd27e6b49d76fe96ccc969e5262b1a876670aeef
Diffstat (limited to 'telephony/java/android')
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 12f1644..393888d 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -193,7 +193,7 @@ public class TelephonyManager { // /** - * Broadcast intent action indicating that the call state (cellular) + * Broadcast intent action indicating that the call state * on the device has changed. * * <p> @@ -2437,10 +2437,23 @@ public class TelephonyManager { public static final int CALL_STATE_OFFHOOK = 2; /** - * Returns a constant indicating the call state (cellular) on the device. + * Returns one of the following constants that represents the current state of all + * phone calls. + * + * {@link TelephonyManager#CALL_STATE_RINGING} + * {@link TelephonyManager#CALL_STATE_OFFHOOK} + * {@link TelephonyManager#CALL_STATE_IDLE} */ public int getCallState() { - return getCallState(getDefaultSubscription()); + try { + ITelecomService telecom = getTelecomService(); + if (telecom != null) { + return telecom.getCallState(); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelecomService#getCallState", e); + } + return CALL_STATE_IDLE; } /** |