Define secondary media item bucketing.

The existing buckets work well for first-level clustering of related
media, but it's common for multiple media items within a directory
to form a conceptual unit.  To support this, we're creating a
second-level of bucketing which is formed using the first part of
the file name.

This supports common industry-standard patterns like:

    IMG1024.JPG
    IMG1024.CR2

While also opening the door to further flexibility in the future:

    IMG1024.JPG
    IMG1024.HDR.JPG
    IMG1024.BURST001.JPG
    IMG1024.BURST002.JPG
    IMG1024.BURST003.JPG
    IMG1024.DNG
    IMG1024.DEBUG.BIN

We're currently advocating that the default representation of one of
these secondary clusters is the shortest .JPG filename contained
inside, with length ties broken alphabetically.

Clean up database management so that upgraded schema always matches
pristine schema, with tests to verify.  Generate views using the
actual projection mappings used at runtime.

Bug: 115377970
Test: atest MediaProviderTests
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: Ic679055ab6c884d2048626f51670a5dd370281c0
2 files changed