Merge "Moved data connection response into system api."
diff --git a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
index 997ccea..0fc08c6 100644
--- a/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
+++ b/src/java/com/android/internal/telephony/IccSmsInterfaceManager.java
@@ -78,8 +78,6 @@
     protected static final int EVENT_SET_BROADCAST_CONFIG_DONE = 4;
     private static final int SMS_CB_CODE_SCHEME_MIN = 0;
     private static final int SMS_CB_CODE_SCHEME_MAX = 255;
-    public static final int SMS_MESSAGE_PRIORITY_NOT_SPECIFIED = -1;
-    public static final int SMS_MESSAGE_PERIOD_NOT_SPECIFIED = -1;
 
     protected Phone mPhone;
     final protected Context mContext;
@@ -395,8 +393,7 @@
                 Manifest.permission.SEND_SMS,
                 "Sending SMS message");
         sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
-            persistMessageForNonDefaultSmsApp, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
-            false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED);
+            persistMessageForNonDefaultSmsApp);
     }
 
     /**
@@ -410,8 +407,7 @@
                 Manifest.permission.SEND_SMS,
                 "Sending SMS message");
         sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
-            persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */,
-            SMS_MESSAGE_PERIOD_NOT_SPECIFIED);
+            persistMessage);
     }
 
     /**
@@ -437,39 +433,15 @@
      * @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").
-     * @param persistMessageForNonDefaultSmsApp whether the sent message should
-     *  be automatically persisted in the SMS db. It only affects messages sent
-     *  by a non-default SMS app. Currently only the carrier app can set this
-     *  parameter to false to skip auto message persistence.
-     * @param priority Priority level of the message
-     *  Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
-     *  ---------------------------------
-     *  PRIORITY      | Level of Priority
-     *  ---------------------------------
-     *      '00'      |     Normal
-     *      '01'      |     Interactive
-     *      '10'      |     Urgent
-     *      '11'      |     Emergency
-     *  ----------------------------------
-     *  Any Other values including negative considered as Invalid Priority Indicator of the message.
-     * @param expectMore is a boolean to indicate the sending messages through same link or not.
-     * @param validityPeriod Validity Period of the message in mins.
-     *  Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
-     *  Validity Period(Minimum) -> 5 mins
-     *  Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
-     *  Any Other values including negative considered as Invalid Validity Period of the message.
      */
 
     private void sendTextInternal(String callingPackage, String destAddr, String scAddr,
             String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
-            boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore,
-            int validityPeriod) {
+            boolean persistMessageForNonDefaultSmsApp) {
         if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
             log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr +
                 " text='"+ text + "' sentIntent=" +
-                sentIntent + " deliveryIntent=" + deliveryIntent
-                + " priority=" + priority + " expectMore=" + expectMore
-                + " validityPeriod=" + validityPeriod);
+                sentIntent + " deliveryIntent=" + deliveryIntent);
         }
         if (mAppOps.noteOp(AppOpsManager.OP_SEND_SMS, Binder.getCallingUid(),
                 callingPackage) != AppOpsManager.MODE_ALLOWED) {
@@ -480,65 +452,7 @@
         }
         destAddr = filterDestAddress(destAddr);
         mDispatcher.sendText(destAddr, scAddr, text, sentIntent, deliveryIntent,
-                null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp,
-                priority, expectMore, validityPeriod);
-    }
-
-    /**
-     * Send a text based SMS with Messaging Options.
-     *
-     * @param destAddr the address to send the message to
-     * @param scAddr is the service center address or null to use
-     *  the current 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 successfully 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").
-     * @param persistMessageForNonDefaultSmsApp whether the sent message should
-     *  be automatically persisted in the SMS db. It only affects messages sent
-     *  by a non-default SMS app. Currently only the carrier app can set this
-     *  parameter to false to skip auto message persistence.
-     * @param priority Priority level of the message
-     *  Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
-     *  ---------------------------------
-     *  PRIORITY      | Level of Priority
-     *  ---------------------------------
-     *      '00'      |     Normal
-     *      '01'      |     Interactive
-     *      '10'      |     Urgent
-     *      '11'      |     Emergency
-     *  ----------------------------------
-     *  Any Other values including negative considered as Invalid Priority Indicator of the message.
-     * @param expectMore is a boolean to indicate the sending messages through same link or not.
-     * @param validityPeriod Validity Period of the message in mins.
-     *  Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
-     *  Validity Period(Minimum) -> 5 mins
-     *  Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
-     *  Any Other values including negative considered as Invalid Validity Period of the message.
-     */
-
-    public void sendTextWithOptions(String callingPackage, String destAddr, String scAddr,
-            String text, PendingIntent sentIntent, PendingIntent deliveryIntent,
-            boolean persistMessageForNonDefaultSmsApp, int priority, boolean expectMore,
-            int validityPeriod) {
-        mPhone.getContext().enforceCallingOrSelfPermission(
-                Manifest.permission.SEND_SMS,
-                "Sending SMS message");
-        sendTextInternal(callingPackage, destAddr, scAddr, text, sentIntent, deliveryIntent,
-                persistMessageForNonDefaultSmsApp, priority, expectMore, validityPeriod);
+                null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp);
     }
 
     /**
@@ -590,63 +504,6 @@
     public void sendMultipartText(String callingPackage, String destAddr, String scAddr,
             List<String> parts, List<PendingIntent> sentIntents,
             List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp) {
-        sendMultipartTextWithOptions(callingPackage, destAddr, destAddr, parts, sentIntents,
-                deliveryIntents, persistMessageForNonDefaultSmsApp,
-                SMS_MESSAGE_PRIORITY_NOT_SPECIFIED, false /* expectMore */,
-                SMS_MESSAGE_PERIOD_NOT_SPECIFIED);
-    }
-
-    /**
-     * Send a multi-part text based SMS with Messaging Options.
-     *
-     * @param destAddr the address to send the message to
-     * @param scAddr 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>.
-     *  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 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").
-     * @param persistMessageForNonDefaultSmsApp whether the sent message should
-     *   be automatically persisted in the SMS db. It only affects messages sent
-     *   by a non-default SMS app. Currently only the carrier app can set this
-     *   parameter to false to skip auto message persistence.
-     * @param priority Priority level of the message
-     *  Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
-     *  ---------------------------------
-     *  PRIORITY      | Level of Priority
-     *  ---------------------------------
-     *      '00'      |     Normal
-     *      '01'      |     Interactive
-     *      '10'      |     Urgent
-     *      '11'      |     Emergency
-     *  ----------------------------------
-     *  Any Other values including negative considered as Invalid Priority Indicator of the message.
-     * @param expectMore is a boolean to indicate the sending messages through same link or not.
-     * @param validityPeriod Validity Period of the message in mins.
-     *  Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
-     *  Validity Period(Minimum) -> 5 mins
-     *  Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
-     *  Any Other values including negative considered as Invalid Validity Period of the message.
-     */
-
-    public void sendMultipartTextWithOptions(String callingPackage, String destAddr,
-            String scAddr, List<String> parts, List<PendingIntent> sentIntents,
-            List<PendingIntent> deliveryIntents, boolean persistMessageForNonDefaultSmsApp,
-            int priority, boolean expectMore, int validityPeriod) {
         mPhone.getContext().enforceCallingPermission(
                 Manifest.permission.SEND_SMS,
                 "Sending SMS message");
@@ -657,7 +514,7 @@
         if (Rlog.isLoggable("SMS", Log.VERBOSE)) {
             int i = 0;
             for (String part : parts) {
-                log("sendMultipartTextWithOptions: destAddr=" + destAddr + ", srAddr=" + scAddr +
+                log("sendMultipartText: destAddr=" + destAddr + ", srAddr=" + scAddr +
                         ", part[" + (i++) + "]=" + part);
             }
         }
@@ -692,21 +549,17 @@
                 mDispatcher.sendText(destAddr, scAddr, singlePart,
                         singleSentIntent, singleDeliveryIntent,
                         null/*messageUri*/, callingPackage,
-                        persistMessageForNonDefaultSmsApp,
-                        priority, expectMore, validityPeriod);
+                        persistMessageForNonDefaultSmsApp);
             }
             return;
         }
 
