[Operation] send and receive SMS and MMS messages normally.
Test Result: All text messages have been read, but the SMS icon on the home page still prompts that a text message has not been read. It still exists after restart.
After analysis, the main cause of this situation is that when the MMS has been read, there is a problem with the query statement in the launcher. When the status of the MMS is read, the value of the read field in the pdu table changes from 0 to 1, and the MMS click to download. After the download is successful, the information type changes from 130 to 132. we can analyze data tables everywhere.
Now we can analyze the data in the database table. Before analysis, we need to explain that the value of read is 0, indicating that it is not read, the value of 1 indicates that it is read, and the value of m_type is 130, indicating that it is not downloaded, if the value is 132, it indicates that the file has been downloaded.
We can see from the database table that the current information status is all read, while the m_type value is 130, the number of messages is 8, and the value of 132 is 2, that is to say, eight color information entries are not downloaded. According to the normal logic, there should be no reminder of unread messages in hotseat, but it is prompted that there are 8 unread messages in hotseat. Therefore, we conclude that this problem is caused by a query statement. We can find the relevant methods in launcher. Java under the launcher application for analysis:
Private void updatedecorate (INT whichicon, shortcutinfo info ){
Final arraylist <shortcutinfo> shortcuts = new arraylist <shortcutinfo> ();
If (info! = NULL ){
Shortcuts. Add (Info );
}
Gettargetshortcuts (whichicon = update_mms_icon? "Com. Android. MMS": "activities. dialtactsactivity", shortcuts );
If (shortcuts. Size () = 0 ){
Return;
}
New asynctask <integer, void, integer> (){
@ Override
Protected integer doinbackground (integer... whichicon ){
Int COUNT = 0;
Switch (whichicon [0]) {
Case update_mms_icon:
Cursor mmscursor = getcontentresolver (). Query (URI. parse ("content: // MMS/inbox "),
Null,"M_type = 128 or m_type = 130 or m_type = 132 and read = 0", Null, null );
If (mmscursor! = NULL ){
Count + = mmscursor. getcount ();
Mmscursor. Close ();
}
Cursor smscursor = getcontentresolver (). Query (URI. parse ("content: // SMS"), null, "type = 1 and read = 0", null, null );
If (smscursor! = NULL ){
Count + = smscursor. getcount ();
Smscursor. Close ();
}
Break;
Case update_phone_icon:
Cursor cursor = getcontentresolver (). Query (CILS. content_uri, new string [] {
Call. number, call. type, call. new}, null, null, call. default_sort_order );
If (cursor! = NULL ){
While (cursor. movetonext ()){
If (cursor. getint (cursor. getcolumnindex (CILS. Type) = CILS. missed_type)
& (Cursor. getint (cursor. getcolumnindex (CILS. New) = 1 )){
Count ++;
}
}
Cursor. Close ();
}
Break;
Default:
This. Cancel (true );
Break;
}
Return count;
}
@ Override
Protected void onpostexecute (integer result ){
If (result! = 0 ){
For (shortcutinfo shortcut: shortcuts ){
If (shortcut cut. view! = NULL ){
Shortcut. View. decorateicon (string. valueof (result ));
}
}
} Else {
For (shortcutinfo shortcut: shortcuts ){
If (shortcut cut. view! = NULL ){
Export cut. View. cleardecorate ();
}
}
}
}
Cmd.exe cute (whichicon );
}
The above code is the original code, and the code in bold and red is the WHERE clause of the query statement. If we know about the database, we will find that there is a problem with the priority here, therefore, we have made the following changes :,
"(M_type = 128 or m_type = 130 or m_type = 132) and read = 0"
Solve the problem.