blob: 1aa96552d518e055092e6e6cee869dec036022a7 [file] [log] [blame]
// Copyright (C) 2018 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// These apex definitions will generate the prebuilt test data. The modules
// are disabled so as not to pollute the build.
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
apex_key {
name: "com.android.apex.test_package.key",
public_key: "com.android.apex.test_package.avbpubkey",
private_key: "com.android.apex.test_package.pem",
installable: false,
}
apex_key {
name: "com.android.apex.compressed.key",
public_key: "com.android.apex.compressed.avbpubkey",
private_key: "com.android.apex.compressed.pem",
installable: false,
}
apex {
name: "apex.apexd_test",
manifest: "manifest.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.key",
installable: false,
min_sdk_version: "29", // test requires hashtree to be present.
}
apex {
name: "com.android.apex.compressed.v1",
manifest: "manifest_compressed.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.compressed.key",
installable: false,
test_only_force_compression: true,
}
genrule {
// Generates a compressed apex which doesn't have an original_apex file in it
name: "gen_capex_without_apex",
out: ["com.android.apex.compressed.v1_without_apex.capex"],
srcs: [":com.android.apex.compressed.v1"],
tools: ["soong_zip"],
cmd: "unzip -q $(in) -d $(genDir) && rm $(genDir)/original_apex && " +
"$(location soong_zip) -d -C $(genDir) -D $(genDir) -L 9 " +
"-o $(genDir)/com.android.apex.compressed.v1_without_apex.capex"
}
genrule {
// Generates a capex which has same module name as com.android.apex.compressed, but
// is contains a different public key.
name: "gen_key_mismatch_capex",
out: ["com.android.apex.compressed_different_key.capex"],
srcs: [":apex.apexd_test_no_inst_key"],
tools: ["soong_zip", "zipalign", "conv_apex_manifest", "apex_compression_tool"],
cmd: "unzip -q $(in) -d $(genDir) && " +
"$(location conv_apex_manifest) setprop name com.android.apex.compressed $(genDir)/apex_manifest.pb && " +
"$(location soong_zip) -d -C $(genDir) -D $(genDir) " +
"-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " +
"-o $(genDir)/unaligned.apex && " +
"$(location zipalign) -f 4096 $(genDir)/unaligned.apex " +
"$(genDir)/com.android.apex.compressed_different_key.apex && " +
"$(location apex_compression_tool) compress " +
"--apex_compression_tool_path='out/soong/host/linux-x86/bin:prebuilts/sdk/tools/linux/bin' " +
"--input=$(genDir)/com.android.apex.compressed_different_key.apex " +
"--output=$(genDir)/com.android.apex.compressed_different_key.capex"
}
genrule {
// Generates a capex which has a different public key than original_apex
name: "gen_key_mismatch_with_original_capex",
out: ["com.android.apex.compressed_key_mismatch_with_original.capex"],
srcs: [":com.android.apex.compressed.v1"],
tools: ["soong_zip"],
cmd: "unzip -q $(in) -d $(genDir) && " + // unzip input
"echo 'different-key' >> $(genDir)/apex_pubkey && " + // modify the public key
"$(location soong_zip) -d -C $(genDir) -D $(genDir) -L 9 " +// repack the compressed APEX
"-o $(genDir)/com.android.apex.compressed_key_mismatch_with_original.capex",
}
apex {
name: "com.android.apex.compressed.v1_original",
manifest: "manifest_compressed.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.compressed.key",
installable: false,
compressible: false,
}
apex {
name: "com.android.apex.compressed.v2",
manifest: "manifest_compressed_v2.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.compressed.key",
installable: false,
test_only_force_compression: true,
}
apex {
name: "apex.apexd_test_f2fs",
manifest: "manifest.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.key",
installable: false,
min_sdk_version: "current",
payload_fs_type: "f2fs",
}
apex {
name: "apex.apexd_test_no_hashtree",
manifest: "manifest.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.key",
installable: false,
test_only_no_hashtree: true,
}
// This APEX has same name and version as apex.apexd_test_no_hashtree, but has
// different content. It's used to test that staging a same version of already
// active APEX without hashtree doesn't impact already active one.
apex {
name: "apex.apexd_test_no_hashtree_2",
manifest: "manifest.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: [
"another_prebuilt_file",
"sample_prebuilt_file",
],
key: "com.android.apex.test_package.key",
installable: false,
test_only_no_hashtree: true,
}
apex {
name: "apex.apexd_test_v2",
manifest: "manifest_v2.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.key",
installable: false,
}
apex {
name: "apex.apexd_test_v2_legacy",
manifest: "manifest_v2.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.key",
installable: false,
min_sdk_version: "29", // add apex_manifest.json as well
}
genrule {
name: "apex.apexd_test_v2_no_pb",
srcs: [":apex.apexd_test_v2_legacy"],
out: ["apex.apexd_test_v2_no_pb.apex"],
tools: ["zip2zip"],
cmd: "$(location zip2zip) -i $(in) -x apex_manifest.pb -o $(out)", // remove apex_manifest.pb
}
apex {
name: "apex.apexd_test_v3",
manifest: "manifest_v3.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.key",
installable: false,
}
apex_key {
name: "com.android.apex.test_package.preinstall.key",
public_key: "com.android.apex.test_package.preinstall.avbpubkey",
private_key: "com.android.apex.test_package.preinstall.pem",
installable: false,
}
apex {
name: "apex.apexd_test_preinstall",
manifest: "manifest_preinstall.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.preinstall.key",
binaries: ["apex_test_preInstallHook"],
installable: false,
}
apex_key {
name: "com.android.apex.test_package.postinstall.key",
public_key: "com.android.apex.test_package.postinstall.avbpubkey",
private_key: "com.android.apex.test_package.postinstall.pem",
installable: false,
}
apex {
name: "apex.apexd_test_postinstall",
manifest: "manifest_postinstall.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.postinstall.key",
binaries: ["apex_test_postInstallHook"],
installable: false,
}
apex_key {
name: "com.android.apex.test_package.prepostinstall.fail.key",
public_key: "com.android.apex.test_package.prepostinstall.fail.avbpubkey",
private_key: "com.android.apex.test_package.prepostinstall.fail.pem",
installable: false,
}
apex {
name: "apex.apexd_test_prepostinstall.fail",
manifest: "manifest_prepostinstall.fail.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.prepostinstall.fail.key",
binaries: ["apex_test_prePostInstallHookFail"],
installable: false,
}
apex_key {
name: "com.android.apex.test_package.no_inst_key.key",
public_key: "com.android.apex.test_package.no_inst_key.avbpubkey",
private_key: "com.android.apex.test_package.no_inst_key.pem",
installable: true, // set to true to prevent bundling into the APEX
}
apex {
name: "apex.apexd_test_no_inst_key",
manifest: "manifest_no_inst_key.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.no_inst_key.key",
installable: false,
}
apex {
name: "apex.apexd_test_f2fs_no_inst_key",
manifest: "manifest_no_inst_key.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.no_inst_key.key",
installable: false,
payload_fs_type: "f2fs",
}
apex_key {
name: "com.android.apex.test_package_2.key",
public_key: "com.android.apex.test_package_2.avbpubkey",
private_key: "com.android.apex.test_package_2.pem",
installable: false,
}
apex {
name: "apex.apexd_test_different_app",
manifest: "manifest_different_app.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package_2.key",
installable: false,
}
sh_binary {
name: "apex_test_preInstallHook",
src: "preInstallHook.sh",
}
sh_binary {
name: "apex_test_postInstallHook",
src: "postInstallHook.sh",
}
sh_binary {
name: "apex_test_prePostInstallHookFail",
src: "fail.sh",
}
apex {
name: "apex.apexd_test_nocode",
manifest: "manifest_nocode.json",
file_contexts: ":apex.test-file_contexts",
prebuilts: ["sample_prebuilt_file"],
key: "com.android.apex.test_package.key",
installable: false,
}
prebuilt_etc {
name: "another_prebuilt_file",
src: "another_prebuilt_file",
}
prebuilt_apex {
name: "apex.corrupted_b146895998",
src: "corrupted_b146895998.apex",
filename: "corrupted_b146895998.apex",
installable: false,
}
// APEX for banned name test cannot be generated at build time.
// This file can be generated manually by creating new apex target
// with manifest name 'sharedlibs', and modify aapt2 to skip validating
// package name from aapt::util::IsAndroidPackageName().
prebuilt_apex {
name: "apex.banned_name",
src: "sharedlibs.apex",
filename: "sharedlibs.apex",
installable: false,
}