-        mDispatcher.sendMultipartText(destAddr,
-                                      scAddr,
-                                      (ArrayList<String>) parts,
-                                      (ArrayList<PendingIntent>) sentIntents,
-                                      (ArrayList<PendingIntent>) deliveryIntents,
-                                      null, callingPackage, persistMessageForNonDefaultSmsApp,
-                                      priority, expectMore, validityPeriod);
+        mDispatcher.sendMultipartText(destAddr, scAddr, (ArrayList<String>) parts,
+                (ArrayList<PendingIntent>) sentIntents, (ArrayList<PendingIntent>) deliveryIntents,
+                null/*messageUri*/, callingPackage, persistMessageForNonDefaultSmsApp);
     }
 
+
     public int getPremiumSmsPermission(String packageName) {
         return mDispatcher.getPremiumSmsPermission(packageName);
     }
@@ -1100,8 +953,7 @@
         textAndAddress[1] = filterDestAddress(textAndAddress[1]);
         mDispatcher.sendText(textAndAddress[1], scAddress, textAndAddress[0],
                 sentIntent, deliveryIntent, messageUri, callingPkg,
-                true /* persistMessageForNonDefaultSmsApp */, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
-                false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED);
+                true /* persistMessageForNonDefaultSmsApp */);
     }
 
     public void sendStoredMultipartText(String callingPkg, Uri messageUri, String scAddress,
@@ -1157,9 +1009,7 @@
 
                 mDispatcher.sendText(textAndAddress[1], scAddress, singlePart,
                         singleSentIntent, singleDeliveryIntent, messageUri, callingPkg,
-                        true  /* persistMessageForNonDefaultSmsApp */,
-                        SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
-                        false /* expectMore */, SMS_MESSAGE_PERIOD_NOT_SPECIFIED);
+                        true  /* persistMessageForNonDefaultSmsApp */);
             }
             return;
         }
@@ -1172,10 +1022,7 @@
                 (ArrayList<PendingIntent>) deliveryIntents,
                 messageUri,
                 callingPkg,
-                true  /* persistMessageForNonDefaultSmsApp */,
-                SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
-                false /* expectMore */,
-                SMS_MESSAGE_PERIOD_NOT_SPECIFIED);
+                true  /* persistMessageForNonDefaultSmsApp */);
     }
 
     private boolean isFailedOrDraft(ContentResolver resolver, Uri messageUri) {
diff --git a/src/java/com/android/internal/telephony/ImsSMSDispatcher.java b/src/java/com/android/internal/telephony/ImsSMSDispatcher.java
index bc829d6..4d8f62c 100644
--- a/src/java/com/android/internal/telephony/ImsSMSDispatcher.java
+++ b/src/java/com/android/internal/telephony/ImsSMSDispatcher.java
@@ -173,15 +173,13 @@
     public void sendMultipartText(String destAddr, String scAddr,
             ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
             ArrayList<PendingIntent> deliveryIntents, Uri messageUri, String callingPkg,
-            boolean persistMessage, int priority, boolean expectMore, int validityPeriod) {
+            boolean persistMessage) {
         if (isCdmaMo()) {
             mCdmaDispatcher.sendMultipartText(destAddr, scAddr,
-                    parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage,
-                    priority, expectMore, validityPeriod);
+                    parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage);
         } else {
             mGsmDispatcher.sendMultipartText(destAddr, scAddr,
-                    parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage,
-                    priority, expectMore, validityPeriod);
+                    parts, sentIntents, deliveryIntents, messageUri, callingPkg, persistMessage);
         }
     }
 
@@ -201,16 +199,14 @@
     @Override
     public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent,
             PendingIntent deliveryIntent, Uri messageUri, String callingPkg,
-            boolean persistMessage, int priority, boolean expectMore, int validityPeriod) {
+            boolean persistMessage) {
         Rlog.d(TAG, "sendText");
         if (isCdmaMo()) {
             mCdmaDispatcher.sendText(destAddr, scAddr,
-                    text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage,
-                    priority, expectMore, validityPeriod);
+                    text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage);
         } else {
             mGsmDispatcher.sendText(destAddr, scAddr,
-                    text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage,
-                    priority, expectMore, validityPeriod);
+                    text, sentIntent, deliveryIntent, messageUri, callingPkg, persistMessage);
         }
     }
 
@@ -369,7 +365,7 @@
             String message, SmsHeader smsHeader, int format, PendingIntent sentIntent,
             PendingIntent deliveryIntent, boolean lastPart,
             AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri,
-            String fullMessageText, int priority, boolean expectMore, int validityPeriod) {
+            String fullMessageText) {
         Rlog.e(TAG, "Error! Not implemented for IMS.");
         return null;
     }
diff --git a/src/java/com/android/internal/telephony/SMSDispatcher.java b/src/java/com/android/internal/telephony/SMSDispatcher.java
index dc08ec0..2ec5101 100644
--- a/src/java/com/android/internal/telephony/SMSDispatcher.java
+++ b/src/java/com/android/internal/telephony/SMSDispatcher.java
@@ -17,8 +17,6 @@
 package com.android.internal.telephony;
 
 import static android.Manifest.permission.SEND_SMS_NO_CONFIRMATION;
