From dda6a5104cf74cbe18bd8a1ed1330d8ef7d213c0 Mon Sep 17 00:00:00 2001 From: Simon Redman Date: Tue, 11 Dec 2018 18:02:39 -0700 Subject: [PATCH] [Android] Change ThreadID to long Summary: Change ThreadID to long Test Plan: Messages should send and receive as before. Additionally, if your device has assigned extremely large ThreadIDs, the SMS plugin should no longer crash. This patch corresponds to the KDE-side revision D17516 Reviewers: #kde_connect, nicolasfella Reviewed By: #kde_connect, nicolasfella Subscribers: nicolasfella, kdeconnect Tags: #kde_connect Differential Revision: https://phabricator.kde.org/D17517 --- src/org/kde/kdeconnect/Helpers/SMSHelper.java | 8 ++++---- src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/org/kde/kdeconnect/Helpers/SMSHelper.java b/src/org/kde/kdeconnect/Helpers/SMSHelper.java index 95794cf7..78e0fd3d 100644 --- a/src/org/kde/kdeconnect/Helpers/SMSHelper.java +++ b/src/org/kde/kdeconnect/Helpers/SMSHelper.java @@ -214,10 +214,10 @@ public class SMSHelper { * Represent an ID used to uniquely identify a message thread */ public static class ThreadID { - final Integer threadID; + final Long threadID; static final String lookupColumn = Telephony.Sms.THREAD_ID; - public ThreadID(Integer threadID) { + public ThreadID(Long threadID) { this.threadID = threadID; } @@ -246,7 +246,7 @@ public class SMSHelper { public final long m_date; final int m_type; final int m_read; - final int m_threadID; + final long m_threadID; // ThreadID is *int* for SMS messages but *long* for MMS final int m_uID; /** @@ -296,7 +296,7 @@ public class SMSHelper { m_type = Integer.parseInt(messageInfo.get(Message.TYPE)); } m_read = Integer.parseInt(messageInfo.get(Message.READ)); - m_threadID = Integer.parseInt(messageInfo.get(Message.THREAD_ID)); + m_threadID = Long.parseLong(messageInfo.get(Message.THREAD_ID)); m_uID = Integer.parseInt(messageInfo.get(Message.U_ID)); } diff --git a/src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java b/src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java index e24cc706..abcfd362 100644 --- a/src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java +++ b/src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java @@ -384,7 +384,7 @@ public class SMSPlugin extends Plugin { } private boolean handleRequestConversation(NetworkPacket packet) { - SMSHelper.ThreadID threadID = new SMSHelper.ThreadID(packet.getInt("threadID")); + SMSHelper.ThreadID threadID = new SMSHelper.ThreadID(packet.getLong("threadID")); List conversation = SMSHelper.getMessagesInThread(this.context, threadID);