Skip to content

Commit

Permalink
Fix missing messages after import on Android 14 due to subscriptionId
Browse files Browse the repository at this point in the history
On Android 14, imported messages are not visible if their
subscriptionId[1] does not correspond to one of the SIMs in the
device. As a workaround, we set subscriptionId to -1 ("unknown") on
all messages during import.

This does mean that when exporting then importing on the same device,
the SIM associations will be lost. But that doesn't seem noticeable.

Credit: SMS Import / Export app,
https://www.github.com/tmo1/sms-ie/issues/128

Fixes #191.

[1] https://developer.android.com/identity/user-data-ids#mobile-subscription-status
  • Loading branch information
tom93 committed Jul 15, 2024
1 parent 1c7376c commit 3b389c5
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ class MessagesImporter(private val activity: SimpleActivity) {
activity.toast(org.fossify.commons.R.string.no_entries_for_importing)
return
}
ImportMessagesDialog(activity, deserializedList)
val messages = deserializedList.map { message ->
// workaround for messages not being imported on Android 14 when the device has a different subscriptionId (see #191)
when (message) {
is SmsBackup -> message.copy(subscriptionId = -1)
is MmsBackup -> message.copy(subscriptionId = -1)
}
}
ImportMessagesDialog(activity, messages)
} catch (e: SerializationException) {
activity.toast(org.fossify.commons.R.string.invalid_file_format)
} catch (e: IllegalArgumentException) {
Expand Down

0 comments on commit 3b389c5

Please sign in to comment.