-import static com.android.internal.telephony.IccSmsInterfaceManager.SMS_MESSAGE_PERIOD_NOT_SPECIFIED;
-import static com.android.internal.telephony.IccSmsInterfaceManager.SMS_MESSAGE_PRIORITY_NOT_SPECIFIED;
 import static android.telephony.SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE;
 import static android.telephony.SmsManager.RESULT_ERROR_GENERIC_FAILURE;
 import static android.telephony.SmsManager.RESULT_ERROR_LIMIT_EXCEEDED;
@@ -799,29 +797,10 @@
      * @param callingPkg the calling package name
      * @param persistMessage whether to save the sent message into SMS DB for a
      *   non-default SMS app.
-     *
-     * @param priority Priority level of the message
-     *  Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
-     *  ---------------------------------
-     *  PRIORITY      | Level of Priority
-     *  ---------------------------------
-     *      '00'      |     Normal
-     *      '01'      |     Interactive
-     *      '10'      |     Urgent
-     *      '11'      |     Emergency
-     *  ----------------------------------
-     *  Any Other values included Negative considered as Invalid Priority Indicator of the message.
-     * @param expectMore is a boolean to indicate the sending messages through same link or not.
-     * @param validityPeriod Validity Period of the message in mins.
-     *  Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
-     *  Validity Period(Minimum) -> 5 mins
-     *  Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
-     *  Any Other values included Negative considered as Invalid Validity Period of the message.
      */
     protected abstract void sendText(String destAddr, String scAddr, String text,
             PendingIntent sentIntent, PendingIntent deliveryIntent, Uri messageUri,
-            String callingPkg, boolean persistMessage, int priority, boolean expectMore,
-            int validityPeriod);
+            String callingPkg, boolean persistMessage);
 
     /**
      * Inject an SMS PDU into the android platform.
@@ -873,28 +852,11 @@
      * @param callingPkg the calling package name
      * @param persistMessage whether to save the sent message into SMS DB for a
      *   non-default SMS app.
-     * @param priority Priority level of the message
-     *  Refer specification See 3GPP2 C.S0015-B, v2.0, table 4.5.9-1
-     *  ---------------------------------
-     *  PRIORITY      | Level of Priority
-     *  ---------------------------------
-     *      '00'      |     Normal
-     *      '01'      |     Interactive
-     *      '10'      |     Urgent
-     *      '11'      |     Emergency
-     *  ----------------------------------
-     *  Any Other values included Negative considered as Invalid Priority Indicator of the message.
-     * @param expectMore is a boolean to indicate the sending messages through same link or not.
-     * @param validityPeriod Validity Period of the message in mins.
-     *  Refer specification 3GPP TS 23.040 V6.8.1 section 9.2.3.12.1.
-     *  Validity Period(Minimum) -> 5 mins
-     *  Validity Period(Maximum) -> 635040 mins(i.e.63 weeks).
-     *  Any Other values included Negative considered as Invalid Validity Period of the message.
      */
     protected void sendMultipartText(String destAddr, String scAddr,
             ArrayList<String> parts, ArrayList<PendingIntent> sentIntents,
             ArrayList<PendingIntent> deliveryIntents, Uri messageUri, String callingPkg,
-            boolean persistMessage, int priority, boolean expectMore, int validityPeriod) {
+            boolean persistMessage) {
         final String fullMessageText = getMultipartMessageText(parts);
         int refNumber = getNextConcatenatedRef() & 0x00FF;
         int msgCount = parts.size();
@@ -951,8 +913,7 @@
             trackers[i] =
                 getNewSubmitPduTracker(destAddr, scAddr, parts.get(i), smsHeader, encoding,
                         sentIntent, deliveryIntent, (i == (msgCount - 1)),
-                        unsentPartCount, anyPartFailed, messageUri,
-                        fullMessageText, priority, expectMore, validityPeriod);
+                        unsentPartCount, anyPartFailed, messageUri, fullMessageText);
             trackers[i].mPersistMessage = persistMessage;
         }
 
@@ -982,12 +943,11 @@
     /**
      * Create a new SubmitPdu and return the SMS tracker.
      */
-    protected abstract SmsTracker getNewSubmitPduTracker(String destinationAddress,
-            String scAddress, String message, SmsHeader smsHeader, int encoding,
+    protected abstract SmsTracker getNewSubmitPduTracker(String destinationAddress, String scAddress,
+            String message, SmsHeader smsHeader, int encoding,
             PendingIntent sentIntent, PendingIntent deliveryIntent, boolean lastPart,
-            AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed,
-            Uri messageUri, String fullMessageText,
-            int priority, boolean expectMore, int validityPeriod);
+            AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri,
+            String fullMessageText);
 
     /**
      * Send an SMS
@@ -1360,8 +1320,7 @@
         }
 
         sendMultipartText(destinationAddress, scAddress, parts, sentIntents, deliveryIntents,
-                null/*messageUri*/, null/*callingPkg*/, tracker.mPersistMessage, tracker.mPriority,
-                tracker.mExpectMore, tracker.mValidityPeriod);
+                null/*messageUri*/, null/*callingPkg*/, tracker.mPersistMessage);
     }
 
     /**
@@ -1375,8 +1334,6 @@
         public int mImsRetry; // nonzero indicates initial message was sent over Ims
         public int mMessageRef;
         public boolean mExpectMore;
-        public int mValidityPeriod;
-        public int mPriority;
         String mFormat;
 
         public final PendingIntent mSentIntent;
@@ -1410,9 +1367,8 @@
         private SmsTracker(HashMap<String, Object> data, PendingIntent sentIntent,
                 PendingIntent deliveryIntent, PackageInfo appInfo, String destAddr, String format,
                 AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri,
-                SmsHeader smsHeader, boolean expectMore, String fullMessageText, int subId,
-                boolean isText, boolean persistMessage, int userId, int priority,
-                int validityPeriod) {
+                SmsHeader smsHeader, boolean isExpectMore, String fullMessageText, int subId,
+                boolean isText, boolean persistMessage, int userId) {
             mData = data;
             mSentIntent = sentIntent;
             mDeliveryIntent = deliveryIntent;
@@ -1420,7 +1376,7 @@
             mAppInfo = appInfo;
             mDestAddress = destAddr;
             mFormat = format;
-            mExpectMore = expectMore;
+            mExpectMore = isExpectMore;
             mImsRetry = 0;
             mMessageRef = 0;
             mUnsentPartCount = unsentPartCount;
@@ -1432,8 +1388,6 @@
             mIsText = isText;
             mPersistMessage = persistMessage;
             mUserId = userId;
-            mPriority = priority;
-            mValidityPeriod = validityPeriod;
         }
 
         /**
@@ -1649,8 +1603,7 @@
     protected SmsTracker getSmsTracker(HashMap<String, Object> data, PendingIntent sentIntent,
             PendingIntent deliveryIntent, String format, AtomicInteger unsentPartCount,
             AtomicBoolean anyPartFailed, Uri messageUri, SmsHeader smsHeader,
-            boolean expectMore, String fullMessageText, boolean isText, boolean persistMessage,
-            int priority, int validityPeriod) {
+            boolean isExpectMore, String fullMessageText, boolean isText, boolean persistMessage) {
         // Get calling app package name via UID from Binder call
         PackageManager pm = mContext.getPackageManager();
         String[] packageNames = pm.getPackagesForUid(Binder.getCallingUid());
@@ -1671,27 +1624,16 @@
         // and before displaying the number to the user if confirmation is required.
         String destAddr = PhoneNumberUtils.extractNetworkPortion((String) data.get("destAddr"));
         return new SmsTracker(data, sentIntent, deliveryIntent, appInfo, destAddr, format,
-                unsentPartCount, anyPartFailed, messageUri, smsHeader, expectMore,
-                fullMessageText, getSubId(), isText, persistMessage, userId, priority,
-                validityPeriod);
+                unsentPartCount, anyPartFailed, messageUri, smsHeader, isExpectMore,
+                fullMessageText, getSubId(), isText, persistMessage, userId);
     }
 
     protected SmsTracker getSmsTracker(HashMap<String, Object> data, PendingIntent sentIntent,
-            PendingIntent deliveryIntent, String format, Uri messageUri, boolean expectMore,
+            PendingIntent deliveryIntent, String format, Uri messageUri, boolean isExpectMore,
             String fullMessageText, boolean isText, boolean persistMessage) {
         return getSmsTracker(data, sentIntent, deliveryIntent, format, null/*unsentPartCount*/,
