summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jordan Liu <jminjie@google.com> 2019-11-06 09:50:00 -0800
committer android-build-merger <android-build-merger@google.com> 2019-11-06 09:50:00 -0800
commit6404defafee4b83c9f9ad654cb9509e8f57e02ee (patch)
tree6330eed1d74fdd069b6c06568fe3e325fdfdcee7
parent698c84738e8b345d9b6b1eb3fab5266f06c3d8d0 (diff)
parent84913b808fca3e39ec802f35da7c698653e66ac8 (diff)
Merge "Add CDMA SCP message handling to CellBroadcast module" am: f0e75a656c
am: 84913b808f Change-Id: Icfc20849b7d52a4acf16150512b26dfe1e1b11fc
-rw-r--r--api/system-current.txt1
-rw-r--r--telephony/java/android/telephony/CellBroadcastService.java58
-rw-r--r--telephony/java/android/telephony/ICellBroadcastService.aidl7
-rw-r--r--telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.aidl21
4 files changed, 81 insertions, 6 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index 7ea45dcbd7a6..eb3f7f3c6411 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -7288,6 +7288,7 @@ package android.telephony {
ctor public CellBroadcastService();
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<android.telephony.cdma.CdmaSmsCbProgramData>, @NonNull String, @NonNull java.util.function.Consumer<android.os.Bundle>);
method public abstract void onGsmCellBroadcastSms(int, @NonNull byte[]);
field public static final String CELL_BROADCAST_SERVICE_INTERFACE = "android.telephony.CellBroadcastService";
}
diff --git a/telephony/java/android/telephony/CellBroadcastService.java b/telephony/java/android/telephony/CellBroadcastService.java
index cb342c6df9ae..f841df2320e0 100644
--- a/telephony/java/android/telephony/CellBroadcastService.java
+++ b/telephony/java/android/telephony/CellBroadcastService.java
@@ -22,9 +22,14 @@ import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.app.Service;
import android.content.Intent;
+import android.os.Bundle;
import android.os.IBinder;
+import android.os.RemoteCallback;
import android.telephony.cdma.CdmaSmsCbProgramData;
+import java.util.List;
+import java.util.function.Consumer;
+
/**
* A service which exposes the cell broadcast handling module to the system.
* <p>
@@ -48,6 +53,7 @@ import android.telephony.cdma.CdmaSmsCbProgramData;
* </service>
* </manifest>
* }</pre>
+ *
* @hide
*/
@SystemApi
@@ -64,21 +70,38 @@ public abstract class CellBroadcastService extends Service {
/**
* Handle a GSM cell broadcast SMS message forwarded from the system.
+ *
* @param slotIndex the index of the slot which received the message
- * @param message the SMS PDU
+ * @param message the SMS PDU
*/
public abstract void onGsmCellBroadcastSms(int slotIndex, @NonNull byte[] message);
/**
* Handle a CDMA cell broadcast SMS message forwarded from the system.
- * @param slotIndex the index of the slot which received the message
- * @param bearerData the CDMA SMS bearer data
+ *
+ * @param slotIndex the index of the slot which received the message
+ * @param bearerData the CDMA SMS bearer data
* @param serviceCategory the CDMA SCPT service category
*/
public abstract void onCdmaCellBroadcastSms(int slotIndex, @NonNull byte[] bearerData,
@CdmaSmsCbProgramData.Category int serviceCategory);
/**
+ * Handle a CDMA cell broadcast SMS message forwarded from the system.
+ *
+ * @param slotIndex the index of the slot which received the message
+ * @param smsCbProgramData the SMS CB program data of the message
+ * @param originatingAddress the originating address of the message, as a non-separated dial
+ * string
+ * @param callback a callback to run after each cell broadcast receiver has handled
+ * the SCP message. The bundle will contain a non-separated
+ * dial string as and an ArrayList of {@link CdmaSmsCbProgramResults}.
+ */
+ public abstract void onCdmaScpMessage(int slotIndex,
+ @NonNull List<CdmaSmsCbProgramData> smsCbProgramData,
+ @NonNull String originatingAddress, @NonNull Consumer<Bundle> callback);
+
+ /**
* If overriding this method, call through to the super method for any unknown actions.
* {@inheritDoc}
*/
@@ -92,13 +115,15 @@ public abstract class CellBroadcastService extends Service {
/**
* A wrapper around ICellBroadcastService that forwards calls to implementations of
* {@link CellBroadcastService}.
+ *
* @hide
*/
public class ICellBroadcastServiceWrapper extends ICellBroadcastService.Stub {
/**
* Handle a GSM cell broadcast SMS.
+ *
* @param slotIndex the index of the slot which received the broadcast
- * @param message the SMS message PDU
+ * @param message the SMS message PDU
*/
@Override
public void handleGsmCellBroadcastSms(int slotIndex, byte[] message) {
@@ -107,8 +132,9 @@ public abstract class CellBroadcastService extends Service {
/**
* Handle a CDMA cell broadcast SMS.
- * @param slotIndex the index of the slot which received the broadcast
- * @param bearerData the CDMA SMS bearer data
+ *
+ * @param slotIndex the index of the slot which received the broadcast
+ * @param bearerData the CDMA SMS bearer data
* @param serviceCategory the CDMA SCPT service category
*/
@Override
@@ -117,5 +143,25 @@ public abstract class CellBroadcastService extends Service {
CellBroadcastService.this.onCdmaCellBroadcastSms(slotIndex, bearerData,
serviceCategory);
}
+
+ /**
+ * Handle a CDMA Service Category Program message.
+ *
+ * @param slotIndex the index of the slot which received the message
+ * @param smsCbProgramData the SMS CB program data of the message
+ * @param originatingAddress the originating address of the message
+ * @param callback a callback to run after each cell broadcast receiver has
+ * handled the SCP message
+ */
+ @Override
+ public void handleCdmaScpMessage(int slotIndex,
+ List<CdmaSmsCbProgramData> smsCbProgramData, String originatingAddress,
+ RemoteCallback callback) {
+ Consumer<Bundle> consumer = bundle -> {
+ callback.sendResult(bundle);
+ };
+ CellBroadcastService.this.onCdmaScpMessage(slotIndex, smsCbProgramData,
+ originatingAddress, consumer);
+ }
}
}
diff --git a/telephony/java/android/telephony/ICellBroadcastService.aidl b/telephony/java/android/telephony/ICellBroadcastService.aidl
index bcd6cc546eed..11263d99cb8f 100644
--- a/telephony/java/android/telephony/ICellBroadcastService.aidl
+++ b/telephony/java/android/telephony/ICellBroadcastService.aidl
@@ -16,6 +16,9 @@
package android.telephony;
+import android.os.RemoteCallback;
+import android.telephony.cdma.CdmaSmsCbProgramData;
+
/**
* Service bound to by the system to allow custom handling of cell broadcast messages.
* <p>
@@ -29,4 +32,8 @@ interface ICellBroadcastService {
/** @see android.telephony.CellBroadcastService#onCdmaCellBroadcastSms */
oneway void handleCdmaCellBroadcastSms(int slotId, in byte[] bearerData, int serviceCategory);
+
+ /** @see android.telephony.CellBroadcastService#onCdmaScpMessage */
+ oneway void handleCdmaScpMessage(int slotId, in List<CdmaSmsCbProgramData> programData,
+ String originatingAddress, in RemoteCallback callback);
}
diff --git a/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.aidl b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.aidl
new file mode 100644
index 000000000000..a648a0e81073
--- /dev/null
+++ b/telephony/java/android/telephony/cdma/CdmaSmsCbProgramData.aidl
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** @hide */
+package android.telephony.cdma;
+
+parcelable CdmaSmsCbProgramData;
+