From adeea59b4dbdc65ea9b479c3d613a1e933fb9fb0 Mon Sep 17 00:00:00 2001 From: Tobias Thierer Date: Fri, 27 Sep 2019 20:27:29 +0100 Subject: 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 --- mime/jarjar-rules.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 mime/jarjar-rules.txt (limited to 'mime/jarjar-rules.txt') diff --git a/mime/jarjar-rules.txt b/mime/jarjar-rules.txt new file mode 100644 index 000000000000..145d1dbf3d11 --- /dev/null +++ b/mime/jarjar-rules.txt @@ -0,0 +1 @@ +rule android.content.type.DefaultMimeMapFactory android.content.type.cts.StockAndroidMimeMapFactory \ No newline at end of file -- cgit v1.2.3-59-g8ed1b