Snap for 6439596 from 30ca4742926f8f7e2468ee451b4c71df918b6877 to qt-aml-tzdata-release

Change-Id: Iecd634be372c9076511f7afa9b85fbae4232140c
diff --git a/Android.mk b/Android.mk
index 09214ba..b21b98f 100644
--- a/Android.mk
+++ b/Android.mk
@@ -48,7 +48,6 @@
 
 LOCAL_AAPT_FLAGS += --version-name "$(version_name_package)"
 LOCAL_AAPT_FLAGS += --version-code $(version_code_package)
-LOCAL_AAPT_FLAGS += --legacy
 
 ifdef TARGET_BUILD_APPS
     LOCAL_JNI_SHARED_LIBRARIES := libframesequence libgiftranscode
@@ -71,12 +70,6 @@
 
 LOCAL_SDK_VERSION := current
 
-LOCAL_PRODUCT_MODULE := true
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_APPS)
-
-LOCAL_COMPATIBILITY_SUITE := general-tests
-
 include $(BUILD_PACKAGE)
 
 include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e23fcc0..58a1817 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -18,7 +18,7 @@
     package="com.android.messaging"
     android:installLocation="internalOnly">
 
-    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="24" />
+    <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
 
     <!-- Application holds CPU wakelock while working in background -->
     <uses-permission android:name="android.permission.WAKE_LOCK" />
@@ -430,7 +430,7 @@
         </activity>
 
         <activity android:name=".ui.SmsStorageLowWarningActivity"
-                  android:theme="@style/Translucent"
+                  android:theme="@style/Invisible"
                   android:configChanges="orientation|screenSize|keyboardHidden" />
 
         <activity android:name=".ui.appsettings.ApnSettingsActivity"
diff --git a/CleanSpec.mk b/CleanSpec.mk
deleted file mode 100644
index 79e4ced..0000000
--- a/CleanSpec.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2017 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.
-#
-
-# If you don't need to do a full clean build but would like to touch
-# a file or delete some intermediate files, add a clean step to the end
-# of the list.  These steps will only be run once, if they haven't been
-# run before.
-#
-# E.g.:
-#     $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
-#     $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
-#
-# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
-# files that are missing or have been moved.
-#
-# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
-# Use $(OUT_DIR) to refer to the "out" directory.
-#
-# If you need to re-do something that's already mentioned, just copy
-# the command and add it to the bottom of the list.  E.g., if a change
-# that you made last week required touching a file and a change you
-# made today requires touching the same file, just copy the old
-# touch step and add it to the end of the list.
-#
-# ************************************************
-# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
-# ************************************************
-
-$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/messaging)
-$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/lib/libgiftranscode.so)
-$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/lib64/libgiftranscode.so)
diff --git a/TEST_MAPPING b/TEST_MAPPING
new file mode 100644
index 0000000..55688d5
--- /dev/null
+++ b/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+  "presubmit": [
+    {
+      "name": "messagingtests"
+    }
+  ]
+}
diff --git a/jni/Android.mk b/jni/Android.mk
index 6b349a8..cb9a69c 100644
--- a/jni/Android.mk
+++ b/jni/Android.mk
@@ -32,6 +32,4 @@
 LOCAL_SDK_VERSION := 19
 LOCAL_NDK_STL_VARIANT := c++_static # LLVM libc++
 
-LOCAL_PRODUCT_MODULE := true
-
 include $(BUILD_SHARED_LIBRARY)
diff --git a/proguard-release.flags b/proguard-release.flags
index 67ae150..36b6720 100644
--- a/proguard-release.flags
+++ b/proguard-release.flags
@@ -12,8 +12,6 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
--keep class com.android.messaging.ui.contact.* { *; }
-
 -assumenosideeffects public class com.android.messaging.util.Trace {
     public void beginSection(...);
     public void endSection(...);
diff --git a/proguard-test.flags b/proguard-test.flags
index 353970a..46e569f 100755
--- a/proguard-test.flags
+++ b/proguard-test.flags
@@ -35,8 +35,6 @@
   !private *;
 }
 
--keep class com.android.messaging.ui.contact.* { *; }
-
 # Keep the classes needed by emma
 -keep class com.vladium.** { *; }
 
diff --git a/proguard.flags b/proguard.flags
index cb04900..44f6ccd 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -21,7 +21,6 @@
 -keepclassmembers class * {
   @com.google.common.annotations.VisibleForTesting *;
 }
--keep class com.android.messaging.ui.contact.* { *; }
 
 # Keep methods that have the @VisibleForAnimation annotation
 -keep @interface com.android.messaging.annotation.VisibleForAnimation
diff --git a/res/layout/apn_preference_layout.xml b/res/layout/apn_preference_layout.xml
index 8b864f6..25a0323 100644
--- a/res/layout/apn_preference_layout.xml
+++ b/res/layout/apn_preference_layout.xml
@@ -38,7 +38,7 @@
         android:background="?android:attr/selectableItemBackground">
 
         <TextView
-            android:id="@+id/title"
+            android:id="@+android:id/title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:focusable="true"
@@ -46,7 +46,7 @@
             android:textAppearance="?android:attr/textAppearanceListItem" />
 
         <TextView
-            android:id="@+id/summary"
+            android:id="@+android:id/summary"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_below="@android:id/title"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0e91156..012d87f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -362,21 +362,21 @@
     <string name="audio_pause_content_description">Pause</string>
 
     <!-- Accessibility announcement for an incoming message -->
-    <string name="incoming_message_announcement">Message from <xliff:g id="sender">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>.</string>
+    <string name="incoming_message_announcement">Message from <xliff:g id="sender">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>.</string>
     <!-- Accessibility description for conversation list for 1:1 conversations -->
