From bf68dc85a45c7c62fafe86aee5a48a1add121924 Mon Sep 17 00:00:00 2001 From: Jordan Liu Date: Wed, 20 Nov 2019 13:55:18 -0800 Subject: [PATCH] Expose some SystemApis and edit framework-cellbroadcast-shared-srcs The APIs are used in the CellBroadcastService, and the framework-cellbroadcast-shared-srcs library is also linked there. Bug: 135956699 Test: manual Change-Id: I5e71ea1ee1a858c0520c241dc7365733441e0f50 Merged-In: I5e71ea1ee1a858c0520c241dc7365733441e0f50 --- Android.bp | 9 ++++++--- api/system-current.txt | 1 + .../java/android/telephony/SmsCbMessage.java | 15 ++++++++++----- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Android.bp b/Android.bp index 100f70d0f2dde..2c874c270d82d 100644 --- a/Android.bp +++ b/Android.bp @@ -1578,10 +1578,13 @@ genrule { filegroup { name: "framework-cellbroadcast-shared-srcs", srcs: [ - "core/java/android/util/LocalLog.java", + "core/java/android/os/HandlerExecutor.java", + "core/java/android/util/LocalLog.java", "core/java/android/util/Slog.java", - "core/java/com/android/internal/util/State.java", - "core/java/com/android/internal/util/StateMachine.java", + "core/java/com/android/internal/util/IState.java", + "core/java/com/android/internal/util/Preconditions.java", + "core/java/com/android/internal/util/State.java", + "core/java/com/android/internal/util/StateMachine.java", ], } diff --git a/api/system-current.txt b/api/system-current.txt index 9f8af7f768bcb..8185252ead19c 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -8538,6 +8538,7 @@ package android.telephony { method @NonNull public android.content.ContentValues getContentValues(); method @Nullable public android.telephony.SmsCbEtwsInfo getEtwsWarningInfo(); method public int getGeographicalScope(); + method @NonNull public java.util.List getGeometries(); method @Nullable public String getLanguageCode(); method @NonNull public android.telephony.SmsCbLocation getLocation(); method public int getMaximumWaitingDuration(); diff --git a/telephony/java/android/telephony/SmsCbMessage.java b/telephony/java/android/telephony/SmsCbMessage.java index fad70d2da8beb..c7f952954d5ff 100644 --- a/telephony/java/android/telephony/SmsCbMessage.java +++ b/telephony/java/android/telephony/SmsCbMessage.java @@ -29,6 +29,7 @@ import android.telephony.CbGeoUtils.Geometry; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.util.ArrayList; import java.util.List; /** @@ -407,13 +408,17 @@ public final class SmsCbMessage implements Parcelable { } /** - * Get the warning area coordinates information represent by polygons and circles. - * @return a list of geometries, {@link Nullable} means there is no coordinate information - * associated to this message. + * Get the warning area coordinates information represented by polygons and circles. + * @return a list of geometries, or an empty list if there is no coordinate information + * associated with this message. * @hide */ - @Nullable + @SystemApi + @NonNull public List getGeometries() { + if (mGeometries == null) { + return new ArrayList<>(); + } return mGeometries; } @@ -720,6 +725,6 @@ public final class SmsCbMessage implements Parcelable { * @return {@code True} if this message needs geo-fencing check. */ public boolean needGeoFencingCheck() { - return mMaximumWaitTimeSec > 0 && mGeometries != null; + return mMaximumWaitTimeSec > 0 && mGeometries != null && !mGeometries.isEmpty(); } }