-                null/*anyPartFailed*/, messageUri, null/*smsHeader*/, expectMore,
-                fullMessageText, isText, persistMessage, SMS_MESSAGE_PRIORITY_NOT_SPECIFIED,
-                SMS_MESSAGE_PERIOD_NOT_SPECIFIED);
-    }
-
-    protected SmsTracker getSmsTracker(HashMap<String, Object> data, PendingIntent sentIntent,
-            PendingIntent deliveryIntent, String format, Uri messageUri, boolean expectMore,
-            String fullMessageText, boolean isText, boolean persistMessage, int priority,
-            int validityPeriod) {
-        return getSmsTracker(data, sentIntent, deliveryIntent, format, null/*unsentPartCount*/,
-                null/*anyPartFailed*/, messageUri, null/*smsHeader*/, expectMore, fullMessageText,
-                isText, persistMessage, priority, validityPeriod);
+                null/*anyPartFailed*/, messageUri, null/*smsHeader*/, isExpectMore,
+                fullMessageText, isText, persistMessage);
     }
 
     protected HashMap<String, Object> getSmsTrackerMap(String destAddr, String scAddr,
diff --git a/src/java/com/android/internal/telephony/UiccSmsController.java b/src/java/com/android/internal/telephony/UiccSmsController.java
old mode 100644
new mode 100755
index 59449b8..e6cb972
--- a/src/java/com/android/internal/telephony/UiccSmsController.java
+++ b/src/java/com/android/internal/telephony/UiccSmsController.java
@@ -159,21 +159,6 @@
         }
     }
 
-    @Override
-    public void sendTextForSubscriberWithOptions(int subId, String callingPackage,
-            String destAddr, String scAddr, String parts, PendingIntent sentIntents,
-            PendingIntent deliveryIntents, boolean persistMessage, int priority,
-            boolean expectMore, int validityPeriod) {
-        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
-        if (iccSmsIntMgr != null ) {
-            iccSmsIntMgr.sendTextWithOptions(callingPackage, destAddr, scAddr, parts, sentIntents,
-                    deliveryIntents, persistMessage,  priority, expectMore, validityPeriod);
-        } else {
-            Rlog.e(LOG_TAG,"sendTextWithOptions iccSmsIntMgr is null for" +
-                          " Subscription: " + subId);
-        }
-    }
-
     public void sendMultipartText(String callingPackage, String destAddr, String scAddr,
             List<String> parts, List<PendingIntent> sentIntents,
             List<PendingIntent> deliveryIntents) throws android.os.RemoteException {
@@ -199,22 +184,6 @@
     }
 
     @Override
-    public void sendMultipartTextForSubscriberWithOptions(int subId, String callingPackage,
-            String destAddr, String scAddr, List<String> parts, List<PendingIntent> sentIntents,
-            List<PendingIntent> deliveryIntents, boolean persistMessage, int priority,
-            boolean expectMore, int validityPeriod) {
-        IccSmsInterfaceManager iccSmsIntMgr = getIccSmsInterfaceManager(subId);
-        if (iccSmsIntMgr != null ) {
-            iccSmsIntMgr.sendMultipartTextWithOptions(callingPackage, destAddr, scAddr, parts,
-                    sentIntents, deliveryIntents, persistMessage,  priority, expectMore,
-                    validityPeriod);
-        } else {
-            Rlog.e(LOG_TAG,"sendMultipartTextWithOptions iccSmsIntMgr is null for" +
-                          " Subscription: " + subId);
-        }
-    }
-
-    @Override
     public boolean enableCellBroadcastForSubscriber(int subId, int messageIdentifier, int ranType)
                 throws android.os.RemoteException {
         return enableCellBroadcastRangeForSubscriber(subId, messageIdentifier, messageIdentifier,
diff --git a/src/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java b/src/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
index 080ca1c..1cfdc33 100755
--- a/src/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
+++ b/src/java/com/android/internal/telephony/cdma/CdmaSMSDispatcher.java
@@ -113,7 +113,7 @@
         if (pdu != null) {
             HashMap map = getSmsTrackerMap(destAddr, scAddr, destPort, data, pdu);
             SmsTracker tracker = getSmsTracker(map, sentIntent, deliveryIntent, getFormat(),
-                    null /*messageUri*/, false /*expectMore*/, null /*fullMessageText*/,
+                    null /*messageUri*/, false /*isExpectMore*/, null /*fullMessageText*/,
                     false /*isText*/, true /*persistMessage*/);
 
             String carrierPackage = getCarrierAppPackageName();
@@ -141,14 +141,13 @@
     @Override
     public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent,
             PendingIntent deliveryIntent, Uri messageUri, String callingPkg,
-            boolean persistMessage, int priority, boolean expectMore, int validityPeriod) {
+            boolean persistMessage) {
         SmsMessage.SubmitPdu pdu = SmsMessage.getSubmitPdu(
-                scAddr, destAddr, text, (deliveryIntent != null), null, priority);
+                scAddr, destAddr, text, (deliveryIntent != null), null);
         if (pdu != null) {
             HashMap map = getSmsTrackerMap(destAddr, scAddr, text, pdu);
             SmsTracker tracker = getSmsTracker(map, sentIntent, deliveryIntent, getFormat(),
-                    messageUri, expectMore, text, true /*isText*/, persistMessage,
-                    priority, validityPeriod);
+                    messageUri, false /*isExpectMore*/, text, true /*isText*/, persistMessage);
 
             String carrierPackage = getCarrierAppPackageName();
             if (carrierPackage != null) {
@@ -190,7 +189,7 @@
             String message, SmsHeader smsHeader, int encoding,
             PendingIntent sentIntent, PendingIntent deliveryIntent, boolean lastPart,
             AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri,
-            String fullMessageText, int priority, boolean expectMore, int validityPeriod) {
+            String fullMessageText) {
         UserData uData = new UserData();
         uData.payloadStr = message;
         uData.userDataHeader = smsHeader;
@@ -206,14 +205,14 @@
          * callback to the sender when that last fragment delivery
          * has been acknowledged. */
         SmsMessage.SubmitPdu submitPdu = SmsMessage.getSubmitPdu(destinationAddress,
-                uData, (deliveryIntent != null) && lastPart, priority);
+                uData, (deliveryIntent != null) && lastPart);
 
         HashMap map = getSmsTrackerMap(destinationAddress, scAddress,
                 message, submitPdu);
         return getSmsTracker(map, sentIntent, deliveryIntent,
                 getFormat(), unsentPartCount, anyPartFailed, messageUri, smsHeader,
-                (!lastPart || expectMore), fullMessageText, true /*isText*/,
-                true /*persistMessage*/, priority, validityPeriod);
+                false /*isExpextMore*/, fullMessageText, true /*isText*/,
+                true /*persistMessage*/);
     }
 
     @Override
