From 087568092a2f5e1dd5de4ee535537a3409ceb360 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Thu, 19 Dec 2019 14:13:43 -0800 Subject: [PATCH 1/2] Renamed SUB_ID to SUBSCRIPTION_ID In order to be consistent with other existing APIs. Test: Build Bug: 146563563 Merged-In: Iac8d9abe3b011485ffe8220d94f25f99d022014b Change-Id: Iac8d9abe3b011485ffe8220d94f25f99d022014b (cherry picked from commit e94a7a4f976513c8711d405ced236f22cb551efd) --- api/system-current.txt | 2 +- api/test-current.txt | 2 +- core/java/android/provider/Telephony.java | 4 ++-- telephony/java/android/telephony/SmsCbMessage.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index a0a6dc413a29f..bdbbb58c5e3cf 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -7220,7 +7220,7 @@ package android.provider { field public static final String SERIAL_NUMBER = "serial_number"; field public static final String SERVICE_CATEGORY = "service_category"; field public static final String SLOT_INDEX = "slot_index"; - field public static final String SUB_ID = "sub_id"; + field public static final String SUBSCRIPTION_ID = "sub_id"; } public static final class Telephony.CellBroadcasts.Preference { diff --git a/api/test-current.txt b/api/test-current.txt index 6b3b3a8b15ea2..8cfab2cea1bd3 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -2580,7 +2580,7 @@ package android.provider { field public static final String SERIAL_NUMBER = "serial_number"; field public static final String SERVICE_CATEGORY = "service_category"; field public static final String SLOT_INDEX = "slot_index"; - field public static final String SUB_ID = "sub_id"; + field public static final String SUBSCRIPTION_ID = "sub_id"; } public static final class Telephony.Sms.Intents { diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index c2b0ace7019a9..a897a8e4994a3 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -4166,7 +4166,7 @@ public final class Telephony { * The subscription which received this cell broadcast message. *

Type: INTEGER

*/ - public static final String SUB_ID = "sub_id"; + public static final String SUBSCRIPTION_ID = "sub_id"; /** * The slot which received this cell broadcast message. @@ -4447,7 +4447,7 @@ public final class Telephony { public static final String[] QUERY_COLUMNS_FWK = { _ID, SLOT_INDEX, - SUB_ID, + SUBSCRIPTION_ID, GEOGRAPHICAL_SCOPE, PLMN, LAC, diff --git a/telephony/java/android/telephony/SmsCbMessage.java b/telephony/java/android/telephony/SmsCbMessage.java index 09e87c022d39d..c0dfec9a11728 100644 --- a/telephony/java/android/telephony/SmsCbMessage.java +++ b/telephony/java/android/telephony/SmsCbMessage.java @@ -572,7 +572,7 @@ public final class SmsCbMessage implements Parcelable { public ContentValues getContentValues() { ContentValues cv = new ContentValues(16); cv.put(CellBroadcasts.SLOT_INDEX, mSlotIndex); - cv.put(CellBroadcasts.SUB_ID, mSubId); + cv.put(CellBroadcasts.SUBSCRIPTION_ID, mSubId); cv.put(CellBroadcasts.GEOGRAPHICAL_SCOPE, mGeographicalScope); if (mLocation.getPlmn() != null) { cv.put(CellBroadcasts.PLMN, mLocation.getPlmn()); @@ -636,7 +636,7 @@ public final class SmsCbMessage implements Parcelable { int format = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.MESSAGE_FORMAT)); int priority = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.MESSAGE_PRIORITY)); int slotIndex = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.SLOT_INDEX)); - int subId = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.SUB_ID)); + int subId = cursor.getInt(cursor.getColumnIndexOrThrow(CellBroadcasts.SUBSCRIPTION_ID)); String plmn; int plmnColumn = cursor.getColumnIndex(CellBroadcasts.PLMN); From d588c33c71ecbdbc3e40453166b4629d83317567 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Thu, 23 Jan 2020 23:01:40 -0800 Subject: [PATCH 2/2] Added area info support in cell broadcast service Added a broadcast for area info changed event, and also a get method in cell broadcast service to retrieve the area info. Test: Cell broadcast sanity tests Bug: 141318859 Merged-In: I5995e3c5099a1e49cb0c54d33da1dbfcc94d4037 Change-Id: I5995e3c5099a1e49cb0c54d33da1dbfcc94d4037 (cherry picked from commit afaa71d418ac054136d9cd1db0084997e53fbaba) --- api/system-current.txt | 2 ++ .../telephony/CellBroadcastIntents.java | 10 ++++++++ .../telephony/CellBroadcastService.java | 24 +++++++++++++++++++ .../telephony/ICellBroadcastService.aidl | 3 +++ 4 files changed, 39 insertions(+) diff --git a/api/system-current.txt b/api/system-current.txt index bdbbb58c5e3cf..7e04d7b4889e5 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -8554,10 +8554,12 @@ package android.telephony { public class CellBroadcastIntents { method public static void sendSmsCbReceivedBroadcast(@NonNull android.content.Context, @Nullable android.os.UserHandle, @NonNull android.telephony.SmsCbMessage, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, int); + field public static final String ACTION_AREA_INFO_UPDATED = "android.telephony.action.AREA_INFO_UPDATED"; } public abstract class CellBroadcastService extends android.app.Service { ctor public CellBroadcastService(); + method @NonNull @WorkerThread public abstract CharSequence getCellBroadcastAreaInfo(int); method @CallSuper @NonNull public android.os.IBinder onBind(@Nullable android.content.Intent); method public abstract void onCdmaCellBroadcastSms(int, @NonNull byte[], int); method public abstract void onCdmaScpMessage(int, @NonNull java.util.List, @NonNull String, @NonNull java.util.function.Consumer); diff --git a/core/java/android/telephony/CellBroadcastIntents.java b/core/java/android/telephony/CellBroadcastIntents.java index 2e0810835a52b..32d330e1a47f0 100644 --- a/core/java/android/telephony/CellBroadcastIntents.java +++ b/core/java/android/telephony/CellBroadcastIntents.java @@ -19,6 +19,8 @@ package android.telephony; import android.Manifest; import android.annotation.NonNull; import android.annotation.Nullable; +import android.annotation.SdkConstant; +import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemApi; import android.app.AppOpsManager; import android.content.BroadcastReceiver; @@ -42,6 +44,14 @@ public class CellBroadcastIntents { private static final String EXTRA_MESSAGE = "message"; + /** + * Broadcast intent action for notifying area information has been updated. The information + * can be retrieved by {@link CellBroadcastService#getCellBroadcastAreaInfo(int)} + */ + @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_AREA_INFO_UPDATED = + "android.telephony.action.AREA_INFO_UPDATED"; + /** * @hide */ diff --git a/telephony/java/android/telephony/CellBroadcastService.java b/telephony/java/android/telephony/CellBroadcastService.java index f841df2320e0b..1fe80f466b2a3 100644 --- a/telephony/java/android/telephony/CellBroadcastService.java +++ b/telephony/java/android/telephony/CellBroadcastService.java @@ -20,6 +20,7 @@ import android.annotation.CallSuper; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; +import android.annotation.WorkerThread; import android.app.Service; import android.content.Intent; import android.os.Bundle; @@ -101,6 +102,17 @@ public abstract class CellBroadcastService extends Service { @NonNull List smsCbProgramData, @NonNull String originatingAddress, @NonNull Consumer callback); + /** + * Get broadcasted area information. + * + * @param slotIndex the index of the slot which received the area information. + * + * @return The area information string sent from the network. This is usually the human readable + * string shown in Setting app's SIM status page. + */ + @WorkerThread + public abstract @NonNull CharSequence getCellBroadcastAreaInfo(int slotIndex); + /** * If overriding this method, call through to the super method for any unknown actions. * {@inheritDoc} @@ -163,5 +175,17 @@ public abstract class CellBroadcastService extends Service { CellBroadcastService.this.onCdmaScpMessage(slotIndex, smsCbProgramData, originatingAddress, consumer); } + + /** + * Get broadcasted area information + * + * @param slotIndex the index of the slot which received the message + * + * @return The area information + */ + @Override + public @NonNull CharSequence getCellBroadcastAreaInfo(int slotIndex) { + return CellBroadcastService.this.getCellBroadcastAreaInfo(slotIndex); + } } } diff --git a/telephony/java/android/telephony/ICellBroadcastService.aidl b/telephony/java/android/telephony/ICellBroadcastService.aidl index 11263d99cb8f1..4f20ed67fda44 100644 --- a/telephony/java/android/telephony/ICellBroadcastService.aidl +++ b/telephony/java/android/telephony/ICellBroadcastService.aidl @@ -36,4 +36,7 @@ interface ICellBroadcastService { /** @see android.telephony.CellBroadcastService#onCdmaScpMessage */ oneway void handleCdmaScpMessage(int slotId, in List programData, String originatingAddress, in RemoteCallback callback); + + /** @see android.telephony.CellBroadcastService#getCellBroadcastAreaInfo */ + CharSequence getCellBroadcastAreaInfo(int slotIndex); }