diff options
| author | 2019-12-30 09:28:31 +0000 | |
|---|---|---|
| committer | 2019-12-30 09:28:31 +0000 | |
| commit | 70c19b40238d024dce9d615d9e48e2d3ecc0b501 (patch) | |
| tree | 068efc6e3c729254988dc9a0796c86e599f02098 | |
| parent | 955b3c5a4d025cccf18969284fdf83ebc1310074 (diff) | |
| parent | af15476935fb1fc7c639a9478203c8f31cb09535 (diff) | |
Merge "[Telephony Mainline] Add new api for Mvno matching"
| -rwxr-xr-x | api/system-current.txt | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 32 | ||||
| -rw-r--r-- | telephony/java/com/android/internal/telephony/ITelephony.aidl | 2 |
3 files changed, 35 insertions, 0 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 437238dcd15b..e056419a0ab8 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -10020,6 +10020,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isAnyRadioPoweredOn(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApnMetered(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApplicationOnUicc(int); + method public boolean isCurrentSimOperator(@NonNull String, int, @Nullable String); method public boolean isDataConnectivityPossible(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataEnabledForApn(int); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isEmergencyAssistanceEnabled(); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 39e57b775a8d..0f95325efbd3 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -74,6 +74,7 @@ import android.telephony.Annotation.NetworkType; import android.telephony.Annotation.RadioPowerState; import android.telephony.Annotation.SimActivationState; import android.telephony.VisualVoicemailService.VisualVoicemailTask; +import android.telephony.data.ApnSetting.MvnoType; import android.telephony.emergency.EmergencyNumber; import android.telephony.emergency.EmergencyNumber.EmergencyServiceCategories; import android.telephony.ims.ImsMmTelManager; @@ -11918,6 +11919,37 @@ public class TelephonyManager { } /** + * Verifies whether the input MCC/MNC and MVNO correspond to the current carrier. + * + * @param mccmnc the carrier's mccmnc that you want to match + * @param mvnoType the mvnoType that defined in {@link ApnSetting} + * @param mvnoMatchData the MVNO match data + * @return {@code true} if input mccmnc and mvno matches with data from sim operator. + * {@code false} otherwise. + * + * {@hide} + */ + @SystemApi + public boolean isCurrentSimOperator(@NonNull String mccmnc, @MvnoType int mvnoType, + @Nullable String mvnoMatchData) { + try { + if (!mccmnc.equals(getSimOperator())) { + Log.d(TAG, "The mccmnc does not match"); + return false; + } + ITelephony service = getITelephony(); + if (service != null) { + return service.isMvnoMatched(getSubId(), mvnoType, mvnoMatchData); + } + } catch (RemoteException ex) { + if (!isSystemProcess()) { + ex.rethrowAsRuntimeException(); + } + } + return false; + } + + /** * Set allowing mobile data during voice call. * * @param allow {@code true} if allowing using data during voice call, {@code false} if diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index b99fe904bbe8..57fda9b1e3e4 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -2124,6 +2124,8 @@ interface ITelephony { boolean isApnMetered(int apnType, int subId); + boolean isMvnoMatched(int subId, int mvnoType, String mvnoMatchData); + /** * Enqueue a pending sms Consumer, which will answer with the user specified selection for an * outgoing SmsManager operation. |