add a parameter to carrier messaging calls to request delivery status

In the carrier messaging API, I forgot to add the parameter to request
delivery status. We need to add one more parameter (to indicate
requesting delivery status) to these calls:

onSendMultipartTextSms
onSendTextSms
onSendDataSms

Backward compatibility is maintained in
CarrierMessagingService.java. Third-party carrier apps implementing
the old API will continue to work.

BUG: 20224743
Change-Id: I09901558e7cb75a9ec6a5bd5ba2c8117ac471932
This commit is contained in:
Cheuksan Wang
2015-04-15 15:41:36 -07:00
parent 712cdaf48e
commit e87e4f077c
4 changed files with 99 additions and 23 deletions

View File

@@ -27059,13 +27059,17 @@ package android.service.carrier {
method public android.os.IBinder onBind(android.content.Intent);
method public void onDownloadMms(android.net.Uri, int, android.net.Uri, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>);
method public void onFilterSms(android.service.carrier.MessagePdu, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Boolean>);
method public void onSendDataSms(byte[], int, java.lang.String, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
method public deprecated void onSendDataSms(byte[], int, java.lang.String, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
method public void onSendDataSms(byte[], int, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
method public void onSendMms(android.net.Uri, int, android.net.Uri, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMmsResult>);
method public void onSendMultipartTextSms(java.util.List<java.lang.String>, int, java.lang.String, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMultipartSmsResult>);
method public void onSendTextSms(java.lang.String, int, java.lang.String, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
method public deprecated void onSendMultipartTextSms(java.util.List<java.lang.String>, int, java.lang.String, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMultipartSmsResult>);
method public void onSendMultipartTextSms(java.util.List<java.lang.String>, int, java.lang.String, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMultipartSmsResult>);
method public deprecated void onSendTextSms(java.lang.String, int, java.lang.String, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
method public void onSendTextSms(java.lang.String, int, java.lang.String, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
field public static final int DOWNLOAD_STATUS_ERROR = 2; // 0x2
field public static final int DOWNLOAD_STATUS_OK = 0; // 0x0
field public static final int DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK = 1; // 0x1
field public static final int SEND_FLAG_REQUEST_DELIVERY_STATUS = 1; // 0x1
field public static final int SEND_STATUS_ERROR = 2; // 0x2
field public static final int SEND_STATUS_OK = 0; // 0x0
field public static final int SEND_STATUS_RETRY_ON_CARRIER_NETWORK = 1; // 0x1

View File

@@ -28754,13 +28754,17 @@ package android.service.carrier {
method public android.os.IBinder onBind(android.content.Intent);
method public void onDownloadMms(android.net.Uri, int, android.net.Uri, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>);
method public void onFilterSms(android.service.carrier.MessagePdu, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Boolean>);
method public void onSendDataSms(byte[], int, java.lang.String, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
method public deprecated void onSendDataSms(byte[], int, java.lang.String, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
method public void onSendDataSms(byte[], int, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
method public void onSendMms(android.net.Uri, int, android.net.Uri, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMmsResult>);
method public void onSendMultipartTextSms(java.util.List<java.lang.String>, int, java.lang.String, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMultipartSmsResult>);
method public void onSendTextSms(java.lang.String, int, java.lang.String, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
method public deprecated void onSendMultipartTextSms(java.util.List<java.lang.String>, int, java.lang.String, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMultipartSmsResult>);
method public void onSendMultipartTextSms(java.util.List<java.lang.String>, int, java.lang.String, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMultipartSmsResult>);
method public deprecated void onSendTextSms(java.lang.String, int, java.lang.String, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
method public void onSendTextSms(java.lang.String, int, java.lang.String, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
field public static final int DOWNLOAD_STATUS_ERROR = 2; // 0x2
field public static final int DOWNLOAD_STATUS_OK = 0; // 0x0
field public static final int DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK = 1; // 0x1
field public static final int SEND_FLAG_REQUEST_DELIVERY_STATUS = 1; // 0x1
field public static final int SEND_STATUS_ERROR = 2; // 0x2
field public static final int SEND_STATUS_OK = 0; // 0x0
field public static final int SEND_STATUS_RETRY_ON_CARRIER_NETWORK = 1; // 0x1

View File

@@ -83,6 +83,11 @@ public abstract class CarrierMessagingService extends Service {
*/
public static final int DOWNLOAD_STATUS_ERROR = 2;
/**
* Flag to request SMS delivery status report.
*/
public static final int SEND_FLAG_REQUEST_DELIVERY_STATUS = 1;
private final ICarrierMessagingWrapper mWrapper = new ICarrierMessagingWrapper();
/**
@@ -106,12 +111,14 @@ public abstract class CarrierMessagingService extends Service {
/**
* Override this method to intercept text SMSs sent from the device.
* @deprecated Override {@link #onSendTextSms} below instead.
*
* @param text the text to send
* @param subId SMS subscription ID of the SIM
* @param destAddress phone number of the recipient of the message
* @param callback result callback. Call with a {@link SendSmsResult}.
*/
@Deprecated
public void onSendTextSms(
@NonNull String text, int subId, @NonNull String destAddress,
@NonNull ResultCallback<SendSmsResult> callback) {
@@ -122,6 +129,44 @@ public abstract class CarrierMessagingService extends Service {
}
}
/**
* Override this method to intercept text SMSs sent from the device.
*
* @param text the text to send
* @param subId SMS subscription ID of the SIM
* @param destAddress phone number of the recipient of the message
* @param sendSmsFlag Flag for sending SMS. Acceptable values are 0 and
* {@link #SEND_FLAG_REQUEST_DELIVERY_STATUS}.
* @param callback result callback. Call with a {@link SendSmsResult}.
*/
public void onSendTextSms(
@NonNull String text, int subId, @NonNull String destAddress,
int sendSmsFlag, @NonNull ResultCallback<SendSmsResult> callback) {
// optional
onSendTextSms(text, subId, destAddress, callback);
}
/**
* Override this method to intercept binary SMSs sent from the device.
* @deprecated Override {@link #onSendDataSms} below instead.
*
* @param data the binary content
* @param subId SMS subscription ID of the SIM
* @param destAddress phone number of the recipient of the message
* @param destPort the destination port
* @param callback result callback. Call with a {@link SendSmsResult}.
*/
@Deprecated
public void onSendDataSms(@NonNull byte[] data, int subId,
@NonNull String destAddress, int destPort,
@NonNull ResultCallback<SendSmsResult> callback) {
// optional
try {
callback.onReceiveResult(new SendSmsResult(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, 0));
} catch (RemoteException ex) {
}
}
/**
* Override this method to intercept binary SMSs sent from the device.
*
@@ -129,14 +174,34 @@ public abstract class CarrierMessagingService extends Service {
* @param subId SMS subscription ID of the SIM
* @param destAddress phone number of the recipient of the message
* @param destPort the destination port
* @param sendSmsFlag Flag for sending SMS. Acceptable values are 0 and
* {@link #SEND_FLAG_REQUEST_DELIVERY_STATUS}.
* @param callback result callback. Call with a {@link SendSmsResult}.
*/
public void onSendDataSms(@NonNull byte[] data, int subId,
@NonNull String destAddress, int destPort,
@NonNull String destAddress, int destPort, int sendSmsFlag,
@NonNull ResultCallback<SendSmsResult> callback) {
// optional
onSendDataSms(data, subId, destAddress, destPort, callback);
}
/**
* Override this method to intercept long SMSs sent from the device.
* @deprecated Override {@link #onSendMultipartTextSms} below instead.
*
* @param parts a {@link List} of the message parts
* @param subId SMS subscription ID of the SIM
* @param destAddress phone number of the recipient of the message
* @param callback result callback. Call with a {@link SendMultipartSmsResult}.
*/
@Deprecated
public void onSendMultipartTextSms(@NonNull List<String> parts,
int subId, @NonNull String destAddress,
@NonNull ResultCallback<SendMultipartSmsResult> callback) {
// optional
try {
callback.onReceiveResult(new SendSmsResult(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, 0));
callback.onReceiveResult(
new SendMultipartSmsResult(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, null));
} catch (RemoteException ex) {
}
}
@@ -147,17 +212,15 @@ public abstract class CarrierMessagingService extends Service {
* @param parts a {@link List} of the message parts
* @param subId SMS subscription ID of the SIM
* @param destAddress phone number of the recipient of the message
* @param sendSmsFlag Flag for sending SMS. Acceptable values are 0 and
* {@link #SEND_FLAG_REQUEST_DELIVERY_STATUS}.
* @param callback result callback. Call with a {@link SendMultipartSmsResult}.
*/
public void onSendMultipartTextSms(@NonNull List<String> parts,
int subId, @NonNull String destAddress,
int subId, @NonNull String destAddress, int sendSmsFlag,
@NonNull ResultCallback<SendMultipartSmsResult> callback) {
// optional
try {
callback.onReceiveResult(
new SendMultipartSmsResult(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, null));
} catch (RemoteException ex) {
}
onSendMultipartTextSms(parts, subId, destAddress, callback);
}
/**
@@ -358,8 +421,9 @@ public abstract class CarrierMessagingService extends Service {
@Override
public void sendTextSms(String text, int subId, String destAddress,
final ICarrierMessagingCallback callback) {
onSendTextSms(text, subId, destAddress, new ResultCallback<SendSmsResult>() {
int sendSmsFlag, final ICarrierMessagingCallback callback) {
onSendTextSms(text, subId, destAddress, sendSmsFlag,
new ResultCallback<SendSmsResult>() {
@Override
public void onReceiveResult(final SendSmsResult result) throws RemoteException {
callback.onSendSmsComplete(result.getSendStatus(), result.getMessageRef());
@@ -369,8 +433,9 @@ public abstract class CarrierMessagingService extends Service {
@Override
public void sendDataSms(byte[] data, int subId, String destAddress, int destPort,
final ICarrierMessagingCallback callback) {
onSendDataSms(data, subId, destAddress, destPort, new ResultCallback<SendSmsResult>() {
int sendSmsFlag, final ICarrierMessagingCallback callback) {
onSendDataSms(data, subId, destAddress, destPort, sendSmsFlag,
new ResultCallback<SendSmsResult>() {
@Override
public void onReceiveResult(final SendSmsResult result) throws RemoteException {
callback.onSendSmsComplete(result.getSendStatus(), result.getMessageRef());
@@ -380,8 +445,8 @@ public abstract class CarrierMessagingService extends Service {
@Override
public void sendMultipartTextSms(List<String> parts, int subId, String destAddress,
final ICarrierMessagingCallback callback) {
onSendMultipartTextSms(parts, subId, destAddress,
int sendSmsFlag, final ICarrierMessagingCallback callback) {
onSendMultipartTextSms(parts, subId, destAddress, sendSmsFlag,
new ResultCallback<SendMultipartSmsResult>() {
@Override
public void onReceiveResult(final SendMultipartSmsResult result)

View File

@@ -48,9 +48,10 @@ oneway interface ICarrierMessagingService {
* @param text the text to send
* @param subId SMS subscription ID of the SIM
* @param destAddress phone number of the recipient of the message
* @param sendSmsFlag flag for sending SMS
* @param callback the callback to notify upon completion
*/
void sendTextSms(String text, int subId, String destAddress,
void sendTextSms(String text, int subId, String destAddress, int sendSmsFlag,
in ICarrierMessagingCallback callback);
/**
@@ -62,10 +63,11 @@ oneway interface ICarrierMessagingService {
* @param subId SMS subscription ID of the SIM
* @param destAddress phone number of the recipient of the message
* @param destPort port number of the recipient of the message
* @param sendSmsFlag flag for sending SMS
* @param callback the callback to notify upon completion
*/
void sendDataSms(in byte[] data, int subId, String destAddress, int destPort,
in ICarrierMessagingCallback callback);
int sendSmsFlag, in ICarrierMessagingCallback callback);
/**
* Request sending a new multi-part text SMS from the device.
@@ -75,10 +77,11 @@ oneway interface ICarrierMessagingService {
* @param parts the parts of the multi-part text SMS to send
* @param subId SMS subscription ID of the SIM
* @param destAddress phone number of the recipient of the message
* @param sendSmsFlag flag for sending SMS
* @param callback the callback to notify upon completion
*/
void sendMultipartTextSms(in List<String> parts, int subId, String destAddress,
in ICarrierMessagingCallback callback);
int sendSmsFlag, in ICarrierMessagingCallback callback);
/**
* Request sending a new MMS PDU from the device.