diff options
author | Wink Saville <wink@google.com> | 2013-02-07 17:03:05 -0800 |
---|---|---|
committer | Wink Saville <wink@google.com> | 2013-02-07 17:03:05 -0800 |
commit | 5a72553ef991d4821fcab4feaa3c1b23faca8724 (patch) | |
tree | f97e7fbbe3777c306d531573144cfbb17e52bba2 /telephony/java | |
parent | 484f3bdcd663d4ddc9521e788c45338b34a1691d (diff) | |
download | frameworks_base-5a72553ef991d4821fcab4feaa3c1b23faca8724.zip frameworks_base-5a72553ef991d4821fcab4feaa3c1b23faca8724.tar.gz frameworks_base-5a72553ef991d4821fcab4feaa3c1b23faca8724.tar.bz2 |
Move a few files from frameworks/opt/telephony to frameworks/base.
Because ISms.aidl imports PendingIntent we couldn't easily
make opt/telephony part of the PDK. So this change moves
ISms.aidl and SmsRawData.*, which ISms.aidl also imports,
back to frameworks/base.
Change-Id: Ia64c6e771d5a292d9bfebb413a43f3745df55c85
Diffstat (limited to 'telephony/java')
3 files changed, 299 insertions, 0 deletions
diff --git a/telephony/java/com/android/internal/telephony/ISms.aidl b/telephony/java/com/android/internal/telephony/ISms.aidl new file mode 100644 index 0000000..647f014 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/ISms.aidl @@ -0,0 +1,218 @@ +/* +** Copyright 2007, 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 com.android.internal.telephony; + +import android.app.PendingIntent; +import com.android.internal.telephony.SmsRawData; + +/** Interface for applications to access the ICC phone book. + * + * <p>The following code snippet demonstrates a static method to + * retrieve the ISms interface from Android:</p> + * <pre>private static ISms getSmsInterface() + throws DeadObjectException { + IServiceManager sm = ServiceManagerNative.getDefault(); + ISms ss; + ss = ISms.Stub.asInterface(sm.getService("isms")); + return ss; +} + * </pre> + */ + +interface ISms { + /** + * Retrieves all messages currently stored on ICC. + * + * @return list of SmsRawData of all sms on ICC + */ + List<SmsRawData> getAllMessagesFromIccEf(String callingPkg); + + /** + * Update the specified message on the ICC. + * + * @param messageIndex record index of message to update + * @param newStatus new message status (STATUS_ON_ICC_READ, + * STATUS_ON_ICC_UNREAD, STATUS_ON_ICC_SENT, + * STATUS_ON_ICC_UNSENT, STATUS_ON_ICC_FREE) + * @param pdu the raw PDU to store + * @return success or not + * + */ + boolean updateMessageOnIccEf(String callingPkg, int messageIndex, int newStatus, + in byte[] pdu); + + /** + * Copy a raw SMS PDU to the ICC. + * + * @param pdu the raw PDU to store + * @param status message status (STATUS_ON_ICC_READ, STATUS_ON_ICC_UNREAD, + * STATUS_ON_ICC_SENT, STATUS_ON_ICC_UNSENT) + * @return success or not + * + */ + boolean copyMessageToIccEf(String callingPkg, int status, in byte[] pdu, in byte[] smsc); + + /** + * Send a data SMS. + * + * @param smsc the SMSC to send the message through, or NULL for the + * default SMSC + * @param data the body of the message to send + * @param sentIntent if not NULL this <code>PendingIntent</code> is + * broadcast when the message is sucessfully sent, or failed. + * The result code will be <code>Activity.RESULT_OK<code> for success, + * or one of these errors:<br> + * <code>RESULT_ERROR_GENERIC_FAILURE</code><br> + * <code>RESULT_ERROR_RADIO_OFF</code><br> + * <code>RESULT_ERROR_NULL_PDU</code><br> + * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include + * the extra "errorCode" containing a radio technology specific value, + * generally only useful for troubleshooting.<br> + * The per-application based SMS control checks sentIntent. If sentIntent + * is NULL the caller will be checked against all unknown applicaitons, + * which cause smaller number of SMS to be sent in checking period. + * @param deliveryIntent if not NULL this <code>PendingIntent</code> is + * broadcast when the message is delivered to the recipient. The + * raw pdu of the status report is in the extended data ("pdu"). + */ + void sendData(String callingPkg, in String destAddr, in String scAddr, in int destPort, + in byte[] data, in PendingIntent sentIntent, in PendingIntent deliveryIntent); + + /** + * Send an SMS. + * + * @param smsc the SMSC to send the message through, or NULL for the + * default SMSC + * @param text the body of the message to send + * @param sentIntent if not NULL this <code>PendingIntent</code> is + * broadcast when the message is sucessfully sent, or failed. + * The result code will be <code>Activity.RESULT_OK<code> for success, + * or one of these errors:<br> + * <code>RESULT_ERROR_GENERIC_FAILURE</code><br> + * <code>RESULT_ERROR_RADIO_OFF</code><br> + * <code>RESULT_ERROR_NULL_PDU</code><br> + * For <code>RESULT_ERROR_GENERIC_FAILURE</code> the sentIntent may include + * the extra "errorCode" containing a radio technology specific value, + * generally only useful for troubleshooting.<br> + * The per-application based SMS control checks sentIntent. If sentIntent + * is NULL the caller will be checked against all unknown applications, + * which cause smaller number of SMS to be sent in checking period. + * @param deliveryIntent if not NULL this <code>PendingIntent</code> is + * broadcast when the message is delivered to the recipient. The + * raw pdu of the status report is in the extended data ("pdu"). + */ + void sendText(String callingPkg, in String destAddr, in String scAddr, in String text, + in PendingIntent sentIntent, in PendingIntent deliveryIntent); + + /** + * Send a multi-part text based SMS. + * + * @param destinationAddress the address to send the message to + * @param scAddress is the service center address or null to use + * the current default SMSC + * @param parts an <code>ArrayList</code> of strings that, in order, + * comprise the original message + * @param sentIntents if not null, an <code>ArrayList</code> of + * <code>PendingIntent</code>s (one for each message part) that is + * broadcast when the corresponding message part has been sent. + * The result code will be <code>Activity.RESULT_OK<code> for success, + * or one of these errors: + * <code>RESULT_ERROR_GENERIC_FAILURE</code> + * <code>RESULT_ERROR_RADIO_OFF</code> + * <code>RESULT_ERROR_NULL_PDU</code>. + * @param deliveryIntents if not null, an <code>ArrayList</code> of + * <code>PendingIntent</code>s (one for each message part) that is + * broadcast when the corresponding message part has been delivered + * to the recipient. The raw pdu of the status report is in the + * extended data ("pdu"). + */ + void sendMultipartText(String callingPkg, in String destinationAddress, in String scAddress, + in List<String> parts, in List<PendingIntent> sentIntents, + in List<PendingIntent> deliveryIntents); + + /** + * Enable reception of cell broadcast (SMS-CB) messages with the given + * message identifier. Note that if two different clients enable the same + * message identifier, they must both disable it for the device to stop + * receiving those messages. + * + * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or + * C.R1001-G (3GPP2) + * @return true if successful, false otherwise + * + * @see #disableCellBroadcast(int) + */ + boolean enableCellBroadcast(int messageIdentifier); + + /** + * Disable reception of cell broadcast (SMS-CB) messages with the given + * message identifier. Note that if two different clients enable the same + * message identifier, they must both disable it for the device to stop + * receiving those messages. + * + * @param messageIdentifier Message identifier as specified in TS 23.041 (3GPP) or + * C.R1001-G (3GPP2) + * @return true if successful, false otherwise + * + * @see #enableCellBroadcast(int) + */ + boolean disableCellBroadcast(int messageIdentifier); + + /* + * Enable reception of cell broadcast (SMS-CB) messages with the given + * message identifier range. Note that if two different clients enable + * a message identifier range, they must both disable it for the device + * to stop receiving those messages. + * + * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or + * C.R1001-G (3GPP2) + * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or + * C.R1001-G (3GPP2) + * @return true if successful, false otherwise + * + * @see #disableCellBroadcastRange(int, int) + */ + boolean enableCellBroadcastRange(int startMessageId, int endMessageId); + + /** + * Disable reception of cell broadcast (SMS-CB) messages with the given + * message identifier range. Note that if two different clients enable + * a message identifier range, they must both disable it for the device + * to stop receiving those messages. + * + * @param startMessageId first message identifier as specified in TS 23.041 (3GPP) or + * C.R1001-G (3GPP2) + * @param endMessageId last message identifier as specified in TS 23.041 (3GPP) or + * C.R1001-G (3GPP2) + * @return true if successful, false otherwise + * + * @see #enableCellBroadcastRange(int, int) + */ + boolean disableCellBroadcastRange(int startMessageId, int endMessageId); + + /** + * Returns the premium SMS send permission for the specified package. + * Requires system permission. + */ + int getPremiumSmsPermission(String packageName); + + /** + * Set the SMS send permission for the specified package. + * Requires system permission. + */ + void setPremiumSmsPermission(String packageName, int permission); +} diff --git a/telephony/java/com/android/internal/telephony/SmsRawData.aidl b/telephony/java/com/android/internal/telephony/SmsRawData.aidl new file mode 100644 index 0000000..b0b3e4f --- /dev/null +++ b/telephony/java/com/android/internal/telephony/SmsRawData.aidl @@ -0,0 +1,19 @@ +/* +** Copyright 2007, 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 com.android.internal.telephony; + +parcelable SmsRawData; diff --git a/telephony/java/com/android/internal/telephony/SmsRawData.java b/telephony/java/com/android/internal/telephony/SmsRawData.java new file mode 100644 index 0000000..891d942 --- /dev/null +++ b/telephony/java/com/android/internal/telephony/SmsRawData.java @@ -0,0 +1,62 @@ +/* +** Copyright 2007, 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 com.android.internal.telephony; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * A parcelable holder class of byte[] for ISms aidl implementation + */ +public class SmsRawData implements Parcelable { + byte[] data; + + //Static Methods + public static final Parcelable.Creator<SmsRawData> CREATOR + = new Parcelable.Creator<SmsRawData> (){ + public SmsRawData createFromParcel(Parcel source) { + int size; + size = source.readInt(); + byte[] data = new byte[size]; + source.readByteArray(data); + return new SmsRawData(data); + } + + public SmsRawData[] newArray(int size) { + return new SmsRawData[size]; + } + }; + + // Constructor + public SmsRawData(byte[] data) { + this.data = data; + } + + public byte[] getBytes() { + return data; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(data.length); + dest.writeByteArray(data); + } +} |