Durable metadata for pending and trashed files.

Pending and trashed media items are two unique examples of files that
should remain hidden from view by default, and which have a specific
expiration date beyond which they should be automatically deleted.

The original design for these items was to store the IS_PENDING and
IS_TRASHED values only in the MediaProvider database, but this design
is fragile, since the information is lost if the database is wiped
or corrupted.  In addition, if the user carries an SD card from one
device to another, the second device has no knowledge of the pending
or trashed nature of the files, and it would very confusingly index
this content.

To solve these problems, we continue with the general design pattern
we've been using in MediaProvider, where we rely on metadata that
resides inside the file or in its name.  When an item is pending or
trashed, we rename the file to be ".trashed" followed by the date
when it expires, followed by the original name.  This design also
has the nice property that older Android devices and desktop PCs
will typically treat these ".trashed"-style files as hidden, which
matches user expectations.  To avoid confusing client apps, we retain
the original DISPLAY_NAME that they expect.

This change simplifies ensureFileColumns() to make it clear that
we're typically going one of two directions: we have a raw path and
we're trying to deconstruct individual columns values, or we have
individual column values and we're trying to construct a raw path;
the updated FileUtils methods now consistently handle both of
these directions, along with tests to verify.

Move playlist name tests to CTS, since MediaProviderClientTests
technically meet the "!isCallingPackageSystem()" test.

Finally, we update our legacy migration logic to rename pending or
trashed files during the upgrade process, and update tests to verify
data continues to be migrated successfully.

Bug: 151436090
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: I01341b96b4d5bb78f5b99bbd7762f72610a9c6df
11 files changed