diff --git a/src/java/com/android/internal/telephony/euicc/EuiccController.java b/src/java/com/android/internal/telephony/euicc/EuiccController.java
index 0d58d80..ac2a039 100644
--- a/src/java/com/android/internal/telephony/euicc/EuiccController.java
+++ b/src/java/com/android/internal/telephony/euicc/EuiccController.java
@@ -411,6 +411,15 @@
                                                 callingToken, subscription, switchAfterDownload,
                                                 callingPackage));
                                 break;
+                            case EuiccService.RESULT_NEED_CONFIRMATION_CODE:
+                                resultCode = RESOLVABLE_ERROR;
+                                addResolutionIntent(extrasIntent,
+                                        EuiccService.ACTION_RESOLVE_CONFIRMATION_CODE,
+                                        callingPackage,
+                                        EuiccOperation.forDownloadConfirmationCode(
+                                                callingToken, subscription, switchAfterDownload,
+                                                callingPackage));
+                                break;
                             default:
                                 resultCode = ERROR;
                                 extrasIntent.putExtra(
diff --git a/src/java/com/android/internal/telephony/euicc/EuiccOperation.java b/src/java/com/android/internal/telephony/euicc/EuiccOperation.java
index 3b0dbc5..148d9dc 100644
--- a/src/java/com/android/internal/telephony/euicc/EuiccOperation.java
+++ b/src/java/com/android/internal/telephony/euicc/EuiccOperation.java
@@ -25,6 +25,7 @@
 import android.service.euicc.EuiccService;
 import android.telephony.euicc.DownloadableSubscription;
 import android.telephony.euicc.EuiccManager;
+import android.text.TextUtils;
 import android.util.Log;
 
 import com.android.internal.annotations.VisibleForTesting;
@@ -60,6 +61,7 @@
             ACTION_GET_METADATA_DEACTIVATE_SIM,
             ACTION_DOWNLOAD_DEACTIVATE_SIM,
             ACTION_DOWNLOAD_NO_PRIVILEGES,
+            ACTION_DOWNLOAD_CONFIRMATION_CODE,
     })
     @interface Action {}
 
@@ -75,6 +77,8 @@
     static final int ACTION_SWITCH_DEACTIVATE_SIM = 5;
     @VisibleForTesting
     static final int ACTION_SWITCH_NO_PRIVILEGES = 6;
+    @VisibleForTesting
+    static final int ACTION_DOWNLOAD_CONFIRMATION_CODE = 7;
 
     @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
     public final @Action int mAction;
@@ -123,6 +127,17 @@
                 subscription,  0 /* subscriptionId */, switchAfterDownload, callingPackage);
     }
 
+    /**
+     * {@link EuiccManager#downloadSubscription} failed with
+     * {@link EuiccService#RESULT_NEED_CONFIRMATION_CODE} error.
+     */
+    public static EuiccOperation forDownloadConfirmationCode(long callingToken,
+            DownloadableSubscription subscription, boolean switchAfterDownload,
+            String callingPackage) {
+        return new EuiccOperation(ACTION_DOWNLOAD_CONFIRMATION_CODE, callingToken,
+                subscription, 0 /* subscriptionId */, switchAfterDownload, callingPackage);
+    }
+
     static EuiccOperation forGetDefaultListDeactivateSim(long callingToken, String callingPackage) {
         return new EuiccOperation(ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM, callingToken,
                 null /* downloadableSubscription */, 0 /* subscriptionId */,
@@ -205,6 +220,11 @@
                         resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT),
                         callbackIntent);
                 break;
+            case ACTION_DOWNLOAD_CONFIRMATION_CODE:
+                resolvedDownloadConfirmationCode(
+                        resolutionExtras.getString(EuiccService.RESOLUTION_EXTRA_CONFIRMATION_CODE),
+                        callbackIntent);
+                break;
             case ACTION_GET_DEFAULT_LIST_DEACTIVATE_SIM:
                 resolvedGetDefaultListDeactivateSim(
                         resolutionExtras.getBoolean(EuiccService.RESOLUTION_EXTRA_CONSENT),
@@ -284,6 +304,22 @@
         }
     }
 