-    <string name="one_on_one_incoming_failed_message_prefix">Failed message from <xliff:g id="sender">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>.</string>
-    <string name="one_on_one_incoming_successful_message_prefix">Message from <xliff:g id="sender">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>.</string>
-    <string name="one_on_one_outgoing_draft_message_prefix">Unsent message to <xliff:g id="contact">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>.</string>
-    <string name="one_on_one_outgoing_sending_message_prefix">Sending message to <xliff:g id="contact">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>.</string>
-    <string name="one_on_one_outgoing_failed_message_prefix">Failed message to <xliff:g id="contact">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>.</string>
-    <string name="one_on_one_outgoing_successful_message_prefix">Message to <xliff:g id="contact">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>.</string>
+    <string name="one_on_one_incoming_failed_message_prefix">Failed message from <xliff:g id="sender">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>.</string>
+    <string name="one_on_one_incoming_successful_message_prefix">Message from <xliff:g id="sender">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>.</string>
+    <string name="one_on_one_outgoing_draft_message_prefix">Unsent message to <xliff:g id="contact">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>.</string>
+    <string name="one_on_one_outgoing_sending_message_prefix">Sending message to <xliff:g id="contact">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>.</string>
+    <string name="one_on_one_outgoing_failed_message_prefix">Failed message to <xliff:g id="contact">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>.</string>
+    <string name="one_on_one_outgoing_successful_message_prefix">Message to <xliff:g id="contact">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>.</string>
     <!-- Accessibility description for conversation list for group conversations -->
-    <string name="group_incoming_failed_message_prefix">Failed message from <xliff:g id="sender">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>. <xliff:g id="groupInfo">%4$s</xliff:g>.</string>
-    <string name="group_incoming_successful_message_prefix">Message from <xliff:g id="sender">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>. <xliff:g id="groupInfo">%4$s</xliff:g>.</string>
-    <string name="group_outgoing_draft_message_prefix">Unsent message to <xliff:g id="group">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>.</string>
-    <string name="group_outgoing_sending_message_prefix">Sending message to <xliff:g id="group">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>.</string>
-    <string name="group_outgoing_failed_message_prefix">Failed message to <xliff:g id="group">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>.</string>
-    <string name="group_outgoing_successful_message_prefix">Message to <xliff:g id="group">%1$s</xliff:g>: <xliff:g id="message">%2$s</xliff:g>. Time: <xliff:g id="time">%3$s</xliff:g>.</string>
+    <string name="group_incoming_failed_message_prefix">Failed message from <xliff:g id="sender">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>. <xliff:g id="groupInfo">%s</xliff:g>.</string>
+    <string name="group_incoming_successful_message_prefix">Message from <xliff:g id="sender">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>. <xliff:g id="groupInfo">%s</xliff:g>.</string>
+    <string name="group_outgoing_draft_message_prefix">Unsent message to <xliff:g id="group">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>.</string>
+    <string name="group_outgoing_sending_message_prefix">Sending message to <xliff:g id="group">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>.</string>
+    <string name="group_outgoing_failed_message_prefix">Failed message to <xliff:g id="group">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>.</string>
+    <string name="group_outgoing_successful_message_prefix">Message to <xliff:g id="group">%s</xliff:g>: <xliff:g id="message">%s</xliff:g>. Time: <xliff:g id="time">%s</xliff:g>.</string>
     <!-- Accessibility description for conversation list for failed messages -->
     <string name="failed_message_content_description">Failed message. Tap to retry.</string>
 
@@ -610,7 +610,7 @@
     <!-- The text shown as a label before the message subject input box -->
     <string name="conversation_message_view_subject_text">Subject:\u0020</string>
     <!-- When there's a subject in an mms, the subject + message are shown in a notification -->
-    <string name="notification_subject"><xliff:g id="subject_label">%1$s</xliff:g><xliff:g id="messageText">%2$s</xliff:g></string>
+    <string name="notification_subject"><xliff:g id="subject_label">%s</xliff:g><xliff:g id="messageText">%s</xliff:g></string>
 
     <!-- Text shown on contact VCard when it's being loaded -->
     <string name="loading_vcard">Loading contact card</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 643d044..582c755 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -76,15 +76,6 @@
         <item name="android:windowNoDisplay">true</item>
     </style>
 
-    <style name="Translucent" parent="BugleBaseTheme">
-        <item name="android:windowBackground">@android:color/transparent</item>
-        <item name="android:windowContentOverlay">@null</item>
-        <item name="android:windowIsTranslucent">true</item>
-        <item name="android:windowNoTitle">true</item>
-        <item name="android:windowAnimationStyle">@null</item>
-        <item name="android:windowDisablePreview">true</item>
-    </style>
-
     <style name="BugleActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
         <item name="height">@dimen/action_bar_height</item>
         <item name="displayOptions">showTitle</item>
diff --git a/src/android/support/v7/mms/CarrierConfigValuesLoader.java b/src/android/support/v7/mms/CarrierConfigValuesLoader.java
index 1cb5226..150d92d 100644
--- a/src/android/support/v7/mms/CarrierConfigValuesLoader.java
+++ b/src/android/support/v7/mms/CarrierConfigValuesLoader.java
@@ -174,7 +174,7 @@
     /**
      * String value: name for the user agent profile HTTP header
      */
-    public static final String CONFIG_UA_PROF_TAG_NAME = "uaProfTagName";
+    public static final String CONFIG_UA_PROF_TAG_NAME = "mUaProfTagName";
     public static final String CONFIG_UA_PROF_TAG_NAME_DEFAULT = "x-wap-profile";
     /**
      * String value: additional HTTP headers for MMS HTTP requests.
@@ -195,14 +195,4 @@
      */
     public static final String CONFIG_NAI_SUFFIX = "naiSuffix";
     public static final String CONFIG_NAI_SUFFIX_DEFAULT = null;
-    /**
-     * String value: Url for user agent profile
-     */
-    public static final String CONFIG_UA_PROF_URL = "uaProfUrl";
-    public static final String CONFIG_UA_PROF_URL_DEFAULT = null;
-    /**
-     * String value: user agent
-     */
-    public static final String CONFIG_USER_AGENT = "userAgent";
-    public static final String CONFIG_USER_AGENT_DEFAULT = null;
 }
