Make CTS more opinionated about the platform's default MimeMap.

Historically, the mapping implemented by MimeMap (formerly MimeUtils)
was largely untested and therefore differed between Android devices.

This CL topic makes CtsMimeMapTestCases a lot more opinionated by
checking that:

 - MimeMap.getDefault() must respect all of the mappings supplied
   in stock Android. This is enforced via CTS bundling a copy of:
   - the {,android.,vendor.}mime.types data files
   - DefaultMimeMapFactory (rewritten via jarjar to
     android.content.type.cts.StockAndroidMimeMapFactory)
   MimeMap.getDefault() is allowed to implement _additional_
   mappings, but changed or removed mappings are not allowed.
 - Public APIs android.webkit.MimeTypeMap and
   URLConnection.getFileNameMap() must behave consistently with
   MimeMap.getDefault() (in stock Android, those APIs are
   implemented directly on top of MimeMap.getDefault()).

Test: atest CtsMimeMapTestCases
Test: atest CtsLibcoreTestCases:libcore.libcore.net.MimeMapTest
Test: The above atest runs pass on a device that contains an
      additional mapping in vendor.mime.types that is not
      present in CTS.
Test: Checked that on a device that changes a mapping in
      android.mime.types, CtsLibcoreTestCases still passes
      but CtsMimeMapTestCases fails.

Bug: 141842930
Bug: 139895945

Change-Id: I68e0e9c3ce53c1acf2a89f8b80519f4658c07217
3 files changed