The XML files in this directory are taken from the packages tag of a test APK signed with the certificates and keys under the certs/ directory. To recreate the XML files run the following: 1. Build the test APK: mmm -j cts/hostsidetests/appsecurity/test-apps/tinyapp/ 2. Sign the APK with the first signer: apksigner sign --in ${OUT}/data/app/CtsPkgInstallTinyApp/CtsPkgInstallTinyApp.apk --out test.apk \ --cert certs/ec-p256.x509.der --key certs/ec-p256.pk8 3. Install the APK on a device: adb install test.apk 4. Pull the packages.xml file containing the new entry for the APK from the device: adb pull /data/system/packages.xml 5. Search the packages.xml file for the package name 'android.appsecurity.cts.tinyapp'. Following is the full entry when the APK is signed as above: The PackageSignatures#readXml and writeXml methods read and write everything within the sigs tag. The tags and attributes within the sigs tag can be modified and used to verify various good and error paths for the PackageSignaturesTest. Step 2 can be modified to sign with multiple signers by running one of the following commands: - To sign with two signers in the lineage (after the signing key has been rotated once): apksigner sign --in ${OUT}/data/app/CtsPkgInstallTinyApp/CtsPkgInstallTinyApp.apk --out test.apk \ --cert certs/ec-p256.x509.der --key certs/ec-p256.pk8 --next-signer --cert \ certs/ec-p256_2.x509.der --key certs/ec-p256_2.pk8 --lineage certs/ec-p256-lineage-2-signers - To sign with three signers in the lineage (after the second key rotation): apksigner sign --in ${OUT}/data/app/CtsPkgInstallTinyApp/CtsPkgInstallTinyApp.apk --out test.apk \ --cert certs/ec-p256.x509.der --key certs/ec-p256.pk8 --next-signer --cert \ certs/ec-p256_3.x509.der --key certs/ec-p256_3.pk8 --lineage certs/ec-p256-lineage-3-signers - To sign with two distinct signers (NOTE: The V3 signature scheme only supports a single signer, so this method can only be used with signature schemes V1 and V2): apksigner sign --in ${OUT}/data/app/CtsPkgInstallTinyApp/CtsPkgInstallTinyApp.apk --out test.apk \ --cert certs/ec-p256.x509.der --key certs/ec-p256.pk8 --next-signer --cert \ certs/ec-p256_3.x509.der --key certs/ec-p256_3.pk8 --v3-signing-enabled false