diff --git a/src/com/android/messaging/datamodel/action/DownloadMmsAction.java b/src/com/android/messaging/datamodel/action/DownloadMmsAction.java
index 2852a61..7a8c907 100644
--- a/src/com/android/messaging/datamodel/action/DownloadMmsAction.java
+++ b/src/com/android/messaging/datamodel/action/DownloadMmsAction.java
@@ -82,7 +82,6 @@
     private static final String KEY_SUB_PHONE_NUMBER = "sub_phone_number";
     private static final String KEY_AUTO_DOWNLOAD = "auto_download";
     private static final String KEY_FAILURE_STATUS = "failure_status";
-    private static final String KEY_EXPIRY = "expiry";
 
     // Values we attach to the pending intent that's fired when the message is downloaded.
     // Only applicable when downloading via the platform APIs on L+.
@@ -98,7 +97,6 @@
     public static final String EXTRA_CONVERSATION_ID = "conversation_id";
     public static final String EXTRA_PARTICIPANT_ID = "participant_id";
     public static final String EXTRA_STATUS_IF_FAILED = "status_if_failed";
-    public static final String EXTRA_EXPIRY = "expiry";
 
     private DownloadMmsAction() {
         super();
@@ -132,7 +130,6 @@
             actionParameters.putString(KEY_TRANSACTION_ID, message.getMmsTransactionId());
             actionParameters.putParcelable(KEY_NOTIFICATION_URI, notificationUri);
             actionParameters.putBoolean(KEY_AUTO_DOWNLOAD, isAutoDownload(status));
-            actionParameters.putLong(KEY_EXPIRY, message.getMmsExpiry());
 
             final long now = System.currentTimeMillis();
             if (message.getInDownloadWindow(now)) {
@@ -242,7 +239,6 @@
         final String conversationId = actionParameters.getString(KEY_CONVERSATION_ID);
         final String participantId = actionParameters.getString(KEY_PARTICIPANT_ID);
         final int statusIfFailed = actionParameters.getInt(KEY_FAILURE_STATUS);
-        final long expiry = actionParameters.getLong(KEY_EXPIRY);
 
         final long receivedTimestampRoundedToSecond =
                 1000 * ((System.currentTimeMillis() + 500) / 1000);
@@ -260,7 +256,7 @@
         // Start the download
         final MmsUtils.StatusPlusUri status = MmsUtils.downloadMmsMessage(context,
                 notificationUri, subId, subPhoneNumber, transactionId, contentLocation,
-                autoDownload, receivedTimestampRoundedToSecond / 1000L, expiry / 1000L, extras);
+                autoDownload, receivedTimestampRoundedToSecond / 1000L, extras);
         if (status == MmsUtils.STATUS_PENDING) {
             // Async download; no status yet
             if (LogUtil.isLoggable(TAG, LogUtil.DEBUG)) {
diff --git a/src/com/android/messaging/datamodel/action/ProcessDownloadedMmsAction.java b/src/com/android/messaging/datamodel/action/ProcessDownloadedMmsAction.java
index 07e2cfb..757ea05 100644
--- a/src/com/android/messaging/datamodel/action/ProcessDownloadedMmsAction.java
+++ b/src/com/android/messaging/datamodel/action/ProcessDownloadedMmsAction.java
@@ -78,7 +78,6 @@
     private static final String KEY_CONTENT_LOCATION = "content_location";
     private static final String KEY_AUTO_DOWNLOAD = "auto_download";
     private static final String KEY_RECEIVED_TIMESTAMP = "received_timestamp";
-    private static final String KEY_EXPIRY = "expiry";
 
     // Set when message downloaded by us (legacy)
     private static final String KEY_STATUS = "status";
@@ -131,7 +130,6 @@
         params.putString(KEY_PARTICIPANT_ID, participantId);
         params.putInt(KEY_STATUS_IF_FAILED,
                 extras.getInt(DownloadMmsAction.EXTRA_STATUS_IF_FAILED));
-        params.putLong(KEY_EXPIRY, extras.getLong(DownloadMmsAction.EXTRA_EXPIRY));
         action.start();
     }
 
@@ -281,7 +279,6 @@
                                 KEY_AUTO_DOWNLOAD);
                         final long receivedTimestampInSeconds =
                                 actionParameters.getLong(KEY_RECEIVED_TIMESTAMP);
-                        final long expiry = actionParameters.getLong(KEY_EXPIRY);
 
                         // Inform sync we're adding a message to telephony
                         final SyncManager syncManager = DataModel.get().getSyncManager();
@@ -291,7 +288,7 @@
                                 MmsUtils.insertDownloadedMessageAndSendResponse(context,
                                         notificationUri, subId, subPhoneNumber, transactionId,
                                         contentLocation, autoDownload, receivedTimestampInSeconds,
-                                        expiry, retrieveConf);
+                                        retrieveConf);
                         status = result.status;
                         rawStatus = result.rawStatus;
                         mmsUri = result.uri;
