Group Text Messaging for JB - ACHIEVED!

playa1257

Member
Jul 16, 2011
18
0
0
Visit site
I have just finished testing my modifications to the framework and MMS apk to enable Group Texting similar to the iPhone.

I am VERY new to JAVA / Android / Git / Gerrit and I am learning as I go along. I am working on submitting the code to AOSP right now but if there is anyone that would like to incorporate the modified java classes for their ROM, as soon as possible, I will gladly work with you in making that happen.

I have modified the android-4.1.1_r4 branch from AOSP and only tested it on my own toro/GNex. I lack resources and time to test on any other device, but you are welcome to do so.
EDIT: Also check post #13 below for changes to mmssms.db schema.

device-2012-09-09-224659.jpgdevice-2012-09-09-224740.jpgdevice-2012-09-09-225004.jpgdevice-2012-09-09-225016.jpgdevice-2012-09-09-225038.jpg

https://github.com/vivekvasani

changes have been committed to "jb-release" branch

12/05/12:

Thank you guys for your support. The community is amazing.

I apologize for the absence. I have been putting allllll my efforts in finding a job, and have finally got one.

A quick update:

I was never able to get my virtual machine to play nicely with gerrit (especially Google's gerrit), but invisiblek has done me HUGE favor and submitted the code to cyanogenmod's gerrit for review.

After a few rounds of review the gerrit patch on CM was abandon, due to the fact that the patch will be native in AOSP 4.2

There are many 3rd party ROMS that have the patch included hopefully many more to come.

- Vivek Vasani
 
Last edited:

anon(596177)

Well-known member
Dec 14, 2011
1,189
105
0
Visit site
I have just finished testing my modifications to the framework and MMS apk to enable Group Texting similar to the iPhone.

I am VERY new to JAVA / Android / Git / Gerrit and I am learning as I go along. I am working on submitting the code to AOSP right now but if there is anyone that would like to incorporate the modified java classes for their ROM, as soon as possible, I will gladly work with you in making that happen.

I have modified the android-4.1.1_r4 branch from AOSP and only tested it on my own toro/GNex. I lack resources and time to test on any other device, but you are welcome to do so.

View attachment 36962View attachment 36963View attachment 36964View attachment 36965View attachment 36966

https://github.com/vivekvasani

changes have been committed to "jb-release" branch


I dont understand. What you are showing is something that can already be done with the stock SMS app, unless I'm missing something here.

EDIT: Nevermind. I think I see it now.
 

playa1257

Member
Jul 16, 2011
18
0
0
Visit site
Cool! Would love to see this baked into JB.

How hard is it to incorporate this into a ROM?

I can't see how it would be too hard. But I don't build ROMs, so I'm not sure. But It's essentially 10 files that I modified off Google's AOSP code. So if someone were to build a ROM off the AOSP then just have to replace those 10 files with mine.

Otherwise, if it were another ROM, i.e. Cyanogen, Vicious, Liquid, then it would be a little more work as those ROMs have their own version of the files that need to be changed. In my first post I put a link to my GitHub account and they can just go to the "jb-release" branch and look at the commit history to see exactly WHAT code I added and WHERE to insert it into their version.
 

SeigaGen

Well-known member
Sep 28, 2011
678
95
0
Visit site
I am VERY new to JAVA / Android / Git / Gerrit and I am learning as I go along. I am working on submitting the code to AOSP right now but if there is anyone that would like to incorporate the modified java classes for their ROM, as soon as possible, I will gladly work with you in making that happen.

And yet you have done something to the Android Messaging system that should have always been integrated! Phenomenal job!
 

playa1257

Member
Jul 16, 2011
18
0
0
Visit site
Sorry I disappeared for a bit. Looks like the word is spreading and FAST!!

I found a tiny annoying glitch when building a CM10 ROM with my mod. So I went on a very long hackathon with myself. Turns out that not only does the framework and Mms.apk needs to be changed but there need to be a slight change to TelephonyProvider.apk

TelephonyProvider.apk contains: MmsSmsDatabaseHelper.java that provides the setting up and maintaining of the mmssms.db and there are triggers that are created when the database is initially created (WHICH MEANS AFTER A FULL FACTORY WIPE).

original trigger:
Code:
    private static final String UPDATE_THREAD_SNIPPET_SNIPPET_CS_ON_DELETE =
                        "  UPDATE threads SET snippet = " +
                        "   (SELECT snippet FROM" +
                        "     (SELECT date * 1000 AS date, sub AS snippet, thread_id FROM pdu" +
                        "      UNION SELECT date, body AS snippet, thread_id FROM sms)" +
                        "    WHERE thread_id = OLD.thread_id ORDER BY date DESC LIMIT 1) " +
                        "  WHERE threads._id = OLD.thread_id; " +
                        "  UPDATE threads SET snippet_cs = " +
                        "   (SELECT snippet_cs FROM" +
                        "     (SELECT date * 1000 AS date, sub_cs AS snippet_cs, thread_id FROM pdu" +
                        "      UNION SELECT date, 0 AS snippet_cs, thread_id FROM sms)" +
                        "    WHERE thread_id = OLD.thread_id ORDER BY date DESC LIMIT 1) " +
                        "  WHERE threads._id = OLD.thread_id; "

I added a few lines at the end:
Code:
    private static final String UPDATE_THREAD_SNIPPET_SNIPPET_CS_ON_DELETE =
                        "  UPDATE threads SET snippet = " +
                        "   (SELECT snippet FROM" +
                        "     (SELECT date * 1000 AS date, sub AS snippet, thread_id FROM pdu" +
                        "      UNION SELECT date, body AS snippet, thread_id FROM sms)" +
                        "    WHERE thread_id = OLD.thread_id ORDER BY date DESC LIMIT 1) " +
                        "  WHERE threads._id = OLD.thread_id; " +
                        "  UPDATE threads SET snippet_cs = " +
                        "   (SELECT snippet_cs FROM" +
                        "     (SELECT date * 1000 AS date, sub_cs AS snippet_cs, thread_id FROM pdu" +
                        "      UNION SELECT date, 0 AS snippet_cs, thread_id FROM sms)" +
                        "    WHERE thread_id = OLD.thread_id ORDER BY date DESC LIMIT 1) " +
                        "  WHERE threads._id = OLD.thread_id; "
                        "  UPDATE threads SET read = " +
                        "    CASE (SELECT COUNT(*) FROM pdu WHERE read = 0 AND old.thread_id = thread_id " +
                        "      AND (m_type=132 OR m_type=130 OR m_type=128)) " +  
                        "      WHEN 0 THEN 1 " +
                        "      ELSE 0 " +
                        "    END " +
                        "  WHERE threads._id = old.thread_id;";

This will ensure that when the MMS comes in and is staged temporarily in the sender's thread then moves to the group, it will mark the old thread as "read" instead of leaving it stuck on "unread".


ALSO, i was annoyed at how the timecode on the thread does not represent the LAST message in the thread but INSTEAD marks the thread date/time as the moment you last made a change to it. To fix that I made the following change:

Original:
Code:
        // Update threads table whenever a message in pdu is deleted
        db.execSQL("CREATE TRIGGER pdu_update_thread_on_delete " +
                   "AFTER DELETE ON pdu " +
                   "BEGIN " +
                   "  UPDATE threads SET " +
                   "     date = (strftime('%s','now') * 1000)" +
                   "  WHERE threads._id = old." + Mms.THREAD_ID + "; " +
                   UPDATE_THREAD_COUNT_ON_OLD +
                   UPDATE_THREAD_SNIPPET_SNIPPET_CS_ON_DELETE +
                   "END;");

Modified:
Code:
        // Update threads table whenever a message in pdu is deleted
        db.execSQL("CREATE TRIGGER pdu_update_thread_on_delete " +
                   "AFTER DELETE ON pdu " +
                   "BEGIN " +
                   "  UPDATE threads SET " +
                   "     date = (SELECT date FROM" +
                   "        (SELECT date * 1000 AS date, thread_id FROM pdu" +
                   "         UNION SELECT date, thread_id FROM sms)" +
                   "     WHERE thread_id = old." + Mms.THREAD_ID + " ORDER BY date DESC LIMIT 1)" +
                   "  WHERE threads._id = old." + Mms.THREAD_ID + "; " +
                   UPDATE_THREAD_COUNT_ON_OLD +
                   UPDATE_THREAD_SNIPPET_SNIPPET_CS_ON_DELETE +
                   "END;");


PS I will be uploading my version of cm-10-20120912-UNOFFICIAL-toro

Check the top post, I would love some testers and feedback.
 

kevlar924

Member
Mar 5, 2011
5
0
0
Visit site
btw, playa there is a poster over at rootzwiki, that claims this will only work between phones that are running stock messaging app on JB, is that true?
 

playa1257

Member
Jul 16, 2011
18
0
0
Visit site
FYI,

Euroskank wants to implement this, but has stated a comment you might want to look at:

[CM10][Jellybro] Toro Nightly Kangs - [VZW] Galaxy Nexus Development - RootzWiki - Page 227

SeigaGen,

if you could please let Euroskank know that because I'm still a noob at all this, I had NO idea what I was doing on Gerrit, but I'm working on resubmitting it. I just run into a lot of issues because I'm running linux virtually off my mac.

- - - Updated - - -

btw, playa there is a poster over at rootzwiki, that claims this will only work between phones that are running stock messaging app on JB, is that true?

kevlar924,

I'm not 100% if it will or will not work with third-party apps, but the change to the framework provides the code to thread the incoming meassage to a group and the change to the Mms.apk (stock Messaging app) provides functionality to send group messages.

I know that some third-party apps rely on the stock messaging app to handle incoming messages, if that is the case then it should thread just fine. But those third-party apps also need to have the functionality to send group MMS messages.

I hope I was able to answer your questions.

EDIT: My fault, I just checked the rootzwiki post you were referring to. That is FALSE. This is a not a NEW protocol. I just changed how Android handles the standard MMS that EVERYONE uses. I have tested with Moto Droid and iPhone devices in the same convo. It works.

or should I say it works for me. I'm hoping it works for everyone else too. But I can fix bugs as soon as people try it out and let me know what they are.
 
Last edited:

SeigaGen

Well-known member
Sep 28, 2011
678
95
0
Visit site
SeigaGen,

if you could please let Euroskank know that because I'm still a noob at all this, I had NO idea what I was doing on Gerrit, but I'm working on resubmitting it. I just run into a lot of issues because I'm running linux virtually off my mac.

Need not worry. Actually he incorporated it with his latest CM build today. Believe me when I say that you basically revolutionized the Stock Messaging App :).
 

kevlar924

Member
Mar 5, 2011
5
0
0
Visit site
Need not worry. Actually he incorporated it with his latest CM build today. Believe me when I say that you basically revolutionized the Stock Messaging App :).

just tried out that euroskank's CM build, sent out a group message to my roommates (all iPhones) and it worked beautifully...I can not thank you enough