Loading android/app/src/com/android/bluetooth/map/BluetoothMapContentObserver.java +12 −4 Original line number Diff line number Diff line Loading @@ -1420,6 +1420,7 @@ 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); Loading @@ -1427,6 +1428,10 @@ 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); Loading @@ -1435,8 +1440,7 @@ public class BluetoothMapContentObserver { if (mTransmitEvents && // extract contact details only if needed mMapEventReportVersion > BluetoothMapUtils.MAP_EVENT_REPORT_V10) { String date = BluetoothMapUtils.getDateTimeString( c.getLong(c.getColumnIndex(Sms.DATE))); String date = BluetoothMapUtils.getDateTimeString(timestamp); String subject = c.getString(c.getColumnIndex(Sms.BODY)); if (subject == null) { subject = ""; Loading Loading @@ -1583,6 +1587,7 @@ 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); Loading @@ -1591,6 +1596,10 @@ 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( Loading @@ -1604,8 +1613,7 @@ public class BluetoothMapContentObserver { if (mTransmitEvents && // extract contact details only if needed mMapEventReportVersion != BluetoothMapUtils.MAP_EVENT_REPORT_V10) { String date = BluetoothMapUtils.getDateTimeString( c.getLong(c.getColumnIndex(Mms.DATE))); String date = BluetoothMapUtils.getDateTimeString(timestamp); String subject = c.getString(c.getColumnIndex(Mms.SUBJECT)); if (subject == null || subject.length() == 0) { /* Get subject from mms text body parts - if any exists */ Loading android/app/src/com/android/bluetooth/map/BluetoothMapUtils.java +15 −0 Original line number Diff line number Diff line Loading @@ -677,6 +677,21 @@ 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) { Loading Loading
android/app/src/com/android/bluetooth/map/BluetoothMapContentObserver.java +12 −4 Original line number Diff line number Diff line Loading @@ -1420,6 +1420,7 @@ 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); Loading @@ -1427,6 +1428,10 @@ 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); Loading @@ -1435,8 +1440,7 @@ public class BluetoothMapContentObserver { if (mTransmitEvents && // extract contact details only if needed mMapEventReportVersion > BluetoothMapUtils.MAP_EVENT_REPORT_V10) { String date = BluetoothMapUtils.getDateTimeString( c.getLong(c.getColumnIndex(Sms.DATE))); String date = BluetoothMapUtils.getDateTimeString(timestamp); String subject = c.getString(c.getColumnIndex(Sms.BODY)); if (subject == null) { subject = ""; Loading Loading @@ -1583,6 +1587,7 @@ 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); Loading @@ -1591,6 +1596,10 @@ 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( Loading @@ -1604,8 +1613,7 @@ public class BluetoothMapContentObserver { if (mTransmitEvents && // extract contact details only if needed mMapEventReportVersion != BluetoothMapUtils.MAP_EVENT_REPORT_V10) { String date = BluetoothMapUtils.getDateTimeString( c.getLong(c.getColumnIndex(Mms.DATE))); String date = BluetoothMapUtils.getDateTimeString(timestamp); String subject = c.getString(c.getColumnIndex(Mms.SUBJECT)); if (subject == null || subject.length() == 0) { /* Get subject from mms text body parts - if any exists */ Loading
android/app/src/com/android/bluetooth/map/BluetoothMapUtils.java +15 −0 Original line number Diff line number Diff line Loading @@ -677,6 +677,21 @@ 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) { Loading