diff --git a/src/com/android/messaging/datamodel/action/SyncMessageBatch.java b/src/com/android/messaging/datamodel/action/SyncMessageBatch.java
index a623666..972d691 100644
--- a/src/com/android/messaging/datamodel/action/SyncMessageBatch.java
+++ b/src/com/android/messaging/datamodel/action/SyncMessageBatch.java
@@ -202,11 +202,11 @@
         // For a message we sync either
         if (isOutgoing) {
             // Outgoing message not yet been sent
-            if (type == Telephony.Sms.MESSAGE_TYPE_FAILED
-                    || type == Telephony.Sms.MESSAGE_TYPE_OUTBOX
-                    || type == Telephony.Sms.MESSAGE_TYPE_QUEUED
-                    || (type == Telephony.Sms.MESSAGE_TYPE_SENT
-                            && status >= Telephony.Sms.STATUS_FAILED)) {
+            if (type == Telephony.Sms.MESSAGE_TYPE_FAILED ||
+                    type == Telephony.Sms.MESSAGE_TYPE_OUTBOX ||
+                    type == Telephony.Sms.MESSAGE_TYPE_QUEUED ||
+                    (type == Telephony.Sms.MESSAGE_TYPE_SENT &&
+                     status == Telephony.Sms.STATUS_FAILED)) {
                 // Not sent counts as failed and available for manual resend
                 bugleStatus = MessageData.BUGLE_STATUS_OUTGOING_FAILED;
             } else if (status == Sms.STATUS_COMPLETE) {
diff --git a/src/com/android/messaging/datamodel/data/MessageData.java b/src/com/android/messaging/datamodel/data/MessageData.java
index cb5311e..a3698a9 100644
--- a/src/com/android/messaging/datamodel/data/MessageData.java
+++ b/src/com/android/messaging/datamodel/data/MessageData.java
@@ -540,10 +540,6 @@
         return mSeen;
     }
 
-    public final long getMmsExpiry() {
-        return mMmsExpiry;
-    }
-
     /**
      * For incoming MMS messages this returns the retrieve-status value
      * For sent MMS messages this returns the response-status value
diff --git a/src/com/android/messaging/datamodel/data/SelfParticipantsData.java b/src/com/android/messaging/datamodel/data/SelfParticipantsData.java
index f389a78..fc4027f 100644
--- a/src/com/android/messaging/datamodel/data/SelfParticipantsData.java
+++ b/src/com/android/messaging/datamodel/data/SelfParticipantsData.java
@@ -20,8 +20,6 @@
 import androidx.collection.ArrayMap;
 
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 
 import com.android.messaging.util.OsUtil;
@@ -63,15 +61,6 @@
                 list.add(self);
             }
         }
-        Collections.sort(
-                list,
-                new Comparator() {
-                    public int compare(Object o1, Object o2) {
-                        int slotId1 = ((ParticipantData) o1).getSlotId();
-                        int slotId2 = ((ParticipantData) o2).getSlotId();
-                        return slotId1 > slotId2 ? 1 : -1;
-                    }
-                });
         return list;
     }
 
diff --git a/src/com/android/messaging/receiver/SendStatusReceiver.java b/src/com/android/messaging/receiver/SendStatusReceiver.java
index c1b2bca..fc0e8c9 100644
--- a/src/com/android/messaging/receiver/SendStatusReceiver.java
+++ b/src/com/android/messaging/receiver/SendStatusReceiver.java
@@ -20,7 +20,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.net.Uri;
-import android.provider.Telephony.Sms;
 import android.telephony.SmsMessage;
 
 import com.android.messaging.datamodel.action.ProcessDeliveryReportAction;
@@ -52,7 +51,7 @@
     public static final String EXTRA_PART_ID = "partId";
     public static final String EXTRA_SUB_ID = "subId";
 
-    public static final int NO_ERROR_CODE = -1;
+    public static final int NO_ERROR_CODE = 0;
     public static final int NO_PART_ID = -1;
 
     @Override
@@ -82,32 +81,9 @@
                 LogUtil.e(LogUtil.BUGLE_TAG, "SendStatusReceiver: empty report message");
                 return;
             }
-            int status = Sms.STATUS_COMPLETE;
+            int status = 0;
             try {
-                final String format = intent.getStringExtra("format");
                 status = smsMessage.getStatus();
-                // Simple matching up CDMA status with GSM status.
-                if (SmsMessage.FORMAT_3GPP2.equals(format)) {
-                    final int errorClass = (status >> 24) & 0x03;
-                    final int statusCode = (status >> 16) & 0x3f;
-                    switch (errorClass) {
-                        case 0: /*ERROR_NONE*/
-                            if (statusCode == 0x02 /*STATUS_DELIVERED*/) {
-                                status = Sms.STATUS_COMPLETE;
-                            } else status = Sms.STATUS_PENDING;
-                            break;
-                        case 2: /*ERROR_TEMPORARY*/
-                            // TODO: Need to check whether SC still trying to deliver the SMS to
-                            // destination and will send the report again?
-                            status = Sms.STATUS_PENDING;
-                            break;
-                        case 3: /*ERROR_PERMANENT*/
-                            status = Sms.STATUS_FAILED;
-                            break;
-                        default:
-                            status = Sms.STATUS_PENDING;
-                    }
-                }
             } catch (final NullPointerException e) {
                 // Sometimes, SmsMessage.mWrappedSmsMessage is null causing NPE when we access
                 // the methods on it although the SmsMessage itself is not null.
diff --git a/src/com/android/messaging/receiver/SmsReceiver.java b/src/com/android/messaging/receiver/SmsReceiver.java
index f1f9bcd..859beff 100644
--- a/src/com/android/messaging/receiver/SmsReceiver.java
+++ b/src/com/android/messaging/receiver/SmsReceiver.java
@@ -186,14 +186,13 @@
             return;
         }
 
-        final int errorCode =
-                intent.getIntExtra(EXTRA_ERROR_CODE, SendStatusReceiver.NO_ERROR_CODE);
+        final int errorCode = intent.getIntExtra(EXTRA_ERROR_CODE, 0);
         // Always convert negative subIds into -1
         int subId = PhoneUtils.getDefault().getEffectiveIncomingSubIdFromSystem(
                 intent, EXTRA_SUB_ID);
         deliverSmsMessages(context, subId, errorCode, messages);
         if (MmsUtils.isDumpSmsEnabled()) {
-            final String format = intent.getStringExtra("format");
+            final String format = null;
             DebugUtils.dumpSms(messages[0].getTimestampMillis(), messages, format);
         }
     }
diff --git a/src/com/android/messaging/sms/MmsConfig.java b/src/com/android/messaging/sms/MmsConfig.java
index 187e677..5649be4 100755
--- a/src/com/android/messaging/sms/MmsConfig.java
+++ b/src/com/android/messaging/sms/MmsConfig.java
@@ -90,8 +90,6 @@
         sKeyTypeMap.put(CarrierConfigValuesLoader.CONFIG_HTTP_PARAMS, KEY_TYPE_STRING);
         sKeyTypeMap.put(CarrierConfigValuesLoader.CONFIG_EMAIL_GATEWAY_NUMBER, KEY_TYPE_STRING);
         sKeyTypeMap.put(CarrierConfigValuesLoader.CONFIG_NAI_SUFFIX, KEY_TYPE_STRING);
