From 35eed634243228244cdd755fad23b47cac2c9e1d Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Fri, 8 Nov 2019 09:32:17 -0800 Subject: [PATCH 1/3] Improved debug message Printed out polygon information Test: Manual Merged-In: I5b78d4494418f07dd0a4340c7ef4bd1e499af536 Change-Id: I5b78d4494418f07dd0a4340c7ef4bd1e499af536 (cherry picked from commit 3b6b57b6853af6e4965b8d267cf49bf0ec284aba) --- .../java/android/telephony/CbGeoUtils.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/telephony/java/android/telephony/CbGeoUtils.java b/telephony/java/android/telephony/CbGeoUtils.java index f4ce6e75769ce..ce5e3f38e78b4 100644 --- a/telephony/java/android/telephony/CbGeoUtils.java +++ b/telephony/java/android/telephony/CbGeoUtils.java @@ -18,6 +18,7 @@ package android.telephony; import android.annotation.NonNull; import android.annotation.SystemApi; +import android.os.Build; import android.text.TextUtils; import java.util.ArrayList; @@ -257,6 +258,15 @@ public class CbGeoUtils { return new Point(x - p.x, y - p.y); } } + + @Override + public String toString() { + String str = "Polygon: "; + if (Build.IS_DEBUGGABLE) { + str += mVertices; + } + return str; + } } /** @@ -284,6 +294,16 @@ public class CbGeoUtils { public boolean contains(LatLng p) { return mCenter.distance(p) <= mRadiusMeter; } + + @Override + public String toString() { + String str = "Circle: "; + if (Build.IS_DEBUGGABLE) { + str += mCenter + ", radius = " + mRadiusMeter; + } + + return str; + } } /** From 45811ecc855285222f607f4284696c89669c2432 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Thu, 21 Nov 2019 20:10:15 -0800 Subject: [PATCH 2/3] Code clean up Remove database version 1~11 support since the format hasn't changed in the past 7 years. Bug: 135956699 Test: Manual Merged-In: I367124471f16073bb47a31c094d161d36969acc1 Change-Id: I367124471f16073bb47a31c094d161d36969acc1 (cherry picked from commit 21effc8643d93f6859914a951ad96ebb6cb3aa58) --- core/java/android/provider/Telephony.java | 14 -------------- telephony/java/android/telephony/SmsCbMessage.java | 3 ++- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index 8a3d79c2eb31e..b28cdf1dcb9b0 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -4118,20 +4118,6 @@ public final class Telephony { */ public static final String CID = "cid"; - /** - * Message code. OBSOLETE: merged into SERIAL_NUMBER. - *

Type: INTEGER

- * @hide - */ - public static final String V1_MESSAGE_CODE = "message_code"; - - /** - * Message identifier. OBSOLETE: renamed to SERVICE_CATEGORY. - *

Type: INTEGER

- * @hide - */ - public static final String V1_MESSAGE_IDENTIFIER = "message_id"; - /** * Service category which represents the general topic of the message. *

diff --git a/telephony/java/android/telephony/SmsCbMessage.java b/telephony/java/android/telephony/SmsCbMessage.java index c7f952954d5ff..045d1ebb56404 100644 --- a/telephony/java/android/telephony/SmsCbMessage.java +++ b/telephony/java/android/telephony/SmsCbMessage.java @@ -533,7 +533,8 @@ public final class SmsCbMessage implements Parcelable { + ", priority=" + mPriority + (mEtwsWarningInfo != null ? (", " + mEtwsWarningInfo.toString()) : "") + (mCmasWarningInfo != null ? (", " + mCmasWarningInfo.toString()) : "") - + ", maximumWaitingTime = " + mMaximumWaitTimeSec + + ", maximumWaitingTime=" + mMaximumWaitTimeSec + + ", received time=" + mReceivedTimeMillis + ", slotIndex = " + mSlotIndex + ", geo=" + (mGeometries != null ? CbGeoUtils.encodeGeometriesToString(mGeometries) : "null") From 5def2c6004ad7855de6258c14917b68e46cde676 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Fri, 8 Nov 2019 09:56:02 -0800 Subject: [PATCH 3/3] Throw illegal argument exception when slot index is invalid Test: Manual Bug: 144097779 Merged-In: I5c5c4eb313fd42317a2b0feed0946b8e4003ad62 Change-Id: I5c5c4eb313fd42317a2b0feed0946b8e4003ad62 (cherry picked from commit 0d75aee571eb6a7048a618af894c41a24e8e5cbd) --- telephony/java/android/telephony/TelephonyManager.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 58f1e8407d13a..7232ea7141800 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -2367,6 +2367,8 @@ public class TelephonyManager { * * @return the lowercase 2 character ISO-3166 country code, or empty string if not available. * + * @throws IllegalArgumentException when the slotIndex is invalid. + * * {@hide} */ @SystemApi @@ -2374,6 +2376,10 @@ public class TelephonyManager { @NonNull public String getNetworkCountryIso(int slotIndex) { try { + if (!SubscriptionManager.isValidSlotIndex(slotIndex)) { + throw new IllegalArgumentException("invalid slot index " + slotIndex); + } + ITelephony telephony = getITelephony(); if (telephony == null) return ""; return telephony.getNetworkCountryIsoForPhone(slotIndex);