Android 11.0.0 release 30
TelephonyBackupAgent: Allow U+0000 in SMS body.

Due to a bug that is still being investigated, some zero bytes
(equivalent to character U+0000) were inserted into SMS messages
(specifically, appended to the end of each PDU), corrupting the
SMS. So far, all known occurrences were between 27 May and 30 June
on devices that were running dogfood versions of Android R.

The root cause might already have been fixed, but we don't know
because the root cause has not yet been identified. It would
also be good to fix up these corruted messages in the sms table.

As a short-term measure, this CL fixes TelephonyBackupAgent
to not throw SQLiteException when SMS with zero-bytes are
inserted. This means that the dogfooders will at least not
lose these SMS when migrating to a new device.

Test: atest TelephonyProviderTests:com.android.providers.telephony.TelephonyBackupAgentTest
Test: Wrote a little test app to check that equvialent code
      worked on a sample SQLite table that contained 0 bytes
      in a TEXT column. The code added to TelephonyBackupAgent
      has not been tested because TelephonyBackupAgentTest
      is built on top a hard-coded fake Provider that doesn't
      even look at the query SQL. Refactoring the test to
      use an in-memory SQLite database would be significant
      effort, so was skipped.
Bug: 160801497

Change-Id: Id37e11d546473acd6d495a413b52a96039549ec5
(cherry picked from commit 8ccd69e58be2556e2c8d1adce5280dd8e438d807)
1 file changed