From 7d6574e642667226c3f0bbb28f0caa3679e75f5c Mon Sep 17 00:00:00 2001 From: Sorin Basca Date: Wed, 8 Jan 2025 15:59:22 +0000 Subject: Add alternative for old debian mime types Bug: 387943358 Bug: 387972892 Test: atest CtsMimeMapTestCases:android.content.type.cts Change-Id: I46242145bc8b1b0170673c0c2dde13f01af71e29 --- mime/Android.bp | 37 +++++++++++++++++++++++++++++++++++++ mime/jarjar-rules-alt.txt | 1 + mime/jarjar-rules.txt | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 mime/jarjar-rules-alt.txt diff --git a/mime/Android.bp b/mime/Android.bp index 20110f1dfb47..b609548fcbab 100644 --- a/mime/Android.bp +++ b/mime/Android.bp @@ -49,6 +49,17 @@ java_library { ], } +java_library { + name: "mimemap-testing-alt", + defaults: ["mimemap-defaults"], + static_libs: ["mimemap-testing-alt-res.jar"], + jarjar_rules: "jarjar-rules-alt.txt", + visibility: [ + "//cts/tests/tests/mimemap:__subpackages__", + "//frameworks/base:__subpackages__", + ], +} + // The mimemap-res.jar and mimemap-testing-res.jar genrules produce a .jar that // has the resource file in a subdirectory res/ and testres/, respectively. // They need to be in different paths because one of them ends up in a @@ -86,6 +97,19 @@ java_genrule { cmd: "mkdir $(genDir)/testres/ && cp $(in) $(genDir)/testres/ && $(location soong_zip) -C $(genDir) -o $(out) -D $(genDir)/testres/", } +// The same as mimemap-testing-res.jar except that the resources are placed in a different directory. +// They get bundled with CTS so that CTS can compare a device's MimeMap implementation vs. +// the stock Android one from when CTS was built. +java_genrule { + name: "mimemap-testing-alt-res.jar", + tools: [ + "soong_zip", + ], + srcs: [":mime.types.minimized-alt"], + out: ["mimemap-testing-alt-res.jar"], + cmd: "mkdir $(genDir)/testres-alt/ && cp $(in) $(genDir)/testres-alt/ && $(location soong_zip) -C $(genDir) -o $(out) -D $(genDir)/testres-alt/", +} + // Combination of all *mime.types.minimized resources. filegroup { name: "mime.types.minimized", @@ -99,6 +123,19 @@ filegroup { ], } +// Combination of all *mime.types.minimized resources. +filegroup { + name: "mime.types.minimized-alt", + visibility: [ + "//visibility:private", + ], + device_common_srcs: [ + ":debian.mime.types.minimized-alt", + ":android.mime.types.minimized", + ":vendor.mime.types.minimized", + ], +} + java_genrule { name: "android.mime.types.minimized", visibility: [ diff --git a/mime/jarjar-rules-alt.txt b/mime/jarjar-rules-alt.txt new file mode 100644 index 000000000000..9a7644325336 --- /dev/null +++ b/mime/jarjar-rules-alt.txt @@ -0,0 +1 @@ +rule android.content.type.DefaultMimeMapFactory android.content.type.cts.StockAndroidAltMimeMapFactory diff --git a/mime/jarjar-rules.txt b/mime/jarjar-rules.txt index 145d1dbf3d11..e1ea8e10314c 100644 --- a/mime/jarjar-rules.txt +++ b/mime/jarjar-rules.txt @@ -1 +1 @@ -rule android.content.type.DefaultMimeMapFactory android.content.type.cts.StockAndroidMimeMapFactory \ No newline at end of file +rule android.content.type.DefaultMimeMapFactory android.content.type.cts.StockAndroidMimeMapFactory -- cgit v1.2.3-59-g8ed1b