Merge "Sort out permission around "instant text response""
diff --git a/api/current.txt b/api/current.txt
index e7d1d54..ac576b1 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -101,6 +101,7 @@
     field public static final java.lang.String RECORD_AUDIO = "android.permission.RECORD_AUDIO";
     field public static final java.lang.String REORDER_TASKS = "android.permission.REORDER_TASKS";
     field public static final deprecated java.lang.String RESTART_PACKAGES = "android.permission.RESTART_PACKAGES";
+    field public static final java.lang.String SEND_RESPOND_VIA_MESSAGE = "android.permission.SEND_RESPOND_VIA_MESSAGE";
     field public static final java.lang.String SEND_SMS = "android.permission.SEND_SMS";
     field public static final java.lang.String SET_ACTIVITY_WATCHER = "android.permission.SET_ACTIVITY_WATCHER";
     field public static final java.lang.String SET_ALARM = "com.android.alarm.permission.SET_ALARM";
@@ -21075,6 +21076,7 @@
     method public boolean isNetworkRoaming();
     method public void listen(android.telephony.PhoneStateListener, int);
     field public static final java.lang.String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE";
+    field public static final java.lang.String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE";
     field public static final int CALL_STATE_IDLE = 0; // 0x0
     field public static final int CALL_STATE_OFFHOOK = 2; // 0x2
     field public static final int CALL_STATE_RINGING = 1; // 0x1
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index e5aca48..5783bf6 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -196,7 +196,7 @@
         android:permissionGroupFlags="personalInfo"
         android:priority="360"/>
 
-  <!-- Allows an application to send SMS messages. -->
+    <!-- Allows an application to send SMS messages. -->
     <permission android:name="android.permission.SEND_SMS"
         android:permissionGroup="android.permission-group.MESSAGES"
         android:protectionLevel="dangerous"
@@ -204,14 +204,13 @@
         android:label="@string/permlab_sendSms"
         android:description="@string/permdesc_sendSms" />
 
-    <!-- Allows an application to send SMS messages via the Messaging app with no user
-         input or confirmation.
-         @hide -->
-    <permission android:name="android.permission.SEND_SMS_NO_CONFIRMATION"
+    <!-- Allows an application (Phone) to send a request to other applications
+         to handle the respond-via-message action during incoming calls. -->
+    <permission android:name="android.permission.SEND_RESPOND_VIA_MESSAGE"
         android:permissionGroup="android.permission-group.MESSAGES"
         android:protectionLevel="signature|system"
-        android:label="@string/permlab_sendSmsNoConfirmation"
-        android:description="@string/permdesc_sendSmsNoConfirmation" />
+        android:label="@string/permlab_sendRespondViaMessageRequest"
+        android:description="@string/permdesc_sendRespondViaMessageRequest" />
 
     <!-- Allows an application to monitor incoming SMS messages, to record
          or perform processing on them. -->
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index aae509e..22f4e2e 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -601,12 +601,12 @@
      This may result in unexpected charges. Malicious apps may cost you money by
      sending messages without your confirmation.</string>
 
-     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permlab_sendSmsNoConfirmation">send SMS messages with no confirmation</string>
-    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
-    <string name="permdesc_sendSmsNoConfirmation">Allows the app to send SMS
-      messages. This may result in unexpected charges. Malicious apps may cost
-      you money by sending messages without your confirmation.</string>
+     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=NONE] -->
+    <string name="permlab_sendRespondViaMessageRequest">send respond-via-message events</string>
+    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR LIMIT=NONE] -->
+    <string name="permdesc_sendRespondViaMessageRequest">Allows the app to send
+      requests to other messaging apps to handle respond-via-message events for incoming
+      calls.</string>
 
     <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
     <string name="permlab_readSms">read your text messages (SMS or MMS)</string>
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index cd2a600..cee66d7 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -126,6 +126,28 @@
             "android.intent.action.PHONE_STATE";
 
     /**
+     * The Phone app sends this intent when a user opts to respond-via-message during an incoming
+     * call. By default, the MMS app consumes this message and sends a text message to the caller. A
+     * third party app can provide this functionality in lieu of MMS app by consuming this Intent
+     * and sending the message using their own messaging system.  The intent contains a URI
+     * describing the recipient, and an EXTRA containg the message itself.
+     * <p>
+     * The intent-filter which consumes this Intent needs to be in a service which requires the
+     * permission SEND_RESPOND_VIA_MESSAGE.
+     *
+     * <p>
+     * {@link #getData} is a URI describing the recipient of the message.
+     * <p>
+     * The {@link android.intent.Intent#EXTRA_TEXT} extra contains the message
+     * to send.
+     * <p>
+     * Output: nothing.
+     */
+    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+    public static final String ACTION_RESPOND_VIA_MESSAGE =
+            "android.intent.action.RESPOND_VIA_MESSAGE";
+
+    /**
      * The lookup key used with the {@link #ACTION_PHONE_STATE_CHANGED} broadcast
      * for a String containing the new call state.
      *