From 2ae312e30652a4d0019b17825b58d558c4483a58 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Fri, 12 Sep 2014 17:58:48 -0700 Subject: Pipe TelephonyManager.getCallState through TelecommManager * Add TelecommManager.getCallState (hidden API) * Make TelephonyManager.getCallState call through to TelecommManager, to be consistent with TelephonyManager.ACTION_PHONE_STATE_CHANGED broadcasts for overall call state. Telephony continues to manage call states for individual subscriptions. Bug: 17378767 Change-Id: Ia5e8b21df801ed3af4f6e14c110a72c92f077f88 --- telephony/java/android/telephony/TelephonyManager.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'telephony') diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 6e3325b..34b1454 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -2045,7 +2045,11 @@ public class TelephonyManager { * Returns a constant indicating the call state (cellular) on the device. */ public int getCallState() { - return getCallState(getDefaultSubscription()); + try { + return getTelecomService().getCallState(); + } catch (RemoteException | NullPointerException e) { + return CALL_STATE_IDLE; + } } /** @@ -2142,7 +2146,7 @@ public class TelephonyManager { return ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE)); } - private ITelecomService getTelecommService() { + private ITelecomService getTelecomService() { return ITelecomService.Stub.asInterface(ServiceManager.getService(Context.TELECOM_SERVICE)); } @@ -3132,7 +3136,7 @@ public class TelephonyManager { @SystemApi public void silenceRinger() { try { - getTelecommService().silenceRinger(); + getTelecomService().silenceRinger(); } catch (RemoteException e) { Log.e(TAG, "Error calling ITelecomService#silenceRinger", e); } -- cgit v1.1