Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12bc1ab5 authored by Kihong Seong's avatar Kihong Seong
Browse files

Add additional tests for setter methods in BluetoothMapContent

Bug: 237467631
Test: atest BluetoothInstrumentationTests
Change-Id: I296af212cf2c800f333290be6603837d87dff2d6
Merged-In: I296af212cf2c800f333290be6603837d87dff2d6
(cherry picked from commit 04a80f03)
parent 9e07b801
Loading
Loading
Loading
Loading
+23 −18
Original line number Diff line number Diff line
@@ -73,10 +73,13 @@ public class BluetoothMapContent {
    private static final int MASK_SUBJECT = 0x00000001;
    @VisibleForTesting
    static final int MASK_DATETIME = 0x00000002;
    private static final int MASK_SENDER_NAME = 0x00000004;
    private static final int MASK_SENDER_ADDRESSING = 0x00000008;
    @VisibleForTesting
    static final int MASK_SENDER_NAME = 0x00000004;
    @VisibleForTesting
    static final int MASK_SENDER_ADDRESSING = 0x00000008;
    private static final int MASK_RECIPIENT_NAME = 0x00000010;
    private static final int MASK_RECIPIENT_ADDRESSING = 0x00000020;
    @VisibleForTesting
    static final int MASK_RECIPIENT_ADDRESSING = 0x00000020;
    private static final int MASK_TYPE = 0x00000040;
    private static final int MASK_SIZE = 0x00000080;
    private static final int MASK_RECEPTION_STATUS = 0x00000100;
@@ -999,7 +1002,8 @@ public class BluetoothMapContent {
        return sb.toString();
    }

    private void setRecipientAddressing(BluetoothMapMessageListingElement e, Cursor c,
    @VisibleForTesting
    void setRecipientAddressing(BluetoothMapMessageListingElement e, Cursor c,
            FilterInfo fi, BluetoothMapAppParams ap) {
        if ((ap.getParameterMask() & MASK_RECIPIENT_ADDRESSING) != 0) {
            String address = null;
@@ -1079,7 +1083,8 @@ public class BluetoothMapContent {
        }
    }

    private void setSenderAddressing(BluetoothMapMessageListingElement e, Cursor c, FilterInfo fi,
    @VisibleForTesting
    void setSenderAddressing(BluetoothMapMessageListingElement e, Cursor c, FilterInfo fi,
            BluetoothMapAppParams ap) {
        if ((ap.getParameterMask() & MASK_SENDER_ADDRESSING) != 0) {
            String address = "";
@@ -1146,10 +1151,10 @@ public class BluetoothMapContent {
                // TODO: This is a BAD hack, that we map the contact ID to a conversation ID!!!
                //       We need to reach a conclusion on what to do
                Uri contactsUri = Uri.parse(mBaseUri + BluetoothMapContract.TABLE_CONVOCONTACT);
                Cursor contacts =
                        mResolver.query(contactsUri, BluetoothMapContract.BT_CONTACT_PROJECTION,
                                BluetoothMapContract.ConvoContactColumns.CONVO_ID + " = "
                                        + contactId, null, null);
                Cursor contacts = BluetoothMethodProxy.getInstance().contentResolverQuery(mResolver,
                        contactsUri, BluetoothMapContract.BT_CONTACT_PROJECTION,
                        BluetoothMapContract.ConvoContactColumns.CONVO_ID + " = " + contactId, null,
                        null);
                try {
                    // TODO this will not work for group-chats
                    if (contacts != null && contacts.moveToFirst()) {
@@ -1173,7 +1178,8 @@ public class BluetoothMapContent {
        }
    }

    private void setSenderName(BluetoothMapMessageListingElement e, Cursor c, FilterInfo fi,
    @VisibleForTesting
    void setSenderName(BluetoothMapMessageListingElement e, Cursor c, FilterInfo fi,
            BluetoothMapAppParams ap) {
        if ((ap.getParameterMask() & MASK_SENDER_NAME) != 0) {
            String name = "";
@@ -1227,10 +1233,10 @@ public class BluetoothMapContent {
                // For IM we add the contact ID in the addressing
                long contactId = c.getLong(fi.mMessageColFromAddress);
                Uri contactsUri = Uri.parse(mBaseUri + BluetoothMapContract.TABLE_CONVOCONTACT);
                Cursor contacts =
                        mResolver.query(contactsUri, BluetoothMapContract.BT_CONTACT_PROJECTION,
                                BluetoothMapContract.ConvoContactColumns.CONVO_ID + " = "
                                        + contactId, null, null);
                Cursor contacts = BluetoothMethodProxy.getInstance().contentResolverQuery(mResolver,
                        contactsUri, BluetoothMapContract.BT_CONTACT_PROJECTION,
                        BluetoothMapContract.ConvoContactColumns.CONVO_ID + " = " + contactId, null,
                        null);
                try {
                    // TODO this will not work for group-chats
                    if (contacts != null && contacts.moveToFirst()) {
@@ -1278,9 +1284,8 @@ public class BluetoothMapContent {
        }
    }


    private void setLastActivity(BluetoothMapConvoListingElement e, Cursor c, FilterInfo fi,
            BluetoothMapAppParams ap) {
    @VisibleForTesting
    void setLastActivity(BluetoothMapConvoListingElement e, Cursor c, FilterInfo fi) {
        long date = 0;
        if (fi.mMsgType == FilterInfo.TYPE_SMS || fi.mMsgType == FilterInfo.TYPE_MMS) {
            date = c.getLong(MMS_SMS_THREAD_COL_DATE);
@@ -1392,7 +1397,7 @@ public class BluetoothMapContent {
    private BluetoothMapConvoListingElement createConvoElement(Cursor c, FilterInfo fi,
            BluetoothMapAppParams ap) {
        BluetoothMapConvoListingElement e = new BluetoothMapConvoListingElement();
        setLastActivity(e, c, fi, ap);
        setLastActivity(e, c, fi);
        e.setType(getType(c, fi));
//        setConvoRead(e, c, fi, ap);
        e.setCursorIndex(c.getPosition());
+340 −17

File changed.

Preview size limit exceeded, changes collapsed.