am 109ec376: Merge "new SMS/MMS carrier app API" into lmp-mr1-dev
* commit '109ec376da86de1275f73fa432d6344431a457e9': new SMS/MMS carrier app API
This commit is contained in:
@@ -204,8 +204,8 @@ LOCAL_SRC_FILES += \
|
|||||||
core/java/android/os/IUpdateLock.aidl \
|
core/java/android/os/IUpdateLock.aidl \
|
||||||
core/java/android/os/IUserManager.aidl \
|
core/java/android/os/IUserManager.aidl \
|
||||||
core/java/android/os/IVibratorService.aidl \
|
core/java/android/os/IVibratorService.aidl \
|
||||||
core/java/android/service/carriermessaging/ICarrierMessagingCallback.aidl \
|
core/java/android/service/carrier/ICarrierMessagingCallback.aidl \
|
||||||
core/java/android/service/carriermessaging/ICarrierMessagingService.aidl \
|
core/java/android/service/carrier/ICarrierMessagingService.aidl \
|
||||||
core/java/android/service/notification/INotificationListener.aidl \
|
core/java/android/service/notification/INotificationListener.aidl \
|
||||||
core/java/android/service/notification/IStatusBarNotificationHolder.aidl \
|
core/java/android/service/notification/IStatusBarNotificationHolder.aidl \
|
||||||
core/java/android/service/notification/IConditionListener.aidl \
|
core/java/android/service/notification/IConditionListener.aidl \
|
||||||
@@ -524,8 +524,7 @@ aidl_files := \
|
|||||||
frameworks/base/core/java/android/view/textservice/SpellCheckerInfo.aidl \
|
frameworks/base/core/java/android/view/textservice/SpellCheckerInfo.aidl \
|
||||||
frameworks/base/core/java/android/view/textservice/SentenceSuggestionsInfo.aidl \
|
frameworks/base/core/java/android/view/textservice/SentenceSuggestionsInfo.aidl \
|
||||||
frameworks/base/core/java/android/view/textservice/SuggestionsInfo.aidl \
|
frameworks/base/core/java/android/view/textservice/SuggestionsInfo.aidl \
|
||||||
frameworks/base/core/java/android/service/carriermessaging/MessagePdu.aidl \
|
frameworks/base/core/java/android/service/carrier/MessagePdu.aidl \
|
||||||
frameworks/base/core/java/android/service/carriermessaging/CarrierMessagingService.aidl \
|
|
||||||
frameworks/base/core/java/android/service/notification/StatusBarNotification.aidl \
|
frameworks/base/core/java/android/service/notification/StatusBarNotification.aidl \
|
||||||
frameworks/base/core/java/android/speech/tts/Voice.aidl \
|
frameworks/base/core/java/android/speech/tts/Voice.aidl \
|
||||||
frameworks/base/core/java/android/app/usage/UsageEvents.aidl \
|
frameworks/base/core/java/android/app/usage/UsageEvents.aidl \
|
||||||
|
|||||||
@@ -26912,71 +26912,46 @@ package android.security {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package android.service.carriermessaging {
|
package android.service.carrier {
|
||||||
|
|
||||||
public abstract class CarrierMessagingService extends android.app.Service {
|
public abstract class CarrierMessagingService extends android.app.Service {
|
||||||
ctor public CarrierMessagingService();
|
ctor public CarrierMessagingService();
|
||||||
method public android.os.IBinder onBind(android.content.Intent);
|
method public android.os.IBinder onBind(android.content.Intent);
|
||||||
method public int onDownloadMms(android.net.Uri, java.lang.String);
|
method public void onDownloadMms(android.net.Uri, int, android.net.Uri, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>);
|
||||||
method public boolean onFilterSms(android.service.carriermessaging.MessagePdu, java.lang.String, int);
|
method public void onFilterSms(android.service.carrier.MessagePdu, java.lang.String, int, int, android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Boolean>);
|
||||||
method public android.service.carriermessaging.CarrierMessagingService.SendSmsResponse onSendDataSms(byte[], java.lang.String, java.lang.String, int);
|
method public void onSendDataSms(byte[], int, java.lang.String, int, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
|
||||||
method public android.service.carriermessaging.CarrierMessagingService.SendMmsResult onSendMms(android.net.Uri, java.lang.String);
|
method public void onSendMms(android.net.Uri, int, android.net.Uri, android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMmsResult>);
|
||||||
method public java.util.List<android.service.carriermessaging.CarrierMessagingService.SendSmsResponse> onSendMultipartTextSms(java.util.List<java.lang.String>, java.lang.String, java.lang.String);
|
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 android.service.carriermessaging.CarrierMessagingService.SendSmsResponse onSendTextSms(java.lang.String, java.lang.String, java.lang.String);
|
method public void onSendTextSms(java.lang.String, int, java.lang.String, 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_ERROR = 2; // 0x2
|
||||||
field public static final int DOWNLOAD_STATUS_OK = 0; // 0x0
|
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 DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK = 1; // 0x1
|
||||||
field public static final int SEND_STATUS_ERROR = 2; // 0x2
|
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_OK = 0; // 0x0
|
||||||
field public static final int SEND_STATUS_RETRY_ON_CARRIER_NETWORK = 1; // 0x1
|
field public static final int SEND_STATUS_RETRY_ON_CARRIER_NETWORK = 1; // 0x1
|
||||||
field public static final java.lang.String SERVICE_INTERFACE = "android.service.carriermessaging.CarrierMessagingService";
|
field public static final java.lang.String SERVICE_INTERFACE = "android.service.carrier.CarrierMessagingService";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static abstract interface CarrierMessagingService.ResultCallback {
|
||||||
|
method public abstract void onReceiveResult(T) throws android.os.RemoteException;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class CarrierMessagingService.SendMmsResult {
|
public static final class CarrierMessagingService.SendMmsResult {
|
||||||
ctor public CarrierMessagingService.SendMmsResult(int, byte[]);
|
ctor public CarrierMessagingService.SendMmsResult(int, byte[]);
|
||||||
method public int getResult();
|
|
||||||
method public byte[] getSendConfPdu();
|
method public byte[] getSendConfPdu();
|
||||||
|
method public int getSendStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class CarrierMessagingService.SendSmsResponse implements android.os.Parcelable {
|
public static final class CarrierMessagingService.SendMultipartSmsResult {
|
||||||
ctor public CarrierMessagingService.SendSmsResponse(int, byte[], int);
|
ctor public CarrierMessagingService.SendMultipartSmsResult(int, int[]);
|
||||||
method public int describeContents();
|
method public int[] getMessageRefs();
|
||||||
method public byte[] getAckPdu();
|
method public int getSendStatus();
|
||||||
method public int getErrorCode();
|
}
|
||||||
|
|
||||||
|
public static final class CarrierMessagingService.SendSmsResult {
|
||||||
|
ctor public CarrierMessagingService.SendSmsResult(int, int);
|
||||||
method public int getMessageRef();
|
method public int getMessageRef();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public int getSendStatus();
|
||||||
field public static final android.os.Parcelable.Creator<android.service.carriermessaging.CarrierMessagingService.SendSmsResponse> CREATOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract interface ICarrierMessagingCallback implements android.os.IInterface {
|
|
||||||
method public abstract void onDownloadMmsComplete(int) throws android.os.RemoteException;
|
|
||||||
method public abstract void onFilterComplete(boolean) throws android.os.RemoteException;
|
|
||||||
method public abstract void onSendMmsComplete(int, byte[]) throws android.os.RemoteException;
|
|
||||||
method public abstract void onSendMultipartSmsComplete(int, java.util.List<android.service.carriermessaging.CarrierMessagingService.SendSmsResponse>) throws android.os.RemoteException;
|
|
||||||
method public abstract void onSendSmsComplete(int, android.service.carriermessaging.CarrierMessagingService.SendSmsResponse) throws android.os.RemoteException;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static abstract class ICarrierMessagingCallback.Stub extends android.os.Binder implements android.service.carriermessaging.ICarrierMessagingCallback {
|
|
||||||
ctor public ICarrierMessagingCallback.Stub();
|
|
||||||
method public android.os.IBinder asBinder();
|
|
||||||
method public static android.service.carriermessaging.ICarrierMessagingCallback asInterface(android.os.IBinder);
|
|
||||||
method public boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract interface ICarrierMessagingService implements android.os.IInterface {
|
|
||||||
method public abstract void downloadMms(android.net.Uri, java.lang.String, android.service.carriermessaging.ICarrierMessagingCallback) throws android.os.RemoteException;
|
|
||||||
method public abstract void filterSms(android.service.carriermessaging.MessagePdu, java.lang.String, int, android.service.carriermessaging.ICarrierMessagingCallback) throws android.os.RemoteException;
|
|
||||||
method public abstract void sendDataSms(byte[], java.lang.String, java.lang.String, int, android.service.carriermessaging.ICarrierMessagingCallback) throws android.os.RemoteException;
|
|
||||||
method public abstract void sendMms(android.net.Uri, java.lang.String, android.service.carriermessaging.ICarrierMessagingCallback) throws android.os.RemoteException;
|
|
||||||
method public abstract void sendMultipartTextSms(java.util.List<java.lang.String>, java.lang.String, java.lang.String, android.service.carriermessaging.ICarrierMessagingCallback) throws android.os.RemoteException;
|
|
||||||
method public abstract void sendTextSms(java.lang.String, java.lang.String, java.lang.String, android.service.carriermessaging.ICarrierMessagingCallback) throws android.os.RemoteException;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static abstract class ICarrierMessagingService.Stub extends android.os.Binder implements android.service.carriermessaging.ICarrierMessagingService {
|
|
||||||
ctor public ICarrierMessagingService.Stub();
|
|
||||||
method public android.os.IBinder asBinder();
|
|
||||||
method public static android.service.carriermessaging.ICarrierMessagingService asInterface(android.os.IBinder);
|
|
||||||
method public boolean onTransact(int, android.os.Parcel, android.os.Parcel, int) throws android.os.RemoteException;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class MessagePdu implements android.os.Parcelable {
|
public final class MessagePdu implements android.os.Parcelable {
|
||||||
@@ -26984,7 +26959,7 @@ package android.service.carriermessaging {
|
|||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
method public java.util.List<byte[]> getPdus();
|
method public java.util.List<byte[]> getPdus();
|
||||||
method public void writeToParcel(android.os.Parcel, int);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
field public static final android.os.Parcelable.Creator<android.service.carriermessaging.MessagePdu> CREATOR;
|
field public static final android.os.Parcelable.Creator<android.service.carrier.MessagePdu> CREATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
417
core/java/android/service/carrier/CarrierMessagingService.java
Normal file
417
core/java/android/service/carrier/CarrierMessagingService.java
Normal file
@@ -0,0 +1,417 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.service.carrier;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
|
import android.annotation.SdkConstant;
|
||||||
|
import android.app.Service;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A service that receives calls from the system when new SMS and MMS are
|
||||||
|
* sent or received.
|
||||||
|
* <p>To extend this class, you must declare the service in your manifest file with
|
||||||
|
* the {@link android.Manifest.permission#BIND_CARRIER_MESSAGING_SERVICE} permission
|
||||||
|
* and include an intent filter with the {@link #SERVICE_INTERFACE} action. For example:</p>
|
||||||
|
* <pre>
|
||||||
|
* <service android:name=".MyMessagingService"
|
||||||
|
* android:label="@string/service_name"
|
||||||
|
* android:permission="android.permission.BIND_CARRIER_MESSAGING_SERVICE">
|
||||||
|
* <intent-filter>
|
||||||
|
* <action android:name="android.service.carrier.CarrierMessagingService" />
|
||||||
|
* </intent-filter>
|
||||||
|
* </service></pre>
|
||||||
|
*/
|
||||||
|
public abstract class CarrierMessagingService extends Service {
|
||||||
|
/**
|
||||||
|
* The {@link android.content.Intent} that must be declared as handled by the service.
|
||||||
|
*/
|
||||||
|
@SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
|
||||||
|
public static final String SERVICE_INTERFACE
|
||||||
|
= "android.service.carrier.CarrierMessagingService";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that an SMS or MMS message was successfully sent.
|
||||||
|
*/
|
||||||
|
public static final int SEND_STATUS_OK = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMS/MMS sending failed. We should retry via the carrier network.
|
||||||
|
*/
|
||||||
|
public static final int SEND_STATUS_RETRY_ON_CARRIER_NETWORK = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SMS/MMS sending failed. We should not retry via the carrier network.
|
||||||
|
*/
|
||||||
|
public static final int SEND_STATUS_ERROR = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Successfully downloaded an MMS message.
|
||||||
|
*/
|
||||||
|
public static final int DOWNLOAD_STATUS_OK = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MMS downloading failed. We should retry via the carrier network.
|
||||||
|
*/
|
||||||
|
public static final int DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MMS downloading failed. We should not retry via the carrier network.
|
||||||
|
*/
|
||||||
|
public static final int DOWNLOAD_STATUS_ERROR = 2;
|
||||||
|
|
||||||
|
private final ICarrierMessagingWrapper mWrapper = new ICarrierMessagingWrapper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override this method to filter inbound SMS messages.
|
||||||
|
*
|
||||||
|
* @param pdu the PDUs of the message
|
||||||
|
* @param format the format of the PDUs, typically "3gpp" or "3gpp2"
|
||||||
|
* @param destPort the destination port of a binary SMS, this will be -1 for text SMS
|
||||||
|
* @param subId SMS subscription ID of the SIM
|
||||||
|
* @param callback result callback. Call with {@code true} to keep an inbound SMS message and
|
||||||
|
* deliver to SMS apps, and {@code false} to drop the message.
|
||||||
|
*/
|
||||||
|
public void onFilterSms(@NonNull MessagePdu pdu, @NonNull String format, int destPort,
|
||||||
|
int subId, @NonNull ResultCallback<Boolean> callback) {
|
||||||
|
// optional
|
||||||
|
try {
|
||||||
|
callback.onReceiveResult(true);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 callback result callback. Call with a {@link SendSmsResult}.
|
||||||
|
*/
|
||||||
|
public void onSendTextSms(
|
||||||
|
@NonNull String text, int subId, @NonNull String destAddress,
|
||||||
|
@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.
|
||||||
|
*
|
||||||
|
* @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}.
|
||||||
|
*/
|
||||||
|
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 long SMSs sent from the device.
|
||||||
|
*
|
||||||
|
* @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}.
|
||||||
|
*/
|
||||||
|
public void onSendMultipartTextSms(@NonNull List<String> parts,
|
||||||
|
int subId, @NonNull String destAddress,
|
||||||
|
@NonNull ResultCallback<SendMultipartSmsResult> callback) {
|
||||||
|
// optional
|
||||||
|
try {
|
||||||
|
callback.onReceiveResult(
|
||||||
|
new SendMultipartSmsResult(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, null));
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override this method to intercept MMSs sent from the device.
|
||||||
|
*
|
||||||
|
* @param pduUri the content provider URI of the PDU to send
|
||||||
|
* @param subId SMS subscription ID of the SIM
|
||||||
|
* @param location the optional URI to send this MMS PDU. If this is {code null},
|
||||||
|
* the PDU should be sent to the default MMSC URL.
|
||||||
|
* @param callback result callback. Call with a {@link SendMmsResult}.
|
||||||
|
*/
|
||||||
|
public void onSendMms(@NonNull Uri pduUri, int subId,
|
||||||
|
@Nullable Uri location, @NonNull ResultCallback<SendMmsResult> callback) {
|
||||||
|
// optional
|
||||||
|
try {
|
||||||
|
callback.onReceiveResult(new SendMmsResult(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, null));
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override this method to download MMSs received.
|
||||||
|
*
|
||||||
|
* @param contentUri the content provider URI of the PDU to be downloaded.
|
||||||
|
* @param subId SMS subscription ID of the SIM
|
||||||
|
* @param location the URI of the message to be downloaded.
|
||||||
|
* @param callback result callback. Call with a status code which is one of
|
||||||
|
* {@link #DOWNLOAD_STATUS_OK},
|
||||||
|
* {@link #DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK}, or {@link #DOWNLOAD_STATUS_ERROR}.
|
||||||
|
*/
|
||||||
|
public void onDownloadMms(@NonNull Uri contentUri, int subId, @NonNull Uri location,
|
||||||
|
@NonNull ResultCallback<Integer> callback) {
|
||||||
|
// optional
|
||||||
|
try {
|
||||||
|
callback.onReceiveResult(DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK);
|
||||||
|
} catch (RemoteException ex) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @Nullable IBinder onBind(@NonNull Intent intent) {
|
||||||
|
if (!SERVICE_INTERFACE.equals(intent.getAction())) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return mWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The result of sending an MMS.
|
||||||
|
*/
|
||||||
|
public static final class SendMmsResult {
|
||||||
|
private int mSendStatus;
|
||||||
|
private byte[] mSendConfPdu;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a SendMmsResult with the MMS send result, and the SendConf PDU.
|
||||||
|
*
|
||||||
|
* @param sendStatus send status, one of {@link #SEND_STATUS_OK},
|
||||||
|
* {@link #SEND_STATUS_RETRY_ON_CARRIER_NETWORK}, and
|
||||||
|
* {@link #SEND_STATUS_ERROR}
|
||||||
|
* @param sendConfPdu a possibly {code null} SendConf PDU, which confirms that the message
|
||||||
|
* was sent. sendConfPdu is ignored if the {@code result} is not
|
||||||
|
* {@link #SEND_STATUS_OK}.
|
||||||
|
*/
|
||||||
|
public SendMmsResult(int sendStatus, @Nullable byte[] sendConfPdu) {
|
||||||
|
mSendStatus = sendStatus;
|
||||||
|
mSendConfPdu = sendConfPdu;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the send status of the just-sent MMS.
|
||||||
|
*
|
||||||
|
* @return the send status which is one of {@link #SEND_STATUS_OK},
|
||||||
|
* {@link #SEND_STATUS_RETRY_ON_CARRIER_NETWORK}, and {@link #SEND_STATUS_ERROR}
|
||||||
|
*/
|
||||||
|
public int getSendStatus() {
|
||||||
|
return mSendStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the SendConf PDU, which confirms that the message was sent.
|
||||||
|
*
|
||||||
|
* @return the SendConf PDU
|
||||||
|
*/
|
||||||
|
public @Nullable byte[] getSendConfPdu() {
|
||||||
|
return mSendConfPdu;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The result of sending an SMS.
|
||||||
|
*/
|
||||||
|
public static final class SendSmsResult {
|
||||||
|
private final int mSendStatus;
|
||||||
|
private final int mMessageRef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a SendSmsResult with the send status and message reference for the
|
||||||
|
* just-sent SMS.
|
||||||
|
*
|
||||||
|
* @param sendStatus send status, one of {@link #SEND_STATUS_OK},
|
||||||
|
* {@link #SEND_STATUS_RETRY_ON_CARRIER_NETWORK}, and {@link #SEND_STATUS_ERROR}.
|
||||||
|
* @param messageRef message reference of the just-sent SMS. This field is applicable only
|
||||||
|
* if send status is {@link #SEND_STATUS_OK}.
|
||||||
|
*/
|
||||||
|
public SendSmsResult(int sendStatus, int messageRef) {
|
||||||
|
mSendStatus = sendStatus;
|
||||||
|
mMessageRef = messageRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the message reference of the just-sent SMS.
|
||||||
|
*
|
||||||
|
* @return the message reference
|
||||||
|
*/
|
||||||
|
public int getMessageRef() {
|
||||||
|
return mMessageRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the send status of the just-sent SMS.
|
||||||
|
*
|
||||||
|
* @return the send status
|
||||||
|
*/
|
||||||
|
public int getSendStatus() {
|
||||||
|
return mSendStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The result of sending a multipart SMS.
|
||||||
|
*/
|
||||||
|
public static final class SendMultipartSmsResult {
|
||||||
|
private final int mSendStatus;
|
||||||
|
private final int[] mMessageRefs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a SendMultipartSmsResult with the send status and message references for the
|
||||||
|
* just-sent multipart SMS.
|
||||||
|
*
|
||||||
|
* @param sendStatus send status, one of {@link #SEND_STATUS_OK},
|
||||||
|
* {@link #SEND_STATUS_RETRY_ON_CARRIER_NETWORK}, and {@link #SEND_STATUS_ERROR}.
|
||||||
|
* @param messageRefs an array of message references, one for each part of the
|
||||||
|
* multipart SMS. This field is applicable only if send status is
|
||||||
|
* {@link #SEND_STATUS_OK}.
|
||||||
|
*/
|
||||||
|
public SendMultipartSmsResult(int sendStatus, @Nullable int[] messageRefs) {
|
||||||
|
mSendStatus = sendStatus;
|
||||||
|
mMessageRefs = messageRefs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the message references of the just-sent multipart SMS.
|
||||||
|
*
|
||||||
|
* @return the message references, one for each part of the multipart SMS
|
||||||
|
*/
|
||||||
|
public @Nullable int[] getMessageRefs() {
|
||||||
|
return mMessageRefs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the send status of the just-sent SMS.
|
||||||
|
*
|
||||||
|
* @return the send status
|
||||||
|
*/
|
||||||
|
public int getSendStatus() {
|
||||||
|
return mSendStatus;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A callback interface used to provide results asynchronously.
|
||||||
|
*/
|
||||||
|
public interface ResultCallback<T> {
|
||||||
|
/**
|
||||||
|
* Invoked when the result is available.
|
||||||
|
*
|
||||||
|
* @param result the result
|
||||||
|
*/
|
||||||
|
public void onReceiveResult(@NonNull T result) throws RemoteException;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A wrapper around ICarrierMessagingService to enable the carrier messaging app to implement
|
||||||
|
* methods it cares about in the {@link ICarrierMessagingService} interface.
|
||||||
|
*/
|
||||||
|
private class ICarrierMessagingWrapper extends ICarrierMessagingService.Stub {
|
||||||
|
@Override
|
||||||
|
public void filterSms(MessagePdu pdu, String format, int destPort,
|
||||||
|
int subId, final ICarrierMessagingCallback callback) {
|
||||||
|
onFilterSms(pdu, format, destPort, subId, new ResultCallback<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public void onReceiveResult(final Boolean result) throws RemoteException {
|
||||||
|
callback.onFilterComplete(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendTextSms(String text, int subId, String destAddress,
|
||||||
|
final ICarrierMessagingCallback callback) {
|
||||||
|
onSendTextSms(text, subId, destAddress, new ResultCallback<SendSmsResult>() {
|
||||||
|
@Override
|
||||||
|
public void onReceiveResult(final SendSmsResult result) throws RemoteException {
|
||||||
|
callback.onSendSmsComplete(result.getSendStatus(), result.getMessageRef());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendDataSms(byte[] data, int subId, String destAddress, int destPort,
|
||||||
|
final ICarrierMessagingCallback callback) {
|
||||||
|
onSendDataSms(data, subId, destAddress, destPort, new ResultCallback<SendSmsResult>() {
|
||||||
|
@Override
|
||||||
|
public void onReceiveResult(final SendSmsResult result) throws RemoteException {
|
||||||
|
callback.onSendSmsComplete(result.getSendStatus(), result.getMessageRef());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMultipartTextSms(List<String> parts, int subId, String destAddress,
|
||||||
|
final ICarrierMessagingCallback callback) {
|
||||||
|
onSendMultipartTextSms(parts, subId, destAddress,
|
||||||
|
new ResultCallback<SendMultipartSmsResult>() {
|
||||||
|
@Override
|
||||||
|
public void onReceiveResult(final SendMultipartSmsResult result)
|
||||||
|
throws RemoteException {
|
||||||
|
callback.onSendMultipartSmsComplete(
|
||||||
|
result.getSendStatus(), result.getMessageRefs());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendMms(Uri pduUri, int subId, Uri location,
|
||||||
|
final ICarrierMessagingCallback callback) {
|
||||||
|
onSendMms(pduUri, subId, location, new ResultCallback<SendMmsResult>() {
|
||||||
|
@Override
|
||||||
|
public void onReceiveResult(final SendMmsResult result) throws RemoteException {
|
||||||
|
callback.onSendMmsComplete(result.getSendStatus(), result.getSendConfPdu());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downloadMms(Uri pduUri, int subId, Uri location,
|
||||||
|
final ICarrierMessagingCallback callback) {
|
||||||
|
onDownloadMms(pduUri, subId, location, new ResultCallback<Integer>() {
|
||||||
|
@Override
|
||||||
|
public void onReceiveResult(Integer result) throws RemoteException {
|
||||||
|
callback.onDownloadMmsComplete(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,20 +14,17 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.service.carriermessaging;
|
package android.service.carrier;
|
||||||
|
|
||||||
import android.service.carriermessaging.CarrierMessagingService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback interface definition for the Carrier Messaging Service client to get informed of the
|
* Callback interface definition for the Carrier Messaging Service client to get informed of the
|
||||||
* result of various API invocations.
|
* result of various API invocations.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
oneway interface ICarrierMessagingCallback {
|
oneway interface ICarrierMessagingCallback {
|
||||||
void onFilterComplete(boolean keepMessage);
|
void onFilterComplete(boolean keepMessage);
|
||||||
void onSendSmsComplete(
|
void onSendSmsComplete(int result, int messageRef);
|
||||||
int result, in CarrierMessagingService.SendSmsResponse sendSmsResponse);
|
void onSendMultipartSmsComplete(int result, in int[] messageRefs);
|
||||||
void onSendMultipartSmsComplete(
|
|
||||||
int result, in List<CarrierMessagingService.SendSmsResponse> sendSmsResponses);
|
|
||||||
void onSendMmsComplete(int result, in byte[] sendConfPdu);
|
void onSendMmsComplete(int result, in byte[] sendConfPdu);
|
||||||
void onDownloadMmsComplete(int result);
|
void onDownloadMmsComplete(int result);
|
||||||
}
|
}
|
||||||
@@ -14,15 +14,16 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.service.carriermessaging;
|
package android.service.carrier;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.service.carriermessaging.ICarrierMessagingCallback;
|
import android.service.carrier.ICarrierMessagingCallback;
|
||||||
import android.service.carriermessaging.MessagePdu;
|
import android.service.carrier.MessagePdu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p class="note"><strong>Note:</strong>
|
* <p class="note"><strong>Note:</strong>
|
||||||
* This service can only be implemented by a carrier privileged app.
|
* This service can only be implemented by a carrier privileged app.
|
||||||
|
* @hide
|
||||||
*/
|
*/
|
||||||
oneway interface ICarrierMessagingService {
|
oneway interface ICarrierMessagingService {
|
||||||
/**
|
/**
|
||||||
@@ -32,10 +33,12 @@ oneway interface ICarrierMessagingService {
|
|||||||
* @param pdu the PDUs of the message
|
* @param pdu the PDUs of the message
|
||||||
* @param format the format of the PDUs, typically "3gpp" or "3gpp2"
|
* @param format the format of the PDUs, typically "3gpp" or "3gpp2"
|
||||||
* @param destPort the destination port of a data SMS. It will be -1 for text SMS
|
* @param destPort the destination port of a data SMS. It will be -1 for text SMS
|
||||||
|
* @param subId SMS subscription ID of the SIM
|
||||||
* @param callback the callback to notify upon completion
|
* @param callback the callback to notify upon completion
|
||||||
*/
|
*/
|
||||||
void filterSms(
|
void filterSms(
|
||||||
in MessagePdu pdu, String format, int destPort, in ICarrierMessagingCallback callback);
|
in MessagePdu pdu, String format, int destPort, int subId,
|
||||||
|
in ICarrierMessagingCallback callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request sending a new text SMS from the device.
|
* Request sending a new text SMS from the device.
|
||||||
@@ -43,11 +46,11 @@ oneway interface ICarrierMessagingService {
|
|||||||
* status.
|
* status.
|
||||||
*
|
*
|
||||||
* @param text the text to send
|
* @param text the text to send
|
||||||
* @param format the format of the response PDU, typically "3gpp" or "3gpp2"
|
* @param subId SMS subscription ID of the SIM
|
||||||
* @param destAddress phone number of the recipient of the message
|
* @param destAddress phone number of the recipient of the message
|
||||||
* @param callback the callback to notify upon completion
|
* @param callback the callback to notify upon completion
|
||||||
*/
|
*/
|
||||||
void sendTextSms(String text, String format, String destAddress,
|
void sendTextSms(String text, int subId, String destAddress,
|
||||||
in ICarrierMessagingCallback callback);
|
in ICarrierMessagingCallback callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,12 +59,12 @@ oneway interface ICarrierMessagingService {
|
|||||||
* status.
|
* status.
|
||||||
*
|
*
|
||||||
* @param data the data to send
|
* @param data the data to send
|
||||||
* @param format the format of the response PDU, typically "3gpp" or "3gpp2"
|
* @param subId SMS subscription ID of the SIM
|
||||||
* @param destAddress phone number of the recipient of the message
|
* @param destAddress phone number of the recipient of the message
|
||||||
* @param destPort port number of the recipient of the message
|
* @param destPort port number of the recipient of the message
|
||||||
* @param callback the callback to notify upon completion
|
* @param callback the callback to notify upon completion
|
||||||
*/
|
*/
|
||||||
void sendDataSms(in byte[] data, String format, String destAddress, int destPort,
|
void sendDataSms(in byte[] data, int subId, String destAddress, int destPort,
|
||||||
in ICarrierMessagingCallback callback);
|
in ICarrierMessagingCallback callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,11 +73,11 @@ oneway interface ICarrierMessagingService {
|
|||||||
* with the send status.
|
* with the send status.
|
||||||
*
|
*
|
||||||
* @param parts the parts of the multi-part text SMS to send
|
* @param parts the parts of the multi-part text SMS to send
|
||||||
* @param format the format of the response PDU, typically "3gpp" or "3gpp2"
|
* @param subId SMS subscription ID of the SIM
|
||||||
* @param destAddress phone number of the recipient of the message
|
* @param destAddress phone number of the recipient of the message
|
||||||
* @param callback the callback to notify upon completion
|
* @param callback the callback to notify upon completion
|
||||||
*/
|
*/
|
||||||
void sendMultipartTextSms(in List<String> parts, String format, String destAddress,
|
void sendMultipartTextSms(in List<String> parts, int subId, String destAddress,
|
||||||
in ICarrierMessagingCallback callback);
|
in ICarrierMessagingCallback callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,11 +86,13 @@ oneway interface ICarrierMessagingService {
|
|||||||
* status.
|
* status.
|
||||||
*
|
*
|
||||||
* @param pduUri the content provider URI of the PDU to send
|
* @param pduUri the content provider URI of the PDU to send
|
||||||
* @param locationUrl the optional url to send this MMS PDU.
|
* @param subId SMS subscription ID of the SIM
|
||||||
* If this is not specified, PDU should be sent to the default MMSC url.
|
* @param location the optional URI to send this MMS PDU. If this is {code null},
|
||||||
|
* the PDU should be sent to the default MMSC URL.
|
||||||
* @param callback the callback to notify upon completion
|
* @param callback the callback to notify upon completion
|
||||||
*/
|
*/
|
||||||
void sendMms(in Uri pduUri, String locationUrl, in ICarrierMessagingCallback callback);
|
void sendMms(in Uri pduUri, int subId, in Uri location,
|
||||||
|
in ICarrierMessagingCallback callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request downloading a new MMS.
|
* Request downloading a new MMS.
|
||||||
@@ -95,9 +100,11 @@ oneway interface ICarrierMessagingService {
|
|||||||
* download status.
|
* download status.
|
||||||
*
|
*
|
||||||
* @param pduUri the content provider URI of the PDU to be downloaded.
|
* @param pduUri the content provider URI of the PDU to be downloaded.
|
||||||
* @param locationUrl the URL of the message to be downloaded.
|
* @param subId SMS subscription ID of the SIM
|
||||||
|
* @param location the URI of the message to be downloaded.
|
||||||
* @param callback the callback to notify upon completion
|
* @param callback the callback to notify upon completion
|
||||||
*/
|
*/
|
||||||
void downloadMms(in Uri pduUri, String locationUrl, in ICarrierMessagingCallback callback);
|
void downloadMms(in Uri pduUri, int subId, in Uri location,
|
||||||
|
in ICarrierMessagingCallback callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,6 +14,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.service.carriermessaging;
|
package android.service.carrier;
|
||||||
|
|
||||||
parcelable MessagePdu;
|
parcelable MessagePdu;
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.service.carriermessaging;
|
package android.service.carrier;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2014, 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package android.service.carriermessaging;
|
|
||||||
|
|
||||||
parcelable CarrierMessagingService.SendSmsResponse;
|
|
||||||
@@ -1,393 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2014 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package android.service.carriermessaging;
|
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
|
||||||
import android.annotation.Nullable;
|
|
||||||
import android.annotation.SdkConstant;
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.os.Parcel;
|
|
||||||
import android.os.Parcelable;
|
|
||||||
import android.os.RemoteException;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A service that receives calls from the system when new SMS and MMS are
|
|
||||||
* sent or received.
|
|
||||||
* <p>To extend this class, you must declare the service in your manifest file with
|
|
||||||
* the {@link android.Manifest.permission#BIND_CARRIER_MESSAGING_SERVICE} permission
|
|
||||||
* and include an intent filter with the {@link #SERVICE_INTERFACE} action. For example:</p>
|
|
||||||
* <pre>
|
|
||||||
* <service android:name=".MyMessagingService"
|
|
||||||
* android:label="@string/service_name"
|
|
||||||
* android:permission="android.permission.BIND_CARRIER_MESSAGING_SERVICE">
|
|
||||||
* <intent-filter>
|
|
||||||
* <action android:name="android.service.carriermessaging.CarrierMessagingService" />
|
|
||||||
* </intent-filter>
|
|
||||||
* </service></pre>
|
|
||||||
*/
|
|
||||||
public abstract class CarrierMessagingService extends Service {
|
|
||||||
/**
|
|
||||||
* The {@link android.content.Intent} that must be declared as handled by the service.
|
|
||||||
*/
|
|
||||||
@SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION)
|
|
||||||
public static final String SERVICE_INTERFACE
|
|
||||||
= "android.service.carriermessaging.CarrierMessagingService";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates that an SMS or MMS message was successfully sent.
|
|
||||||
*/
|
|
||||||
public static final int SEND_STATUS_OK = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SMS/MMS sending failed. We should retry via the carrier network.
|
|
||||||
*/
|
|
||||||
public static final int SEND_STATUS_RETRY_ON_CARRIER_NETWORK = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SMS/MMS sending failed. We should not retry via the carrier network.
|
|
||||||
*/
|
|
||||||
public static final int SEND_STATUS_ERROR = 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Successfully downloaded an MMS message.
|
|
||||||
*/
|
|
||||||
public static final int DOWNLOAD_STATUS_OK = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MMS downloading failed. We should retry via the carrier network.
|
|
||||||
*/
|
|
||||||
public static final int DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK = 1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MMS downloading failed. We should not retry via the carrier network.
|
|
||||||
*/
|
|
||||||
public static final int DOWNLOAD_STATUS_ERROR = 2;
|
|
||||||
|
|
||||||
private final ICarrierMessagingWrapper mWrapper = new ICarrierMessagingWrapper();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implement this method to filter SMS messages.
|
|
||||||
*
|
|
||||||
* @param pdu the PDUs of the message
|
|
||||||
* @param format the format of the PDUs, typically "3gpp" or "3gpp2"
|
|
||||||
* @param destPort the destination port of a binary SMS, this will be -1 for text SMS
|
|
||||||
*
|
|
||||||
* @return True to keep an inbound SMS message and delivered to SMS apps. False to
|
|
||||||
* drop the message.
|
|
||||||
*/
|
|
||||||
public boolean onFilterSms(@NonNull MessagePdu pdu, @NonNull String format, int destPort) {
|
|
||||||
// optional
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implement this method to intercept text SMSs sent from the devcie.
|
|
||||||
*
|
|
||||||
* @param text the text to send
|
|
||||||
* @param format the format of the response PDU, typically "3gpp" or "3gpp2"
|
|
||||||
* @param destAddress phone number of the recipient of the message
|
|
||||||
*
|
|
||||||
* @return a possibly {code null} {@link SendSmsResponse}. Upon returning {@code null}, the SMS
|
|
||||||
* is sent using the carrier network.
|
|
||||||
*/
|
|
||||||
public @Nullable SendSmsResponse onSendTextSms(
|
|
||||||
@NonNull String text, @NonNull String format, @NonNull String destAddress) {
|
|
||||||
// optional
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implement this method to intercept binary SMSs sent from the device.
|
|
||||||
*
|
|
||||||
* @param data the binary content
|
|
||||||
* @param format format the format of the response PDU, typically "3gpp" or "3gpp2"
|
|
||||||
* @param destAddress phone number of the recipient of the message
|
|
||||||
* @param destPort the destination port
|
|
||||||
*
|
|
||||||
* @return a possibly {code null} {@link SendSmsResponse}. Upon returning {@code null}, the SMS
|
|
||||||
* is sent using the carrier network.
|
|
||||||
*/
|
|
||||||
public @Nullable SendSmsResponse onSendDataSms(@NonNull byte[] data, @NonNull String format,
|
|
||||||
@NonNull String destAddress, int destPort) {
|
|
||||||
// optional
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implement this method to intercept long SMSs sent from the device.
|
|
||||||
*
|
|
||||||
* @param parts a {@link List} of the message parts
|
|
||||||
* @param format format the format of the response PDU, typically "3gpp" or "3gpp2"
|
|
||||||
* @param destAddress phone number of the recipient of the message
|
|
||||||
*
|
|
||||||
* @return a possibly {code null} {@link List} of {@link SendSmsResponse}, one for each message
|
|
||||||
* part. Upon returning {@code null}, the SMS is sent using the carrier network.
|
|
||||||
*/
|
|
||||||
public @Nullable List<SendSmsResponse> onSendMultipartTextSms(@NonNull List<String> parts,
|
|
||||||
@NonNull String format, @NonNull String destAddress) {
|
|
||||||
// optional
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implement this method to intercept MMSs sent from the device.
|
|
||||||
*
|
|
||||||
* @param pduUri the content provider URI of the PDU to send
|
|
||||||
* @param locationUrl the optional URL to send this MMS PDU. If this is not specified,
|
|
||||||
* the PDU should be sent to the default MMSC URL.
|
|
||||||
*
|
|
||||||
* @return a possibly {@code null} {@link SendMmsResult}. Upon returning {@code null}, the
|
|
||||||
* MMS is sent using the carrier network.
|
|
||||||
*/
|
|
||||||
public @Nullable SendMmsResult onSendMms(@NonNull Uri pduUri, @Nullable String locationUrl) {
|
|
||||||
// optional
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implement this method to download MMSs received.
|
|
||||||
*
|
|
||||||
* @param contentUri the content provider URI of the PDU to be downloaded.
|
|
||||||
* @param locationUrl the URL of the message to be downloaded.
|
|
||||||
*
|
|
||||||
* @return a {@link SendMmsResult}.
|
|
||||||
*/
|
|
||||||
public int onDownloadMms(@NonNull Uri contentUri, @NonNull String locationUrl) {
|
|
||||||
// optional
|
|
||||||
return DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable IBinder onBind(@NonNull Intent intent) {
|
|
||||||
if (!SERVICE_INTERFACE.equals(intent.getAction())) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return mWrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The result of sending an MMS.
|
|
||||||
*/
|
|
||||||
public static final class SendMmsResult {
|
|
||||||
private int mResult;
|
|
||||||
private byte[] mSendConfPdu;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a SendMmsResult with the MMS send result, and the SenConf PDU.
|
|
||||||
*
|
|
||||||
* @param result the result which is one of {@link #SEND_STATUS_OK},
|
|
||||||
* {@link #SEND_STATUS_RETRY_ON_CARRIER_NETWORK}, and
|
|
||||||
* {@link #SEND_STATUS_ERROR}
|
|
||||||
* @param sendConfPdu a possibly {code null} SendConf PDU, which confirms that the message
|
|
||||||
* was sent. sendConfPdu is ignored if the {@code result} is not
|
|
||||||
* {@link #SEND_STATUS_OK}
|
|
||||||
*/
|
|
||||||
public SendMmsResult(int result, @Nullable byte[] sendConfPdu) {
|
|
||||||
mResult = result;
|
|
||||||
mSendConfPdu = sendConfPdu;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the result of sending the MMS.
|
|
||||||
*
|
|
||||||
* @return the result which is one of {@link #SEND_STATUS_OK},
|
|
||||||
* {@link #SEND_STATUS_RETRY_ON_CARRIER_NETWORK}, and {@link #SEND_STATUS_ERROR}
|
|
||||||
*/
|
|
||||||
public int getResult() {
|
|
||||||
return mResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the SendConf PDU, which confirms that the message was sent.
|
|
||||||
*
|
|
||||||
* @return the SendConf PDU
|
|
||||||
*/
|
|
||||||
public @Nullable byte[] getSendConfPdu() {
|
|
||||||
return mSendConfPdu;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Object passed in callbacks upon successful completion of
|
|
||||||
* {@link ICarrierMessagingService#sendTextSms},
|
|
||||||
* {@link ICarrierMessagingService#sendDataSms}, and
|
|
||||||
* {@link ICarrierMessagingService#sendMultipartTextSms}.
|
|
||||||
* Contains message reference and ackPdu.
|
|
||||||
*/
|
|
||||||
public static final class SendSmsResponse implements Parcelable {
|
|
||||||
private int mMessageRef;
|
|
||||||
private byte[] mAckPdu;
|
|
||||||
private int mErrorCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a SendSmsResponse for the message reference, the ack PDU, and error code for
|
|
||||||
* the just-sent SMS.
|
|
||||||
*
|
|
||||||
* @param messageRef message reference of the just-sent SMS
|
|
||||||
* @param ackPdu ackPdu for the just-sent SMS
|
|
||||||
* @param errorCode error code. See 3GPP 27.005, 3.2.5 for GSM/UMTS,
|
|
||||||
* 3GPP2 N.S0005 (IS-41C) Table 171 for CDMA, -1 if unknown or not applicable.
|
|
||||||
*/
|
|
||||||
public SendSmsResponse(int messageRef, @NonNull byte[] ackPdu, int errorCode) {
|
|
||||||
mMessageRef = messageRef;
|
|
||||||
mAckPdu = ackPdu;
|
|
||||||
mErrorCode = errorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the message reference of the just-sent SMS.
|
|
||||||
*
|
|
||||||
* @return the message reference
|
|
||||||
*/
|
|
||||||
public int getMessageRef() {
|
|
||||||
return mMessageRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the ackPdu for the just-sent SMS.
|
|
||||||
*
|
|
||||||
* @return the ackPdu
|
|
||||||
*/
|
|
||||||
public @NonNull byte[] getAckPdu() {
|
|
||||||
return mAckPdu;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the error code upon encountering an error while sending the SMS, -1 if unknown or
|
|
||||||
* not applicable.
|
|
||||||
*
|
|
||||||
* @return errorCode the errorCode as defined in 3GPP 27.005, 3.2.5 for GSM/UMTS, and 3GPP2
|
|
||||||
* N.S0005 (IS-41C) Table 171 for CDMA, -1 if unknown or not applicable.
|
|
||||||
*/
|
|
||||||
public int getErrorCode() {
|
|
||||||
return mErrorCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int describeContents() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
|
||||||
dest.writeInt(mMessageRef);
|
|
||||||
dest.writeByteArray(mAckPdu);
|
|
||||||
dest.writeInt(mErrorCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final Parcelable.Creator<SendSmsResponse> CREATOR
|
|
||||||
= new Parcelable.Creator<SendSmsResponse>() {
|
|
||||||
@Override
|
|
||||||
public SendSmsResponse createFromParcel(Parcel source) {
|
|
||||||
return new SendSmsResponse(source.readInt(),
|
|
||||||
source.createByteArray(),
|
|
||||||
source.readInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SendSmsResponse[] newArray(int size) {
|
|
||||||
return new SendSmsResponse[size];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A wrapper around ICarrierMessagingService to enable the carrier messaging APP to implement
|
|
||||||
* methods it cares about in the {@link ICarrierMessagingService} interface.
|
|
||||||
*/
|
|
||||||
private class ICarrierMessagingWrapper extends ICarrierMessagingService.Stub {
|
|
||||||
@Override
|
|
||||||
public void filterSms(MessagePdu pdu, String format, int destPort,
|
|
||||||
ICarrierMessagingCallback callback) {
|
|
||||||
try {
|
|
||||||
callback.onFilterComplete(onFilterSms(pdu, format, destPort));
|
|
||||||
} catch (RemoteException ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendTextSms(String text, String format, String destAddress,
|
|
||||||
ICarrierMessagingCallback callback) {
|
|
||||||
try {
|
|
||||||
SendSmsResponse sendSmsResponse = onSendTextSms(text, format, destAddress);
|
|
||||||
if (sendSmsResponse == null) {
|
|
||||||
callback.onSendSmsComplete(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, null);
|
|
||||||
} else {
|
|
||||||
callback.onSendSmsComplete(SEND_STATUS_OK, sendSmsResponse);
|
|
||||||
}
|
|
||||||
} catch (RemoteException ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendDataSms(byte[] data, String format, String destAddress, int destPort,
|
|
||||||
ICarrierMessagingCallback callback) {
|
|
||||||
try {
|
|
||||||
SendSmsResponse sendSmsResponse = onSendDataSms(data, format, destAddress,
|
|
||||||
destPort);
|
|
||||||
if (sendSmsResponse == null) {
|
|
||||||
callback.onSendSmsComplete(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, null);
|
|
||||||
} else {
|
|
||||||
callback.onSendSmsComplete(SEND_STATUS_OK, sendSmsResponse);
|
|
||||||
}
|
|
||||||
} catch (RemoteException ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendMultipartTextSms(List<String> parts, String format, String destAddress,
|
|
||||||
ICarrierMessagingCallback callback) {
|
|
||||||
try {
|
|
||||||
List<SendSmsResponse> sendSmsResponses =
|
|
||||||
onSendMultipartTextSms(parts, format, destAddress);
|
|
||||||
if (sendSmsResponses == null) {
|
|
||||||
callback.onSendMultipartSmsComplete(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, null);
|
|
||||||
} else {
|
|
||||||
callback.onSendMultipartSmsComplete(SEND_STATUS_OK, sendSmsResponses);
|
|
||||||
}
|
|
||||||
} catch (RemoteException ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendMms(Uri pduUri, String locationUrl, ICarrierMessagingCallback callback) {
|
|
||||||
try {
|
|
||||||
SendMmsResult result = onSendMms(pduUri, locationUrl);
|
|
||||||
if (result == null) {
|
|
||||||
callback.onSendMmsComplete(SEND_STATUS_RETRY_ON_CARRIER_NETWORK, null);
|
|
||||||
} else {
|
|
||||||
callback.onSendMmsComplete(SEND_STATUS_OK, result.getSendConfPdu());
|
|
||||||
}
|
|
||||||
} catch (RemoteException ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void downloadMms(Uri contentUri, String locationUrl,
|
|
||||||
ICarrierMessagingCallback callback) {
|
|
||||||
try {
|
|
||||||
callback.onDownloadMmsComplete(onDownloadMms(contentUri, locationUrl));
|
|
||||||
} catch (RemoteException ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2014 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package android.service.carriermessaging;
|
|
||||||
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.ServiceConnection;
|
|
||||||
import android.os.IBinder;
|
|
||||||
|
|
||||||
import com.android.internal.util.Preconditions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides basic structure for platform to connect to the carrier messaging service.
|
|
||||||
* <p>
|
|
||||||
* <code>
|
|
||||||
* CarrierMessagingServiceManager carrierMessagingServiceManager =
|
|
||||||
* new CarrierMessagingServiceManagerImpl();
|
|
||||||
* if (carrierMessagingServiceManager.bindToCarrierMessagingService(context, carrierPackageName)) {
|
|
||||||
* // wait for onServiceReady callback
|
|
||||||
* } else {
|
|
||||||
* // Unable to bind: handle error.
|
|
||||||
* }
|
|
||||||
* </code>
|
|
||||||
* <p> Upon completion {@link #disposeConnection} should be called to unbind the
|
|
||||||
* CarrierMessagingService.
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public abstract class CarrierMessagingServiceManager {
|
|
||||||
// Populated by bindToCarrierMessagingService. bindToCarrierMessagingService must complete
|
|
||||||
// prior to calling disposeConnection so that mCarrierMessagingServiceConnection is initialized.
|
|
||||||
private volatile CarrierMessagingServiceConnection mCarrierMessagingServiceConnection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Binds to the carrier messaging service under package {@code carrierPackageName}. This method
|
|
||||||
* should be called exactly once.
|
|
||||||
*
|
|
||||||
* @param context the context
|
|
||||||
* @param carrierPackageName the carrier package name
|
|
||||||
* @return true upon successfully binding to a carrier messaging service, false otherwise
|
|
||||||
*/
|
|
||||||
public boolean bindToCarrierMessagingService(Context context, String carrierPackageName) {
|
|
||||||
Preconditions.checkState(mCarrierMessagingServiceConnection == null);
|
|
||||||
|
|
||||||
Intent intent = new Intent(CarrierMessagingService.SERVICE_INTERFACE);
|
|
||||||
intent.setPackage(carrierPackageName);
|
|
||||||
mCarrierMessagingServiceConnection = new CarrierMessagingServiceConnection();
|
|
||||||
return context.bindService(intent, mCarrierMessagingServiceConnection,
|
|
||||||
Context.BIND_AUTO_CREATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unbinds the carrier messaging service. This method should be called exactly once.
|
|
||||||
*
|
|
||||||
* @param context the context
|
|
||||||
*/
|
|
||||||
public void disposeConnection(Context context) {
|
|
||||||
Preconditions.checkNotNull(mCarrierMessagingServiceConnection);
|
|
||||||
context.unbindService(mCarrierMessagingServiceConnection);
|
|
||||||
mCarrierMessagingServiceConnection = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implemented by subclasses to use the carrier messaging service once it is ready.
|
|
||||||
*
|
|
||||||
* @param carrierMessagingService the carirer messaing service interface
|
|
||||||
*/
|
|
||||||
protected abstract void onServiceReady(ICarrierMessagingService carrierMessagingService);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A basic {@link ServiceConnection}.
|
|
||||||
*/
|
|
||||||
private final class CarrierMessagingServiceConnection implements ServiceConnection {
|
|
||||||
@Override
|
|
||||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
|
||||||
onServiceReady(ICarrierMessagingService.Stub.asInterface(service));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onServiceDisconnected(ComponentName name) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2910,7 +2910,7 @@
|
|||||||
android:description="@string/permdesc_removeDrmCertificates"
|
android:description="@string/permdesc_removeDrmCertificates"
|
||||||
android:protectionLevel="signature|system" />
|
android:protectionLevel="signature|system" />
|
||||||
|
|
||||||
<!-- Must be required by a {@link android.service.carriermessaging.CarrierMessagingService}.
|
<!-- Must be required by a {@link android.service.carrier.CarrierMessagingService}.
|
||||||
Any service that filters for this intent must be a carrier privileged app. -->
|
Any service that filters for this intent must be a carrier privileged app. -->
|
||||||
<permission android:name="android.permission.BIND_CARRIER_MESSAGING_SERVICE"
|
<permission android:name="android.permission.BIND_CARRIER_MESSAGING_SERVICE"
|
||||||
android:label="@string/permlab_bindCarrierMessagingService"
|
android:label="@string/permlab_bindCarrierMessagingService"
|
||||||
|
|||||||
@@ -207,20 +207,6 @@ public class MmsServiceBroker extends SystemService {
|
|||||||
return mTelephonyManager;
|
return mTelephonyManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Throws a security exception unless the caller has carrier privilege.
|
|
||||||
*/
|
|
||||||
private void enforceCarrierPrivilege() {
|
|
||||||
final String[] packages = getPackageManager().getPackagesForUid(Binder.getCallingUid());
|
|
||||||
for (String pkg : packages) {
|
|
||||||
if (getTelephonyManager().checkCarrierPrivilegesForPackage(pkg) ==
|
|
||||||
TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new SecurityException("No carrier privilege");
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getCallingPackageName() {
|
private String getCallingPackageName() {
|
||||||
final String[] packages = getPackageManager().getPackagesForUid(Binder.getCallingUid());
|
final String[] packages = getPackageManager().getPackagesForUid(Binder.getCallingUid());
|
||||||
if (packages != null && packages.length > 0) {
|
if (packages != null && packages.length > 0) {
|
||||||
@@ -269,19 +255,6 @@ public class MmsServiceBroker extends SystemService {
|
|||||||
configOverrides, downloadedIntent);
|
configOverrides, downloadedIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateMmsSendStatus(int messageRef, byte[] pdu, int status)
|
|
||||||
throws RemoteException {
|
|
||||||
enforceCarrierPrivilege();
|
|
||||||
getServiceGuarded().updateMmsSendStatus(messageRef, pdu, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateMmsDownloadStatus(int messageRef, int status) throws RemoteException {
|
|
||||||
enforceCarrierPrivilege();
|
|
||||||
getServiceGuarded().updateMmsDownloadStatus(messageRef, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bundle getCarrierConfigValues(int subId) throws RemoteException {
|
public Bundle getCarrierConfigValues(int subId) throws RemoteException {
|
||||||
Slog.d(TAG, "getCarrierConfigValues() by " + getCallingPackageName());
|
Slog.d(TAG, "getCarrierConfigValues() by " + getCallingPackageName());
|
||||||
|
|||||||
@@ -60,40 +60,6 @@ interface IMms {
|
|||||||
in Uri contentUri, in Bundle configOverrides,
|
in Uri contentUri, in Bundle configOverrides,
|
||||||
in PendingIntent downloadedIntent);
|
in PendingIntent downloadedIntent);
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the status of a pending (send-by-IP) MMS message handled by the carrier app.
|
|
||||||
* If the carrier app fails to send this message, it may be resent via carrier network
|
|
||||||
* depending on the status code.
|
|
||||||
*
|
|
||||||
* The caller should have carrier privileges.
|
|
||||||
* @see android.telephony.TelephonyManager.hasCarrierPrivileges
|
|
||||||
*
|
|
||||||
* @param messageRef the reference number of the MMS message.
|
|
||||||
* @param pdu non-empty (contains the SendConf PDU) if the message was sent successfully,
|
|
||||||
* otherwise, this param should be null.
|
|
||||||
* @param status send status. It can be Activity.RESULT_OK or one of the MMS error codes.
|
|
||||||
* If status is Activity.RESULT_OK, the MMS was sent successfully.
|
|
||||||
* If status is MMS_ERROR_RETRY, this message would be resent via carrier
|
|
||||||
* network. The message will not be resent for other MMS error statuses.
|
|
||||||
*/
|
|
||||||
void updateMmsSendStatus(int messageRef, in byte[] pdu, in int status);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the status of a pending (download-by-IP) MMS message handled by the carrier app.
|
|
||||||
* If the carrier app fails to download this message, it may be re-downloaded via carrier
|
|
||||||
* network depending on the status code.
|
|
||||||
*
|
|
||||||
* The caller should have carrier privileges.
|
|
||||||
* @see android.telephony.TelephonyManager.hasCarrierPrivileges
|
|
||||||
*
|
|
||||||
* @param messageRef the reference number of the MMS message.
|
|
||||||
* @param status download status. It can be Activity.RESULT_OK or one of the MMS error codes.
|
|
||||||
* If status is Activity.RESULT_OK, the MMS was downloaded successfully.
|
|
||||||
* If status is MMS_ERROR_RETRY, this message would be re-downloaded via carrier
|
|
||||||
* network. The message will not be re-downloaded for other MMS error statuses.
|
|
||||||
*/
|
|
||||||
void updateMmsDownloadStatus(int messageRef, in int status);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get carrier-dependent configuration values.
|
* Get carrier-dependent configuration values.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -223,17 +223,6 @@ interface ISms {
|
|||||||
*/
|
*/
|
||||||
void injectSmsPdu(in byte[] pdu, String format, in PendingIntent receivedIntent);
|
void injectSmsPdu(in byte[] pdu, String format, in PendingIntent receivedIntent);
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the status of a pending (send-by-IP) SMS message and resend by PSTN if necessary.
|
|
||||||
* This outbound message was handled by the carrier app. If the carrier app fails to send
|
|
||||||
* this message, it would be resent by PSTN.
|
|
||||||
*
|
|
||||||
* @param messageRef the reference number of the SMS message.
|
|
||||||
* @param success True if and only if the message was sent successfully. If its value is
|
|
||||||
* false, this message should be resent via PSTN.
|
|
||||||
*/
|
|
||||||
void updateSmsSendStatus(int messageRef, boolean success);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a multi-part text based SMS.
|
* Send a multi-part text based SMS.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user