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

Commit 3cca7620 authored by Christine Hallstrom's avatar Christine Hallstrom
Browse files

Revert "Don't send new message events older than one year"

This reverts commit d29d963f.

Reason for revert: Causes crash on MAP spec 1.1 version

Change-Id: I8bd79dfe4dd2a49b4641db6bebc5723224fd9a7e
Bug: 263068842
Test: PTS failure
parent d29d963f
Loading
Loading
Loading
Loading
+4 −12
Original line number Diff line number Diff line
@@ -1420,7 +1420,6 @@ public class BluetoothMapContentObserver {
                        int type = c.getInt(c.getColumnIndex(Sms.TYPE));
                        int threadId = c.getInt(c.getColumnIndex(Sms.THREAD_ID));
                        int read = c.getInt(c.getColumnIndex(Sms.READ));
                        long timestamp = c.getLong(c.getColumnIndex(Sms.DATE));

                        Msg msg = getMsgListSms().remove(id);

@@ -1428,10 +1427,6 @@ public class BluetoothMapContentObserver {
                         * a message deleted and/or MessageShift for messages deleted by the MCE. */

                        if (msg == null) {
                            if (BluetoothMapUtils.isDateTimeOlderThanOneYear(timestamp)) {
                                // Skip sending new message events older than one year
                                continue;
                            }
                            /* New message */
                            msg = new Msg(id, type, threadId, read);
                            msgListSms.put(id, msg);
@@ -1440,7 +1435,8 @@ public class BluetoothMapContentObserver {
                            if (mTransmitEvents && // extract contact details only if needed
                                    mMapEventReportVersion
                                            > BluetoothMapUtils.MAP_EVENT_REPORT_V10) {
                                String date = BluetoothMapUtils.getDateTimeString(timestamp);
                                String date = BluetoothMapUtils.getDateTimeString(
                                        c.getLong(c.getColumnIndex(Sms.DATE)));
                                String subject = c.getString(c.getColumnIndex(Sms.BODY));
                                if (subject == null) {
                                    subject = "";
@@ -1587,7 +1583,6 @@ public class BluetoothMapContentObserver {
                        // TODO: Go through code to see if we have an issue with mismatch in types
                        //       for threadId. Seems to be a long in DB??
                        int read = c.getInt(c.getColumnIndex(Mms.READ));
                        long timestamp = c.getLong(c.getColumnIndex(Mms.DATE));

                        Msg msg = getMsgListMms().remove(id);

@@ -1596,10 +1591,6 @@ public class BluetoothMapContentObserver {
                         * MCE.*/

                        if (msg == null) {
                            if (BluetoothMapUtils.isDateTimeOlderThanOneYear(timestamp)) {
                                // Skip sending new message events older than one year
                                continue;
                            }
                            /* New message - only notify on retrieve conf */
                            listChanged = true;
                            if (getMmsFolderName(type).equalsIgnoreCase(
@@ -1613,7 +1604,8 @@ public class BluetoothMapContentObserver {
                            if (mTransmitEvents && // extract contact details only if needed
                                    mMapEventReportVersion
                                            != BluetoothMapUtils.MAP_EVENT_REPORT_V10) {
                                String date = BluetoothMapUtils.getDateTimeString(timestamp);
                                String date = BluetoothMapUtils.getDateTimeString(
                                        c.getLong(c.getColumnIndex(Mms.DATE)));
                                String subject = c.getString(c.getColumnIndex(Mms.SUBJECT));
                                if (subject == null || subject.length() == 0) {
                                    /* Get subject from mms text body parts - if any exists */
+0 −15
Original line number Diff line number Diff line
@@ -677,21 +677,6 @@ public class BluetoothMapUtils {
        return format.format(cal.getTime());
    }

    static boolean isDateTimeOlderThanOneYear(long timestamp) {
        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(timestamp);
        Calendar oneYearAgo = Calendar.getInstance();
        oneYearAgo.add(Calendar.YEAR, -1);
        if (cal.compareTo(oneYearAgo) > 0) {
            if (V) {
                Log.v(TAG, "isDateTimeOlderThanOneYear timestamp : " + timestamp
                        + " oneYearAgo: " + oneYearAgo);
            }
            return true;
        }
        return false;
    }

    static void savePeerSupportUtcTimeStamp(int remoteFeatureMask) {
        if ((remoteFeatureMask & MAP_FEATURE_DEFINED_TIMESTAMP_FORMAT_BIT)
                == MAP_FEATURE_DEFINED_TIMESTAMP_FORMAT_BIT) {