Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deletion of random SMS when trying to update threads #149

Merged
merged 2 commits into from
Dec 25, 2024

Conversation

tom93
Copy link
Contributor

@tom93 tom93 commented Mar 23, 2024

Commit 44c540b introduced a hack to update the conversation snippet, however there is a bug in that code: it tries to delete by thread ID, but the condition is applied to the SMS table, not to the threads table (Android source). So instead of deleting the thread with that ID, it deletes
whichever SMS happens to have that ID.

The fix is to change the condition to an always-false condition, so that no messages will be deleted. The threads will still get
updated
.

Old updates

Update 1: A minor issue with this PR is that the conversation dates don't get updated any more (the date should be updated to the last non-deleted message in the conversation, but that doesn't happen). I'm not sure why that is.
Update 2: I think the Telephony database is getting updated correctly, but the app's cache isn't getting updated (probably because I removed the call to insertOrUpdateConversation()). I'm looking into this, but I think this it's still worth merging and releasing as-is because deleting random messages is not good!
Update 3: I restored the call to insertOrUpdateConversation() and everything seems fine now. I squashed and force-pushed.


What is it?

  • Bugfix
  • Feature
  • Codebase improvement

Description of the changes in your PR

  • Fix deletion of random SMS when the code tries to update threads

Before/After Screenshots/Screen Record

See #148.

Fixes the following issue(s)

Acknowledgement

Commit 44c540b (Fixed updating last message after deleting (FossifyOrg#167),
2021-09-04) introduced a hack to update the conversation snippet,
however there is a bug in that code: it tries to delete by thread ID,
but the condition is applied to the SMS table, not to the threads
table.[1] So instead of deleting the thread with that ID, it deletes
whichever SMS happens to have that ID.

The fix is to change the condition to an always-false condition, so
that no messages will be deleted. The threads will still get
updated.[2]

Fixes FossifyOrg#148.

[1] https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/android14-release/src/com/android/providers/telephony/MmsSmsProvider.java#1405
[2] https://android.googlesource.com/platform/packages/providers/TelephonyProvider/+/android14-release/src/com/android/providers/telephony/MmsSmsProvider.java#1409
@naveensingh
Copy link
Member

Seems to work, thanks!

@naveensingh naveensingh merged commit 83b5810 into FossifyOrg:master Dec 25, 2024
2 of 4 checks passed
@tom93 tom93 deleted the fix-deletion branch December 27, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting one message causes another arbitrary message to be deleted
2 participants