+    private void resolvedDownloadConfirmationCode(String confirmationCode,
+            PendingIntent callbackIntent) {
+        if (TextUtils.isEmpty(confirmationCode)) {
+            fail(callbackIntent);
+        } else {
+            mDownloadableSubscription.setConfirmationCode(confirmationCode);
+            EuiccController.get()
+                    .downloadSubscription(
+                            mDownloadableSubscription,
+                            mSwitchAfterDownload,
+                            mCallingPackage,
+                            true /* forceDeactivateSim */,
+                            callbackIntent);
+        }
+    }
+
     private void resolvedGetDefaultListDeactivateSim(
             boolean consent, PendingIntent callbackIntent) {
         if (consent) {
diff --git a/src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java b/src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
index 6e4a79f..8f18c61 100644
--- a/src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
+++ b/src/java/com/android/internal/telephony/gsm/GsmSMSDispatcher.java
@@ -157,7 +157,7 @@
         if (pdu != null) {
             HashMap map = getSmsTrackerMap(destAddr, scAddr, destPort, data, pdu);
             SmsTracker tracker = getSmsTracker(map, sentIntent, deliveryIntent, getFormat(),
-                    null /*messageUri*/, false /*expectMore*/, null /*fullMessageText*/,
+                    null /*messageUri*/, false /*isExpectMore*/, null /*fullMessageText*/,
                     false /*isText*/, true /*persistMessage*/);
 
             String carrierPackage = getCarrierAppPackageName();
@@ -179,14 +179,14 @@
     @Override
     public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent,
             PendingIntent deliveryIntent, Uri messageUri, String callingPkg,
-            boolean persistMessage, int priority, boolean expectMore, int validityPeriod) {
+            boolean persistMessage) {
         SmsMessage.SubmitPdu pdu = SmsMessage.getSubmitPdu(
-                scAddr, destAddr, text, (deliveryIntent != null), validityPeriod);
+                scAddr, destAddr, text, (deliveryIntent != null));
         if (pdu != null) {
             HashMap map = getSmsTrackerMap(destAddr, scAddr, text, pdu);
             SmsTracker tracker = getSmsTracker(map, sentIntent, deliveryIntent, getFormat(),
-                    messageUri, false /*expectMore*/, text /*fullMessageText*/, true /*isText*/,
-                    persistMessage, priority, validityPeriod);
+                    messageUri, false /*isExpectMore*/, text /*fullMessageText*/, true /*isText*/,
+                    persistMessage);
 
             String carrierPackage = getCarrierAppPackageName();
             if (carrierPackage != null) {
@@ -221,17 +221,17 @@
             String message, SmsHeader smsHeader, int encoding,
             PendingIntent sentIntent, PendingIntent deliveryIntent, boolean lastPart,
             AtomicInteger unsentPartCount, AtomicBoolean anyPartFailed, Uri messageUri,
-            String fullMessageText, int priority, boolean expectMore, int validityPeriod) {
+            String fullMessageText) {
         SmsMessage.SubmitPdu pdu = SmsMessage.getSubmitPdu(scAddress, destinationAddress,
                 message, deliveryIntent != null, SmsHeader.toByteArray(smsHeader),
-                encoding, smsHeader.languageTable, smsHeader.languageShiftTable, validityPeriod);
+                encoding, smsHeader.languageTable, smsHeader.languageShiftTable);
         if (pdu != null) {
             HashMap map =  getSmsTrackerMap(destinationAddress, scAddress,
                     message, pdu);
             return getSmsTracker(map, sentIntent,
                     deliveryIntent, getFormat(), unsentPartCount, anyPartFailed, messageUri,
-                    smsHeader, (!lastPart || expectMore), fullMessageText, true /*isText*/,
-                    false /*persistMessage*/, priority, validityPeriod);
+                    smsHeader, !lastPart, fullMessageText, true /*isText*/,
+                    false /*persistMessage*/);
         } else {
             Rlog.e(TAG, "GsmSMSDispatcher.sendNewSubmitPdu(): getSubmitPdu() returned null");
             return null;
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java
index 87b96d8..e5ab544 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneBase.java
@@ -32,6 +32,7 @@
 import android.telephony.SignalStrength;
 import android.util.Pair;
 
+import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telephony.Call;
 import com.android.internal.telephony.Connection;
 import com.android.internal.telephony.IccCard;
@@ -104,7 +105,8 @@
      *
      * @param cn The connection.
      */
-    protected void startOnHoldTone(Connection cn) {
+    @VisibleForTesting
+    public void startOnHoldTone(Connection cn) {
         Pair<Connection, Boolean> result = new Pair<Connection, Boolean>(cn, Boolean.TRUE);
         mOnHoldRegistrants.notifyRegistrants(new AsyncResult(null, result, null));
     }
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCall.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCall.java
index 52636f5..b90f64f 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCall.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCall.java
@@ -237,8 +237,8 @@
         }
     }
 
-    /*package*/ ImsPhoneConnection
-    getFirstConnection() {
+    @VisibleForTesting
+    public ImsPhoneConnection getFirstConnection() {
         if (mConnections.size() == 0) return null;
 
         return (ImsPhoneConnection) mConnections.get(0);
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
index 18fa3bd..6f41ef1 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
@@ -311,6 +311,7 @@
     private boolean mAllowEmergencyVideoCalls = false;
     private boolean mIgnoreDataEnabledChangedForVideoCalls = false;
     private boolean mIsViLteDataMetered = false;
+    private boolean mAlwaysPlayRemoteHoldTone = false;
 
     /**
      * Listeners to changes in the phone state.  Intended for use by other interested IMS components
@@ -1029,6 +1030,8 @@
                 CarrierConfigManager.KEY_VILTE_DATA_IS_METERED_BOOL);
         mSupportPauseVideo = carrierConfig.getBoolean(
                 CarrierConfigManager.KEY_SUPPORT_PAUSE_IMS_VIDEO_CALLS_BOOL);
+        mAlwaysPlayRemoteHoldTone = carrierConfig.getBoolean(
+                CarrierConfigManager.KEY_ALWAYS_PLAY_REMOTE_HOLD_TONE_BOOL);
 
         String[] mappings = carrierConfig
                 .getStringArray(CarrierConfigManager.KEY_IMS_REASONINFO_MAPPING_STRING_ARRAY);
@@ -2442,38 +2445,7 @@
 
         @Override
         public void onCallHoldReceived(ImsCall imsCall) {
-            if (DBG) log("onCallHoldReceived");
-
-            ImsPhoneConnection conn = findConnection(imsCall);
-            if (conn != null) {
-                if (!mOnHoldToneStarted && ImsPhoneCall.isLocalTone(imsCall) &&
-                        conn.getState() == ImsPhoneCall.State.ACTIVE) {
-                    mPhone.startOnHoldTone(conn);
-                    mOnHoldToneStarted = true;
-                    mOnHoldToneId = System.identityHashCode(conn);
-                }
-                conn.onConnectionEvent(android.telecom.Connection.EVENT_CALL_REMOTELY_HELD, null);
-
-                boolean useVideoPauseWorkaround = mPhone.getContext().getResources().getBoolean(
-                        com.android.internal.R.bool.config_useVideoPauseWorkaround);
-                if (useVideoPauseWorkaround && mSupportPauseVideo &&
-                        VideoProfile.isVideo(conn.getVideoState())) {
-                    // If we are using the video pause workaround, the vendor IMS code has issues
-                    // with video pause signalling.  In this case, when a call is remotely
-                    // held, the modem does not reliably change the video state of the call to be
-                    // paused.
-                    // As a workaround, we will turn on that bit now.
-                    conn.changeToPausedState();
-                }
-            }
-
-            SuppServiceNotification supp = new SuppServiceNotification();
-            // Type of notification: 0 = MO; 1 = MT
-            // Refer SuppServiceNotification class documentation.
-            supp.notificationType = 1;
-            supp.code = SuppServiceNotification.MT_CODE_CALL_ON_HOLD;
-            mPhone.notifySuppSvcNotification(supp);
-            mMetrics.writeOnImsCallHoldReceived(mPhone.getPhoneId(), imsCall.getCallSession());
+            ImsPhoneCallTracker.this.onCallHoldReceived(imsCall);
         }
 
         @Override
@@ -3701,4 +3673,46 @@
                     mPhone.getPhoneId(), mImsFeatureEnabled);
         }
     }
+
+    @VisibleForTesting
+    public void onCallHoldReceived(ImsCall imsCall) {
+        if (DBG) log("onCallHoldReceived");
+
+        ImsPhoneConnection conn = findConnection(imsCall);
+        if (conn != null) {
+            if (!mOnHoldToneStarted && (ImsPhoneCall.isLocalTone(imsCall)
+                    || mAlwaysPlayRemoteHoldTone) &&
+                    conn.getState() == ImsPhoneCall.State.ACTIVE) {
+                mPhone.startOnHoldTone(conn);
+                mOnHoldToneStarted = true;
+                mOnHoldToneId = System.identityHashCode(conn);
+            }
+            conn.onConnectionEvent(android.telecom.Connection.EVENT_CALL_REMOTELY_HELD, null);
+
+            boolean useVideoPauseWorkaround = mPhone.getContext().getResources().getBoolean(
+                    com.android.internal.R.bool.config_useVideoPauseWorkaround);
+            if (useVideoPauseWorkaround && mSupportPauseVideo &&
+                    VideoProfile.isVideo(conn.getVideoState())) {
+                // If we are using the video pause workaround, the vendor IMS code has issues
+                // with video pause signalling.  In this case, when a call is remotely
+                // held, the modem does not reliably change the video state of the call to be
+                // paused.
+                // As a workaround, we will turn on that bit now.
+                conn.changeToPausedState();
+            }
+        }
+
+        SuppServiceNotification supp = new SuppServiceNotification();
+        // Type of notification: 0 = MO; 1 = MT
+        // Refer SuppServiceNotification class documentation.
+        supp.notificationType = 1;
+        supp.code = SuppServiceNotification.MT_CODE_CALL_ON_HOLD;
+        mPhone.notifySuppSvcNotification(supp);
+        mMetrics.writeOnImsCallHoldReceived(mPhone.getPhoneId(), imsCall.getCallSession());
+    }
+
+    @VisibleForTesting
+    public void setAlwaysPlayRemoteHoldTone(boolean shouldPlayRemoteHoldTone) {
+        mAlwaysPlayRemoteHoldTone = shouldPlayRemoteHoldTone;
+    }
 }
diff --git a/tests/telephonytests/src/com/android/internal/telephony/ImsSMSDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/ImsSMSDispatcherTest.java
index ec54b5b..105e0f8 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/ImsSMSDispatcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/ImsSMSDispatcherTest.java
@@ -119,7 +119,7 @@
     public void testSendImsGmsTest() throws Exception {
         switchImsSmsFormat(PhoneConstants.PHONE_TYPE_GSM);
         mImsSmsDispatcher.sendText("111"/* desAddr*/, "222" /*scAddr*/, TAG,
-                null, null, null, null, false, -1, false, -1);
+                null, null, null, null, false);
         verify(mSimulatedCommandsVerifier).sendImsGsmSms(eq("038122f2"),
                 eq("0100038111f1000014c9f67cda9c12d37378983e4697e5d4f29c0e"), eq(0), eq(0),
                 any(Message.class));
@@ -129,7 +129,7 @@
     public void testSendImsGmsTestWithOutDesAddr() throws Exception {
         switchImsSmsFormat(PhoneConstants.PHONE_TYPE_GSM);
         mImsSmsDispatcher.sendText(null, "222" /*scAddr*/, TAG,
-                null, null, null, null, false, -1, false, -1);
+                null, null, null, null, false);
         verify(mSimulatedCommandsVerifier, times(0)).sendImsGsmSms(anyString(), anyString(),
                 anyInt(), anyInt(), any(Message.class));
     }