-        sKeyTypeMap.put(CarrierConfigValuesLoader.CONFIG_UA_PROF_URL, KEY_TYPE_STRING);
-        sKeyTypeMap.put(CarrierConfigValuesLoader.CONFIG_USER_AGENT, KEY_TYPE_STRING);
     }
 
     // A map that stores all MmsConfigs, one per active subscription. For pre-LMSim, this will
diff --git a/src/com/android/messaging/sms/MmsUtils.java b/src/com/android/messaging/sms/MmsUtils.java
index fbecd8b..9c4c2d5 100644
--- a/src/com/android/messaging/sms/MmsUtils.java
+++ b/src/com/android/messaging/sms/MmsUtils.java
@@ -952,7 +952,7 @@
     // Persist a received MMS message in telephony
     public static Uri insertReceivedMmsMessage(final Context context,
             final RetrieveConf retrieveConf, final int subId, final String subPhoneNumber,
-            final long receivedTimestampInSeconds, final long expiry, final String transactionId) {
+            final long receivedTimestampInSeconds, final String contentLocation) {
         final PduPersister persister = PduPersister.getPduPersister(context);
         Uri uri = null;
         try {
@@ -963,13 +963,12 @@
                     subPhoneNumber,
                     null/*preOpenedFiles*/);
 
-            final ContentValues values = new ContentValues(3);
+            final ContentValues values = new ContentValues(2);
             // Update mms table with local time instead of PDU time
             values.put(Mms.DATE, receivedTimestampInSeconds);
-            // Also update the transaction id and the expiry from NotificationInd so that
-            // wap push dedup would work even after the wap push is deleted.
-            values.put(Mms.TRANSACTION_ID, transactionId);
-            values.put(Mms.EXPIRY, expiry);
+            // Also update the content location field from NotificationInd so that
+            // wap push dedup would work even after the wap push is deleted
+            values.put(Mms.CONTENT_LOCATION, contentLocation);
             SqliteWrapper.update(context, context.getContentResolver(), uri, values, null, null);
             if (LogUtil.isLoggable(TAG, LogUtil.DEBUG)) {
                 LogUtil.d(TAG, "MmsUtils: Inserted MMS message into telephony, uri: " + uri);
@@ -1195,8 +1194,7 @@
 
     public static SmsMessage getSmsMessageFromDeliveryReport(final Intent intent) {
         final byte[] pdu = intent.getByteArrayExtra("pdu");
-        final String format = intent.getStringExtra("format");
-        return SmsMessage.createFromPdu(pdu, format);
+        return SmsMessage.createFromPdu(pdu);
     }
 
     /**
@@ -1844,7 +1842,7 @@
     public static StatusPlusUri downloadMmsMessage(final Context context, final Uri notificationUri,
             final int subId, final String subPhoneNumber, final String transactionId,
             final String contentLocation, final boolean autoDownload,
-            final long receivedTimestampInSeconds, final long expiry, Bundle extras) {
+            final long receivedTimestampInSeconds, Bundle extras) {
         if (TextUtils.isEmpty(contentLocation)) {
             LogUtil.e(TAG, "MmsUtils: Download from empty content location URL");
             return new StatusPlusUri(
@@ -1895,14 +1893,13 @@
                 extras.putBoolean(DownloadMmsAction.EXTRA_AUTO_DOWNLOAD, autoDownload);
                 extras.putLong(DownloadMmsAction.EXTRA_RECEIVED_TIMESTAMP,
                         receivedTimestampInSeconds);
-                extras.putLong(DownloadMmsAction.EXTRA_EXPIRY, expiry);
 
                 MmsSender.downloadMms(context, subId, contentLocation, extras);
                 return STATUS_PENDING; // Download happens asynchronously; no status to return
             }
             return insertDownloadedMessageAndSendResponse(context, notificationUri, subId,
                     subPhoneNumber, transactionId, contentLocation, autoDownload,
-                    receivedTimestampInSeconds, expiry, retrieveConf);
+                    receivedTimestampInSeconds, retrieveConf);
 
         } catch (final MmsFailureException e) {
             LogUtil.e(TAG, "MmsUtils: failed to download message " + notificationUri, e);
@@ -1917,8 +1914,8 @@
             final Uri notificationUri, final int subId, final String subPhoneNumber,
             final String transactionId, final String contentLocation,
             final boolean autoDownload, final long receivedTimestampInSeconds,
-            final long expiry, final RetrieveConf retrieveConf) {
-        final byte[] notificationTransactionId = stringToBytes(transactionId, "UTF-8");
+            final RetrieveConf retrieveConf) {
+        final byte[] transactionIdBytes = stringToBytes(transactionId, "UTF-8");
         Uri messageUri = null;
         int status = MMS_REQUEST_MANUAL_RETRY;
         int retrieveStatus = PDU_HEADER_VALUE_UNDEFINED;
@@ -1943,31 +1940,22 @@
         if (status == MMS_REQUEST_SUCCEEDED) {
             // Send response of the notification
             if (autoDownload) {
-                sendNotifyResponseForMmsDownload(
-                        context,
-                        subId,
-                        notificationTransactionId,
-                        contentLocation,
-                        PduHeaders.STATUS_RETRIEVED);
+                sendNotifyResponseForMmsDownload(context, subId, transactionIdBytes,
+                        contentLocation, PduHeaders.STATUS_RETRIEVED);
             } else {
-                sendAcknowledgeForMmsDownload(
-                        context, subId, retrieveConf.getTransactionId(), contentLocation);
+                sendAcknowledgeForMmsDownload(context, subId, transactionIdBytes, contentLocation);
             }
 
             // Insert downloaded message into telephony
             final Uri inboxUri = MmsUtils.insertReceivedMmsMessage(context, retrieveConf, subId,
-                    subPhoneNumber, receivedTimestampInSeconds, expiry, transactionId);
+                    subPhoneNumber, receivedTimestampInSeconds, contentLocation);
             messageUri = ContentUris.withAppendedId(Mms.CONTENT_URI, ContentUris.parseId(inboxUri));
         } else if (status == MMS_REQUEST_AUTO_RETRY) {
             // For a retry do nothing
         } else if (status == MMS_REQUEST_MANUAL_RETRY && autoDownload) {
             // Failure from autodownload - just treat like manual download
-            sendNotifyResponseForMmsDownload(
-                    context,
-                    subId,
-                    notificationTransactionId,
-                    contentLocation,
-                    PduHeaders.STATUS_DEFERRED);
+            sendNotifyResponseForMmsDownload(context, subId, transactionIdBytes,
+                    contentLocation, PduHeaders.STATUS_DEFERRED);
         }
         return new StatusPlusUri(status, retrieveStatus, messageUri);
     }
@@ -2173,28 +2161,57 @@
                     uri, values, null, null);
     }
 
-    // Selection for dedup algorithm:
-    // ((m_type=NOTIFICATION_IND) OR (m_type=RETRIEVE_CONF)) AND (exp>NOW)) AND (t_id=xxxxxx)
-    // i.e. If it is NotificationInd or RetrieveConf and not expired
-    //      AND transaction id is the input id
+    // Selection for new dedup algorithm:
+    // ((m_type<>130) OR (exp>NOW)) AND (date>NOW-7d) AND (date<NOW+7d) AND (ct_l=xxxxxx)
+    // i.e. If it is NotificationInd and not expired or not NotificationInd
+    //      AND message is received with +/- 7 days from now
+    //      AND content location is the input URL
     private static final String DUP_NOTIFICATION_QUERY_SELECTION =
-            "((" + Mms.MESSAGE_TYPE + "=?) OR (" + Mms.MESSAGE_TYPE + "=?)) AND ("
-                    + Mms.EXPIRY + ">?) AND (" + Mms.TRANSACTION_ID + "=?)";
+            "((" + Mms.MESSAGE_TYPE + "<>?) OR (" + Mms.EXPIRY + ">?)) AND ("
+                    + Mms.DATE + ">?) AND (" + Mms.DATE + "<?) AND (" + Mms.CONTENT_LOCATION +
+                    "=?)";
+    // Selection for old behavior: only checks NotificationInd and its content location
+    private static final String DUP_NOTIFICATION_QUERY_SELECTION_OLD =
+            "(" + Mms.MESSAGE_TYPE + "=?) AND (" + Mms.CONTENT_LOCATION + "=?)";
 
     private static final int MAX_RETURN = 32;
     private static String[] getDupNotifications(final Context context, final NotificationInd nInd) {
-        final byte[] rawTransactionId = nInd.getTransactionId();
-        if (rawTransactionId != null) {
-            // dedup algorithm
-            String selection = DUP_NOTIFICATION_QUERY_SELECTION;
-            final long nowSecs = System.currentTimeMillis() / 1000;
-            String[] selectionArgs = new String[] {
-                    Integer.toString(PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND),
-                    Integer.toString(PduHeaders.MESSAGE_TYPE_RETRIEVE_CONF),
-                    Long.toString(nowSecs),
-                    new String(rawTransactionId)
-            };
-
+        final byte[] rawLocation = nInd.getContentLocation();
+        if (rawLocation != null) {
+            final String location = new String(rawLocation);
+            // We can not be sure if the content location of an MMS is globally and historically
+            // unique. So we limit the dedup time within the last 7 days
+            // (or configured by gservices remotely). If the same content location shows up after
+            // that, we will download regardless. Duplicated message is better than no message.
+            String selection;
+            String[] selectionArgs;
+            final long timeLimit = BugleGservices.get().getLong(
+                    BugleGservicesKeys.MMS_WAP_PUSH_DEDUP_TIME_LIMIT_SECS,
+                    BugleGservicesKeys.MMS_WAP_PUSH_DEDUP_TIME_LIMIT_SECS_DEFAULT);
+            if (timeLimit > 0) {
+                // New dedup algorithm
+                selection = DUP_NOTIFICATION_QUERY_SELECTION;
+                final long nowSecs = System.currentTimeMillis() / 1000;
+                final long timeLowerBoundSecs = nowSecs - timeLimit;
+                // Need upper bound to protect against clock change so that a message has a time
+                // stamp in the future
+                final long timeUpperBoundSecs = nowSecs + timeLimit;
+                selectionArgs = new String[] {
+                        Integer.toString(PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND),
+                        Long.toString(nowSecs),
+                        Long.toString(timeLowerBoundSecs),
+                        Long.toString(timeUpperBoundSecs),
+                        location
+                };
+            } else {
+                // If time limit is 0, we revert back to old behavior in case the new
+                // dedup algorithm behaves badly
+                selection = DUP_NOTIFICATION_QUERY_SELECTION_OLD;
+                selectionArgs = new String[] {
+                        Integer.toString(PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND),
+                        location
+                };
+            }
             Cursor cursor = null;
             try {
                 cursor = SqliteWrapper.query(
@@ -2331,7 +2348,7 @@
                 } else {
                     LogUtil.w(TAG, "Received WAP Push is a dup: " + Joiner.on(',').join(dups));
                     if (LogUtil.isLoggable(TAG, LogUtil.VERBOSE)) {
-                        LogUtil.w(TAG, "Dup Transaction Id=" + new String(nInd.getTransactionId()));
+                        LogUtil.w(TAG, "Dup WAP Push url=" + new String(nInd.getContentLocation()));
                     }
                 }
                 break;
diff --git a/src/com/android/messaging/ui/BlockedParticipantsActivity.java b/src/com/android/messaging/ui/BlockedParticipantsActivity.java
index 8d79155..b740264 100644
--- a/src/com/android/messaging/ui/BlockedParticipantsActivity.java
+++ b/src/com/android/messaging/ui/BlockedParticipantsActivity.java
@@ -16,10 +16,12 @@
 
 package com.android.messaging.ui;
 
+import android.app.Fragment;
 import android.os.Bundle;
 import android.view.MenuItem;
 
 import com.android.messaging.R;
+import com.android.messaging.util.Assert;
 
 /**
  * Show a list of currently blocked participants.
@@ -35,6 +37,11 @@
     }
 
     @Override
+    public void onAttachFragment(final Fragment fragment) {
+        Assert.isTrue(fragment instanceof BlockedParticipantsFragment);
+    }
+
+    @Override
     public boolean onOptionsItemSelected(final MenuItem item) {
         switch (item.getItemId()) {
             case android.R.id.home:
diff --git a/src/com/android/messaging/ui/VCardDetailActivity.java b/src/com/android/messaging/ui/VCardDetailActivity.java
index b9fb3d1..fecdc34 100644
--- a/src/com/android/messaging/ui/VCardDetailActivity.java
+++ b/src/com/android/messaging/ui/VCardDetailActivity.java
@@ -37,13 +37,11 @@
 
     @Override
     public void onAttachFragment(final Fragment fragment) {
-        if (fragment instanceof VCardDetailFragment) {
-            final Uri vCardUri =
-                    getIntent().getParcelableExtra(UIIntents.UI_INTENT_EXTRA_VCARD_URI);
-            Assert.notNull(vCardUri);
-            final VCardDetailFragment vCardDetailFragment = (VCardDetailFragment) fragment;
-            vCardDetailFragment.setVCardUri(vCardUri);
-        }
+        Assert.isTrue(fragment instanceof VCardDetailFragment);
+        final Uri vCardUri = getIntent().getParcelableExtra(UIIntents.UI_INTENT_EXTRA_VCARD_URI);
+        Assert.notNull(vCardUri);
+        final VCardDetailFragment vCardDetailFragment = (VCardDetailFragment) fragment;
+        vCardDetailFragment.setVCardUri(vCardUri);
     }
 
     @Override
diff --git a/src/com/android/messaging/ui/appsettings/ApnPreference.java b/src/com/android/messaging/ui/appsettings/ApnPreference.java
index c5cc85a..74c6a08 100644
--- a/src/com/android/messaging/ui/appsettings/ApnPreference.java
+++ b/src/com/android/messaging/ui/appsettings/ApnPreference.java
@@ -94,7 +94,7 @@
 
     public void setApnRadioButtonContentDescription(final CompoundButton buttonView) {
         final View widget = (View) buttonView.getParent();
-        final TextView tv = (TextView) widget.findViewById(R.id.title);
+        final TextView tv = (TextView) widget.findViewById(android.R.id.title);
         final String apnTitle = tv.getText().toString();
         buttonView.setContentDescription(apnTitle);
     }
diff --git a/src/com/android/messaging/ui/appsettings/PerSubscriptionSettingsActivity.java b/src/com/android/messaging/ui/appsettings/PerSubscriptionSettingsActivity.java
index 7ab5dc7..623bc91 100644
--- a/src/com/android/messaging/ui/appsettings/PerSubscriptionSettingsActivity.java
+++ b/src/com/android/messaging/ui/appsettings/PerSubscriptionSettingsActivity.java
@@ -134,7 +134,7 @@
             if (!MmsConfig.get(mSubId).getSMSDeliveryReportsEnabled()) {
                 final Preference deliveryReportsPref = findPreference(
                         getString(R.string.delivery_reports_pref_key));
-                advancedCategory.removePreference(deliveryReportsPref);
+                mmsCategory.removePreference(deliveryReportsPref);
             }
             final Preference wirelessAlertPref = findPreference(getString(
                     R.string.wireless_alerts_key));
diff --git a/src/com/android/messaging/ui/conversation/SimIconView.java b/src/com/android/messaging/ui/conversation/SimIconView.java
index 6799bad..e2e446c 100644
--- a/src/com/android/messaging/ui/conversation/SimIconView.java
+++ b/src/com/android/messaging/ui/conversation/SimIconView.java
@@ -19,7 +19,6 @@
 import android.graphics.Outline;
 import android.net.Uri;
 import android.util.AttributeSet;
-import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewOutlineProvider;
 
@@ -45,14 +44,6 @@
     }
 
     @Override
-    public boolean onTouchEvent(MotionEvent event) {
-        if (isClickable()) {
-            return super.onTouchEvent(event);
-        }
-        return true;
-    }
-
-    @Override
     protected void maybeInitializeOnClickListener() {
         // TODO: SIM icon view shouldn't consume or handle clicks, but it should if
         // this is the send button for the only SIM in the device or if MSIM is not supported.
diff --git a/src/com/android/messaging/ui/debug/DebugMmsConfigFragment.java b/src/com/android/messaging/ui/debug/DebugMmsConfigFragment.java
index f7da331..7c54db5 100644
--- a/src/com/android/messaging/ui/debug/DebugMmsConfigFragment.java
+++ b/src/com/android/messaging/ui/debug/DebugMmsConfigFragment.java
@@ -39,7 +39,6 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -104,13 +103,6 @@
             mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             mMmsConfig = MmsConfig.get(subId);
             mKeys = new ArrayList<>(mMmsConfig.keySet());
-            Iterator<String> it = mKeys.iterator();
-            while (it.hasNext()) {
-                // Remove a config if the MmsConfig.sKeyTypeMap doesn't have it.
-                if (MmsConfig.getKeyType(it.next()) == null) {
-                    it.remove();
-                }
-            }
             Collections.sort(mKeys);
         }
 
@@ -133,7 +125,7 @@
 
         @Override
         public void onValueChanged(String key, String keyType, String value) {
-            mMmsConfig.update(keyType, key, value);
+            mMmsConfig.update(key, value, keyType);
             notifyDataSetChanged();
         }
 
diff --git a/src/com/android/messaging/util/DebugUtils.java b/src/com/android/messaging/util/DebugUtils.java
index 0d689fe..1362f83 100644
--- a/src/com/android/messaging/util/DebugUtils.java
+++ b/src/com/android/messaging/util/DebugUtils.java
@@ -291,10 +291,9 @@
                 dis = new DataInputStream(fis);
 
                 // SMS dump
-                String format = null;
                 final int chars = dis.readInt();
                 if (chars > 0) {
-                    format = dis.readUTF();
+                    final String format = dis.readUTF();
                 }
                 final int count = dis.readInt();
                 final SmsMessage[] messagesTemp = new SmsMessage[count];
@@ -302,11 +301,7 @@
                     final int length = dis.readInt();
                     final byte[] pdu = new byte[length];
                     dis.read(pdu, 0, length);
-                    if (format == null) {
-                        messagesTemp[i] = SmsMessage.createFromPdu(pdu);
-                    } else {
-                        messagesTemp[i] = SmsMessage.createFromPdu(pdu, format);
-                    }
+                    messagesTemp[i] = SmsMessage.createFromPdu(pdu);
                 }
                 messages = messagesTemp;
             } catch (final FileNotFoundException e) {
diff --git a/src/com/android/messaging/util/EmailAddress.java b/src/com/android/messaging/util/EmailAddress.java
index c59170e..0c0dab9 100644
--- a/src/com/android/messaging/util/EmailAddress.java
+++ b/src/com/android/messaging/util/EmailAddress.java
@@ -160,7 +160,7 @@
         // Host must not have any disallowed characters; allowI18n dictates whether
         // host must be ASCII.
         if (!EMAIL_ALLOWED_CHARS.matchesAllOf(host)
-                || (!allowI18n && !CharMatcher.ascii().matchesAllOf(host))) {
+                || (!allowI18n && !CharMatcher.ASCII.matchesAllOf(host))) {
             return false;
         }
 
@@ -182,7 +182,7 @@
             // User must not have any disallowed characters; allow I18n dictates whether
             // user must be ASCII.
             if (!EMAIL_ALLOWED_CHARS.matchesAllOf(user)
-                    || (!allowI18n && !CharMatcher.ascii().matchesAllOf(user))) {
+                    || (!allowI18n && !CharMatcher.ASCII.matchesAllOf(user))) {
                 return false;
             }
         }
diff --git a/tests/Android.mk b/tests/Android.mk
index aaff57a..dc1999b 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -24,13 +24,9 @@
 
 LOCAL_INSTRUMENTATION_FOR := messaging
 
-LOCAL_PROGUARD_ENABLED := disabled
-
 # Matching ../Android.mk
 LOCAL_SDK_VERSION := current
 
-LOCAL_COMPATIBILITY_SUITE := general-tests
-
 LOCAL_CERTIFICATE := platform
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 07f0d17..3ad7d8e 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -17,7 +17,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.messaging.test" >
 
-    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="24"/>
+    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28"/>
 
     <application android:label="Messaging Tests" >
         <uses-library android:name="android.test.runner" />
diff --git a/tests/AndroidTest.xml b/tests/AndroidTest.xml
deleted file mode 100644
index 601bc8e..0000000
--- a/tests/AndroidTest.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<configuration description="Runs Messaging Tests.">
-    <option name="test-suite-tag" value="apct" />
-    <option name="test-suite-tag" value="apct-instrumentation" />
-    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
-        <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="messagingtests.apk" />
-        <option name="test-file-name" value="messaging.apk" />
-    </target_preparer>
-
-    <test class="com.android.tradefed.testtype.InstrumentationTest" >
-        <option name="package" value="com.android.messaging.test" />
-        <option name="runner" value="android.test.InstrumentationTestRunner" />
-    </test>
-</configuration>
-
diff --git a/tests/src/com/android/messaging/datamodel/action/GetOrCreateConversationActionTest.java b/tests/src/com/android/messaging/datamodel/action/GetOrCreateConversationActionTest.java
index 1b6b8ba..1c0d0b5 100644
--- a/tests/src/com/android/messaging/datamodel/action/GetOrCreateConversationActionTest.java
+++ b/tests/src/com/android/messaging/datamodel/action/GetOrCreateConversationActionTest.java
@@ -67,6 +67,12 @@
         final long threadId = MmsUtils.getOrCreateThreadId(mContext, recipients);
         assertEquals(TestDataFactory.SMS_MMS_THREAD_ID_CURSOR_VALUE, threadId);
 
+        // TestDataFactory creates NUM_TEST_CONVERSATIONS conversations. blank
+        // conversation would be the next conversation.
+        final String blankId = BugleDatabaseOperations.getExistingConversation(db, threadId, false);
+        // TODO(rtenneti): Investigate why blankId is 4 more than NUM_TEST_CONVERSATIONS.
+        assertEquals(TestDataFactory.NUM_TEST_CONVERSATIONS+4, Integer.parseInt((String)blankId));
+
         ArrayList<StubActionServiceCallLog> calls = mService.getCalls();
 
         GetOrCreateConversationActionMonitor monitor =
@@ -85,8 +91,8 @@
         assertTrue(result instanceof String);
 
         // Make sure that we created a new conversation
-        int expectedConversationId = TestDataFactory.NUM_TEST_CONVERSATIONS + 1;
-        assertEquals(expectedConversationId, Integer.parseInt((String) result));
+        // TODO(rtenneti): Investigate why blankId is 4 more than NUM_TEST_CONVERSATIONS.
+        assertEquals(TestDataFactory.NUM_TEST_CONVERSATIONS+4, Integer.parseInt((String)result));
 
         // Now get the conversation that we just created again
         monitor = GetOrCreateConversationAction.getOrCreateConversation(participants, null,
@@ -104,7 +110,8 @@
         final String conversationId = (String) result;
 
         // Make sure that we found the same conversation id
-        assertEquals(expectedConversationId, Integer.parseInt((String) result));
+        // TODO(rtenneti): Investigate why blankId is 4 more than NUM_TEST_CONVERSATIONS.
+        assertEquals(TestDataFactory.NUM_TEST_CONVERSATIONS+4, Integer.parseInt((String)result));
 
         final ArrayList<ParticipantData> conversationParticipants =
                 BugleDatabaseOperations.getParticipantsForConversation(db, conversationId);