MMS/SMS database contains old messages but they are not displayed
Added by Fil Lupin 7 months ago
Hi,
I converted my replicant 4.2 mmssms.db database to replicant 6 format (see https://redmine.replicant.us/boards/9/topics/14315?r=15991).
I checked then that this new database first message is the same than the old replicant 4.2 database.
However, I noticed that in the SMS application, only recent messages are displayed.
I unchecked the option "delete old messages" before loading the new database.
Do you know what could cause this?
Regards
Replies (2)
RE: MMS/SMS database contains old messages but they are not displayed - Added by Fil Lupin 7 months ago
I just remind to check logcatn here is the output regarding this app:
01-02 18:11:55.770 4823 4823 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:55.780 4823 4838 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:55.790 2841 3132 V BlacklistProvider: Query uri=content://blacklist, match=0
01-02 18:11:55.805 4823 4823 W a : Failed to initialize!
01-02 18:11:55.865 4823 4823 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:55.885 4823 4842 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:55.890 4823 4839 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:55.895 4823 4844 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:55.975 4823 4843 I MessagingAppDataModel: Fixup: Send failed - 0 Download failed - 0
01-02 18:11:55.980 4823 4843 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:55.980 4823 4843 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:56.070 4823 4842 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:56.070 4823 4842 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:56.090 4823 4842 W MessagingApp: PhoneUtils.getSelfRawNumber: subInfo is null for -1
01-02 18:11:56.090 4823 4842 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:56.100 4823 4839 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:56.105 4823 4846 I MessagingAppDataModel: SyncMessagesAction: Starting batch for messages from 1325383350057 to 1325524315774 (message update limit = 80, message scan limit = 4000)
01-02 18:11:56.110 4823 4839 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:56.110 4823 4839 W MessagingApp: PhoneUtils.getSelfRawNumber: subInfo is null for -1
01-02 18:11:56.115 4823 4839 W MessagingApp: PhoneUtils.getForLMR1(): invalid subId = -1
01-02 18:11:56.170 4823 4847 I MessagingAppDataModel: SyncMessagesAction: All messages now in sync
Seems to be several errors:
PhoneUtils.getForLMR1(): invalid subId = -1
comes from https://android.googlesource.com/platform/packages/apps/Messaging/+/refs/heads/main/src/com/android/messaging/FactoryImpl.java#205
and is called by getPhoneUtils with -1 as parameter.
PhoneUtils.getSelfRawNumber: subInfo is null for -1
comes from https://android.googlesource.com/platform/packages/apps/Messaging/+/refs/heads/main/src/com/android/messaging/util/PhoneUtils.java#503
and is called by getSelfRawNumber with a boolean parameter
SyncMessagesAction: Starting batch for messages from 1325383350057 to 1325524315774 (message update limit = 80, message scan limit = 4000)
comes from https://android.googlesource.com/platform/packages/apps/Messaging/+/master/src/com/android/messaging/datamodel/action/SyncMessagesAction.java#217
and is called by doBackgroundWork without parameter.
RE: MMS/SMS database contains old messages but they are not displayed - Added by Fil Lupin 7 months ago
As described in https://redmine.replicant.us/boards/9/topics/14315, in mmssms.db database, sms table has a new sub_id field which default value is -1.
I understand for a reason, last sms & mms are read and displayed but older are not.
Searching for this, I found https://pupuweb.com/resolving-sms-backup-restore-issues-android-14/, https://old.reddit.com/r/android_beta/comments/15mzaij/sms_backup_and_restore_issues/ and https://github.com/tmo1/sms-ie?tab=readme-ov-file which invite me to change sub_id default value to 1.
Since DB-Browser forbid to change a column definition, I used DB-Browser to export sms SQL CREATE code, I changed -1 into 1 for sub_id column, and then executed the code with Execute SQL.
It seems there is much more sms & mms in the app, but it's hard to confirm since I do not have any message count in the app.
It's important to set the good date & time before pushing mmssms.db, since messages are displayed according to the current date & time.
Then, once opened the app, messages threads seems to be rebuilt. One can see the messages updating from newer ones to older ones, thread by thread.
A few minutes after, threads and messages seems to not update anymore
I checked logcat with
adb logcat | grep MessagingApp > logcat-MessagingApp.log
In the output log file, I especially got 7 messages as this one:
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: SyncMessagesAction: Database exception
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: android.database.sqlite.SQLiteException: unknown error (code 0): Unable to convert BLOB to string
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at android.database.CursorWindow.nativeGetString(Native Method)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at android.database.CursorWindow.getString(CursorWindow.java:438)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at android.database.CursorWrapper.getString(CursorWrapper.java:137)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at com.android.messaging.sms.DatabaseMessages$SmsMessage.t(SourceFile:1160)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at com.android.messaging.datamodel.action.P.es(SourceFile:514)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at com.android.messaging.datamodel.action.P.er(SourceFile:503)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at com.android.messaging.datamodel.action.L.a(SourceFile:195)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at com.android.messaging.datamodel.action.SyncMessagesAction.a(SourceFile:305)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at com.android.messaging.datamodel.action.SyncMessagesAction.dX(SourceFile:244)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at com.android.messaging.datamodel.action.BackgroundWorkerService.onHandleIntent(SourceFile:1146)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at android.os.Handler.dispatchMessage(Handler.java:102)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at android.os.Looper.loop(Looper.java:148)
04-10 10:30:37.955 3453 3686 E MessagingAppDataModel: at android.os.HandlerThread.run(HandlerThread.java:61)
04-10 10:30:37.970 3453 3687 E MessagingAppDataModel: SyncMessagesAction: Sync failed - terminating