From 2900d4d155cadc374ef51807681a4c21a0e86af6 Mon Sep 17 00:00:00 2001 From: Chad Brubaker Date: Mon, 21 Nov 2016 12:32:15 -0800 Subject: [PATCH] Add single use App specific incoming SMSes This allows applications to request that an upcoming incoming SMS be routed directly to the calling application and to do so without needing the RECEIVE_SMS permission. This is especially important for ephemeral applications which we do not want to have the ability to get the RECEIVE_SMS permission but do want to support SMS based phone number verification. Ephemeral apps can use this API to receive and SMS from their backend but will not be able to access other SMSes on the device. This is done by providing the app a token which when included in a subsequent SMS message causes the application provided PendingIntent to be sent with the SMS message data attached. Test: Verified that an SMS containing the code is routed to the app. Test: runtest --path GsmInboundHandlerTest.java Test: cts-tradefed run cts -m CtsPermission2TestCases Bug: 33047670 Change-Id: Iea60bfd1d3f9b8f013b34a82a480c65006416c4c --- api/current.txt | 1 + api/system-current.txt | 1 + api/test-current.txt | 1 + .../java/com/android/internal/telephony/ISms.aidl | 12 ++++++++++++ 4 files changed, 15 insertions(+) diff --git a/api/current.txt b/api/current.txt index 6bec747426069..59cc4328814c9 100644 --- a/api/current.txt +++ b/api/current.txt @@ -37584,6 +37584,7 @@ package android.telephony { } public final class SmsManager { + method public java.lang.String createAppSpecificSmsToken(android.app.PendingIntent); method public java.util.ArrayList divideMessage(java.lang.String); method public void downloadMultimediaMessage(android.content.Context, java.lang.String, android.net.Uri, android.os.Bundle, android.app.PendingIntent); method public android.os.Bundle getCarrierConfigValues(); diff --git a/api/system-current.txt b/api/system-current.txt index 1f3fd7dc8a93b..141f12f1ad843 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -40664,6 +40664,7 @@ package android.telephony { } public final class SmsManager { + method public java.lang.String createAppSpecificSmsToken(android.app.PendingIntent); method public java.util.ArrayList divideMessage(java.lang.String); method public void downloadMultimediaMessage(android.content.Context, java.lang.String, android.net.Uri, android.os.Bundle, android.app.PendingIntent); method public android.os.Bundle getCarrierConfigValues(); diff --git a/api/test-current.txt b/api/test-current.txt index 4a4bf70a589d5..c9a35798d6f42 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -37678,6 +37678,7 @@ package android.telephony { } public final class SmsManager { + method public java.lang.String createAppSpecificSmsToken(android.app.PendingIntent); method public java.util.ArrayList divideMessage(java.lang.String); method public void downloadMultimediaMessage(android.content.Context, java.lang.String, android.net.Uri, android.os.Bundle, android.app.PendingIntent); method public android.os.Bundle getCarrierConfigValues(); diff --git a/telephony/java/com/android/internal/telephony/ISms.aidl b/telephony/java/com/android/internal/telephony/ISms.aidl index 6115656ee369c..fe37531c06112 100644 --- a/telephony/java/com/android/internal/telephony/ISms.aidl +++ b/telephony/java/com/android/internal/telephony/ISms.aidl @@ -447,4 +447,16 @@ interface ISms { void sendStoredMultipartText(int subId, String callingPkg, in Uri messageUri, String scAddress, in List sentIntents, in List deliveryIntents); + + /** + * Create an app-only incoming SMS request for the calling package. + * + * If an incoming text contains the token returned by this method the provided + * PendingIntent will be sent containing the SMS data. + * + * @param subId the SIM id. + * @param callingPkg the package name of the calling app. + * @param intent PendingIntent to be sent when an SMS is received containing the token. + */ + String createAppSpecificSmsToken(int subId, String callingPkg, in PendingIntent intent); }