From fb8d0e934da2217598d7e327635c049ba686c7de Mon Sep 17 00:00:00 2001 From: Nathan Harold Date: Fri, 10 Mar 2017 19:37:02 -0800 Subject: [PATCH] Add hidden APIs to get the cached SignalStrength from SST Add APIs in TelephonyManager to pull the SignalStrength that is currently cached in ServiceStateTracker Bug: 36133439 Test: tested with sl4a Change-Id: I6adbecb8126a715da836fcde7f832fedb2f06bc3 --- .../android/telephony/TelephonyManager.java | 21 +++++++++++++++++++ .../internal/telephony/ITelephony.aidl | 12 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 59858133a6fa0..c0f1cb114dec4 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -6428,5 +6428,26 @@ public class TelephonyManager { } return false; } + + /** + * Get the most recently available signal strength information. + * + * Get the most recent SignalStrength information reported by the modem. Due + * to power saving this information may not always be current. + * @return the most recent cached signal strength info from the modem + * @hide + */ + @Nullable + public SignalStrength getSignalStrength() { + try { + ITelephony service = getITelephony(); + if (service != null) { + return service.getSignalStrength(getSubId()); + } + } catch (RemoteException e) { + Log.e(TAG, "Error calling ITelephony#getSignalStrength", e); + } + return null; + } } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index f2e1e2691c8fc..e7cd6d8f02c24 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -31,6 +31,7 @@ import android.telephony.ModemActivityInfo; import android.telephony.NeighboringCellInfo; import android.telephony.RadioAccessFamily; import android.telephony.ServiceState; +import android.telephony.SignalStrength; import android.telephony.TelephonyHistogram; import android.telephony.VisualVoicemailSmsFilterSettings; import com.android.ims.internal.IImsServiceController; @@ -1293,4 +1294,15 @@ interface ITelephony { * @hide */ boolean getEmergencyCallbackMode(int subId); + + /** + * Get the most recently available signal strength information. + * + * Get the most recent SignalStrength information reported by the modem. Due + * to power saving this information may not always be current. + * @param subId Subscription index + * @return the most recent cached signal strength info from the modem + * @hide + */ + SignalStrength getSignalStrength(int subId); }