Manifest Fixer Params code refactor

This CL refactors the code related to ManifestFixer parameters.
The required parameters android.ModuleContext, manifest android.Path are
passed separately as the parameters and the optional parameters are
kept as part of the ManifestFixerParams struct.

By default, the member variable of struct have the zero (nil, false,
empty string) values. Hence, it is only required to pass the
parameters of interest at the time of function call to
ManifestFixer.

Manual testing done to check the working of the code.

Test: m nothing && m test_com.android.sdkext
Test: manually tested the generation of AndroidManifest in the out
directory with the testOnly attribute
Test: atest manifest_fixer_test --host
To test the existing unittests are not breaking.

Change-Id: I20cb6c06c57f8fe7811050288bcb03945dc0425b
This commit is contained in:
Gurpreet Singh
2022-02-10 13:28:35 +00:00
parent db07f002b8
commit 7deabfacd0
3 changed files with 21 additions and 35 deletions

View File

@@ -398,18 +398,8 @@ func (a *apexBundle) buildBundleConfig(ctx android.ModuleContext) android.Output
}
func markManifestTestOnly(ctx android.ModuleContext, androidManifestFile android.Path) android.Path {
return java.ManifestFixer(java.ManifestFixerParams{
Ctx: ctx,
Manifest: androidManifestFile,
SdkContext: nil,
ClassLoaderContexts: nil,
IsLibrary: false,
UseEmbeddedNativeLibs: false,
UsesNonSdkApis: false,
UseEmbeddedDex: false,
HasNoCode: false,
TestOnly: true,
LoggingParent: "",
return java.ManifestFixer(ctx, androidManifestFile, java.ManifestFixerParams{
TestOnly: true,
})
}