@@ -138,7 +138,7 @@
     public void testSendImsCdmaTest() throws Exception {
         switchImsSmsFormat(PhoneConstants.PHONE_TYPE_CDMA);
         mImsSmsDispatcher.sendText("111"/* desAddr*/, "222" /*scAddr*/, TAG,
-                null, null, null, null, false, -1, false, -1);
+                null, null, null, null, false);
         verify(mSimulatedCommandsVerifier).sendImsCdmaSms((byte[])any(), eq(0), eq(0),
                 any(Message.class));
     }
@@ -196,4 +196,4 @@
         /* wait for async msg get handled */
         waitForMs(200);
     }
-}
+}
\ No newline at end of file
diff --git a/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsDispatcherTest.java
index a49dc38..a308762 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsDispatcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/cdma/CdmaSmsDispatcherTest.java
@@ -86,14 +86,14 @@
     @Test @SmallTest
     public void testSendText() {
         mCdmaSmsDispatcher.sendText("111"/* desAddr*/, "222" /*scAddr*/, TAG,
-                null, null, null, null, false, -1, false, -1);
+                null, null, null, null, false);
         verify(mSimulatedCommandsVerifier).sendCdmaSms(any(byte[].class), any(Message.class));
     }
 
     @Test @SmallTest
     public void testSendTextWithOutDesAddr() {
         mCdmaSmsDispatcher.sendText(null, "222" /*scAddr*/, TAG,
-                null, null, null, null, false, -1, false, -1);
+                null, null, null, null, false);
         verify(mSimulatedCommandsVerifier, times(0)).sendImsGsmSms(anyString(), anyString(),
                 anyInt(), anyInt(), any(Message.class));
     }
diff --git a/tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java
index bbad22b..94d5066 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/euicc/EuiccControllerTest.java
@@ -350,6 +350,17 @@
     }
 
     @Test
