From 1365703d4964466472904dc84117a0946d9e1a44 Mon Sep 17 00:00:00 2001 From: Junda Liu Date: Wed, 2 Jul 2014 12:52:04 -0700 Subject: [PATCH] Add calculatePreferredNetworkType to TelephonyManager. Bug: b/14134668 Change-Id: Iba7dcd50c1ba84b634eed53030456a2f84af6e3c --- .../android/telephony/TelephonyManager.java | 19 +++++++++++++++++++ .../internal/telephony/ITelephony.aidl | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 0e5b0e6114e1e..11f3309556508 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -2755,6 +2755,25 @@ public class TelephonyManager { } } + /** + * Get the calculated preferred network type. + * Used for debugging incorrect network type. + * + * @return the preferred network type, defined in RILConstants.java or -1 if + * none available. + * @hide + */ + public int getCalculatedPreferredNetworkType() { + try { + return getITelephony().getCalculatedPreferredNetworkType(); + } catch (RemoteException ex) { + Rlog.e(TAG, "getCalculatedPreferredNetworkType RemoteException", ex); + } catch (NullPointerException ex) { + Rlog.e(TAG, "getCalculatedPreferredNetworkType NPE", ex); + } + return -1; + } + /** * Get the preferred network type. * Used for device configuration by some CDMA operators. diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 237e7f3d342fc..09c999b5f165a 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -588,6 +588,14 @@ interface ITelephony { */ boolean nvResetConfig(int resetType); + /* + * Get the calculated preferred network type. + * Used for device configuration by some CDMA operators. + * + * @return the calculated preferred network type, defined in RILConstants.java. + */ + int getCalculatedPreferredNetworkType(); + /* * Get the preferred network type. * Used for device configuration by some CDMA operators.