From 75d65f360c18806e683aed87679ce5bcc52823d4 Mon Sep 17 00:00:00 2001 From: Gurpreet Singh Date: Mon, 24 Jan 2022 17:44:05 +0000 Subject: Add testOnly attribute to AndroidManifest file of apex_test If the build file contains the apex_test module, add the testOnly attribute to the application element of the corresponding AndroidManifest file and set its value to true. If the testOnly attribute is already present and has value false, then do nothing. Tests added in manifest_fixer_test.py to check if the updated AndroidManifest file has the testOnly attribute set to true or not. Bug: 213310150 Test: atest --host manifest_fixer_test Test: m nothing Test: manually checked the AndroidManifest file generated Change-Id: I36247dbe0261c342d451a4422c314fd8fe0c2369 --- java/app_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'java/app_test.go') diff --git a/java/app_test.go b/java/app_test.go index 2322ef44e..16bbec158 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -2512,7 +2512,7 @@ func TestUsesLibraries(t *testing.T) { `--uses-library qux ` + `--uses-library quuz ` + `--uses-library runtime-library` - android.AssertStringEquals(t, "manifest_fixer args", expectManifestFixerArgs, actualManifestFixerArgs) + android.AssertStringDoesContain(t, "manifest_fixer args", actualManifestFixerArgs, expectManifestFixerArgs) // Test that all libraries are verified (library order matters). verifyCmd := app.Rule("verify_uses_libraries").RuleParams.Command @@ -3055,7 +3055,7 @@ func TestTargetSdkVersionManifestFixer(t *testing.T) { result := fixture.RunTestWithBp(t, bp) foo := result.ModuleForTests("foo", "android_common") - manifestFixerArgs := foo.Output("manifest_fixer/AndroidManifest.xml").Args - android.AssertStringEquals(t, testCase.name, testCase.targetSdkVersionExpected, manifestFixerArgs["targetSdkVersion"]) + manifestFixerArgs := foo.Output("manifest_fixer/AndroidManifest.xml").Args["args"] + android.AssertStringDoesContain(t, testCase.name, manifestFixerArgs, "--targetSdkVersion "+testCase.targetSdkVersionExpected) } } -- cgit v1.2.3-59-g8ed1b