+    public void testDownloadSubscription_needConfirmationCode() throws Exception {
+        setHasWriteEmbeddedPermission(true);
+        callDownloadSubscription(SUBSCRIPTION, false /* switchAfterDownload */, true /* complete */,
+                EuiccService.RESULT_NEED_CONFIRMATION_CODE, "whatever" /* callingPackage */);
+        verifyIntentSent(EuiccManager.EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR,
+                0 /* detailedCode */);
+        verifyResolutionIntent(EuiccService.ACTION_RESOLVE_CONFIRMATION_CODE,
+                EuiccOperation.ACTION_DOWNLOAD_CONFIRMATION_CODE);
+    }
+
+    @Test
     public void testDownloadSubscription_success() throws Exception {
         setHasWriteEmbeddedPermission(true);
         callDownloadSubscription(SUBSCRIPTION, true /* switchAfterDownload */, true /* complete */,
diff --git a/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsDispatcherTest.java
index 5a781b3..0774e8e 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsDispatcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/gsm/GsmSmsDispatcherTest.java
@@ -148,8 +148,8 @@
         when(mCountryDetector.detectCountry())
                 .thenReturn(new Country("US", Country.COUNTRY_SOURCE_SIM));
 
-        mGsmSmsDispatcher.sendText("6501002000", "121" /*scAddr*/, "test sms",
-                null, null, null, null, false, -1, false, -1);
+        mGsmSmsDispatcher.sendText(
+                "6501002000", "121" /*scAddr*/, "test sms", null, null, null, null, false);
 
         verify(mSimulatedCommandsVerifier).sendSMS(anyString(), anyString(), any(Message.class));
         // Blocked number provider is notified about the emergency contact asynchronously.
@@ -169,7 +169,7 @@
 
         mGsmSmsDispatcher.sendText(
                 getEmergencyNumberFromSystemPropertiesOrDefault(), "121" /*scAddr*/, "test sms",
-                null, null, null, null, false, -1, false, -1);
+                null, null, null, null, false);
 
         verify(mSimulatedCommandsVerifier).sendSMS(anyString(), anyString(), any(Message.class));
         // Blocked number provider is notified about the emergency contact asynchronously.
@@ -177,16 +177,6 @@
         assertEquals(1, mFakeBlockedNumberContentProvider.mNumEmergencyContactNotifications);
     }
 
-    @Test @SmallTest
-    public void testSmsMessageValidityPeriod() throws Exception {
-        int vp;
-        vp = SmsMessage.getRelativeValidityPeriod(-5);
-        assertEquals(-1, vp);
-
-        vp = SmsMessage.getRelativeValidityPeriod(100);
-        assertEquals(100 / 5 - 1, vp);
-    }
-
     private String getEmergencyNumberFromSystemPropertiesOrDefault() {
         String systemEmergencyNumbers = SystemProperties.get("ril.ecclist");
         if (systemEmergencyNumbers == null) {
@@ -211,7 +201,7 @@
                 new Intent(TEST_INTENT), 0);
         // send invalid dest address: +
         mGsmSmsDispatcher.sendText("+", "222" /*scAddr*/, TAG,
-                pendingIntent, null, null, null, false, -1, false, -1);
+                pendingIntent, null, null, null, false);
         waitForMs(500);
         verify(mSimulatedCommandsVerifier, times(0)).sendSMS(anyString(), anyString(),
                 any(Message.class));
diff --git a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java
index 989cd64..a341820 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/imsphone/ImsPhoneCallTrackerTest.java
@@ -57,6 +57,7 @@
 import com.android.ims.ImsManager;
 import com.android.ims.ImsReasonInfo;
 import com.android.ims.ImsServiceClass;
+import com.android.ims.ImsStreamMediaProfile;
 import com.android.ims.internal.ImsCallSession;
 import com.android.internal.telephony.Call;
 import com.android.internal.telephony.CallStateException;
@@ -587,4 +588,81 @@
         assertEquals(DisconnectCause.DIAL_LOW_BATTERY, mCTUT.getDisconnectCauseFromReasonInfo(
                 new ImsReasonInfo(ImsReasonInfo.CODE_LOW_BATTERY, 0), Call.State.DIALING));
     }
+
+    /**
+     * Tests that no hold tone is played if the call is remotely held and the media direction is
+     * send/receive (i.e. there is an audio stream present).
+     */
+    @Test
+    @SmallTest
+    public void testNoRemoteHoldtone() {
+        //establish a MT call
+        testImsMTCallAccept();
+        ImsPhoneConnection connection = mCTUT.mForegroundCall.getFirstConnection();
+        ImsCall call = connection.getImsCall();
+
+        // Set the media direction to send/receive.
+        ImsCallProfile callProfile = new ImsCallProfile();
+        callProfile.mMediaProfile.mAudioDirection = ImsStreamMediaProfile.DIRECTION_SEND_RECEIVE;
+        call.setCallProfile(callProfile);
+
+        try {
+            mCTUT.onCallHoldReceived(call);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("unexpected exception thrown" + ex.getMessage());
+        }
+        verify(mImsPhone, never()).startOnHoldTone(nullable(Connection.class));
+    }
+
+    /**
+     * Verifies that a remote hold tone is played when the call is remotely held and the media
+     * direction is inactive (i.e. the audio stream is not playing, so we should play the tone).
+     */
+    @Test
+    @SmallTest
+    public void testRemoteToneInactive() {
+        //establish a MT call
+        testImsMTCallAccept();
+        ImsPhoneConnection connection = mCTUT.mForegroundCall.getFirstConnection();
+        ImsCall call = connection.getImsCall();
+
+        // Set the media direction to inactive to trigger a hold tone.
+        ImsCallProfile callProfile = new ImsCallProfile();
+        callProfile.mMediaProfile.mAudioDirection = ImsStreamMediaProfile.DIRECTION_INACTIVE;
+        call.setCallProfile(callProfile);
+
+        try {
+            mCTUT.onCallHoldReceived(call);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("unexpected exception thrown" + ex.getMessage());
+        }
+        verify(mImsPhone, times(1)).startOnHoldTone(nullable(Connection.class));
+    }
+
+    @Test
+    @SmallTest
+    public void testRemoteHoldtone() {
+        // Set carrier config to always play remote hold tone.
+        mCTUT.setAlwaysPlayRemoteHoldTone(true);
+        //establish a MT call
+        testImsMTCallAccept();
+        ImsPhoneConnection connection = mCTUT.mForegroundCall.getFirstConnection();
+        ImsCall call = connection.getImsCall();
+
+        // Set the media direction to send/receive; normally we don't play a hold tone but the
+        // carrier config option is set to ensure we will do it in this case.
+        ImsCallProfile callProfile = new ImsCallProfile();
+        callProfile.mMediaProfile.mAudioDirection = ImsStreamMediaProfile.DIRECTION_SEND_RECEIVE;
+        call.setCallProfile(callProfile);
+
+        try {
+            mCTUT.onCallHoldReceived(call);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("unexpected exception thrown" + ex.getMessage());
+        }
+        verify(mImsPhone, times(1)).startOnHoldTone(nullable(Connection.class));
+    }
 }