Throw SecurityException in sendVisualVoicemailSms()
Previously if the caller is not the active VVM service, the exception
will be consumed by the Binder because it is a oneway method.
This CL changes the method to non-oneway so the caller will receive
the exception. Docs are also updated.
Change-Id: Iedf96539be3958a92e151b926ee069d6edfc4d09
Fixes: 35854031
Test: CTS - VisualVoicemailServiceTest
diff --git a/telephony/java/android/telephony/VisualVoicemailService.java b/telephony/java/android/telephony/VisualVoicemailService.java
index 84833e3..e211f76 100644
--- a/telephony/java/android/telephony/VisualVoicemailService.java
+++ b/telephony/java/android/telephony/VisualVoicemailService.java
@@ -41,6 +41,10 @@
* the SMS filtering chain and may intercept the visual voicemail SMS before it reaches this
* service.
* <p>
+ * To extend this class, The service must be declared in the manifest file with
+ * the {@link android.Manifest.permission#BIND_VISUAL_VOICEMAIL_SERVICE} permission and include an
+ * intent filter with the {@link #SERVICE_INTERFACE} action.
+ * <p>
* Below is an example manifest registration for a {@code VisualVoicemailService}.
* <pre>
* {@code
@@ -260,6 +264,9 @@
* @param port The destination port for data SMS, or 0 for text SMS.
* @param text The message content. For data sms, it will be encoded as a UTF-8 byte stream.
* @param sentIntent The sent intent passed to the {@link SmsManager}
+ *
+ * @throws SecurityException if the caller is not the current default dialer
+ *
* @see SmsManager#sendDataMessage(String, String, short, byte[], PendingIntent, PendingIntent)
* @see SmsManager#sendTextMessage(String, String, String, PendingIntent, PendingIntent)
*/
diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl
index e3816b6..220ea14 100644
--- a/telephony/java/com/android/internal/telephony/ITelephony.aidl
+++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl
@@ -527,7 +527,7 @@
* Send a visual voicemail SMS. Internal use only.
* Requires caller to be the default dialer and have SEND_SMS permission
*/
- oneway void sendVisualVoicemailSmsForSubscriber(in String callingPackage, in int subId,
+ void sendVisualVoicemailSmsForSubscriber(in String callingPackage, in int subId,
in String number, in int port, in String text, in PendingIntent sentIntent);
// Send the special dialer code. The IPC caller must be the current default dialer.