From efa146577f6a8a24e5ea6f670a37496b05702f49 Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Tue, 27 Feb 2024 18:19:16 +0000 Subject: [PATCH] Add a source_module_name to android_app For multiple mainline prebuilts, we will have multiple versioned prebuilt apps in the tree. The soong name of these prebuilts will have a version prefix to prevent name collisions (e.g. MyGoogleApp.v2). This CL introduces a source_module_name property in android_app_imoprt. This property will be used for the following 1. Determining installation path. This should be /system/app/MyGoogleApp/MyGoogleApp.apk and not /system/app/MyGoogleApp.v2/MyGoogleApp.apk (filename prop determines the filename and not the dir name) 2. Preventing duplicate installation rules: This property will be used to create a dependency to the source app, and call HideFromMake on all the unflagged apps Test: presubmits Test: locally # Created CaptivePortalLoginGoogle.v2 and selected it using one of the RELEASE_APEX_CONTRIBUTION_* flags Bug: 326995930 Change-Id: If4ab9f9bd295117c96eb062cf3b3d2efc8bfed12 --- java/app_import.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/java/app_import.go b/java/app_import.go index 8c90e4c7a..dc84fc26d 100644 --- a/java/app_import.go +++ b/java/app_import.go @@ -145,6 +145,11 @@ type AndroidAppImportProperties struct { // Whether or not to skip checking the preprocessed apk for proper alignment and uncompressed // JNI libs and dex files. Default is false Skip_preprocessed_apk_checks *bool + + // Name of the source soong module that gets shadowed by this prebuilt + // If unspecified, follows the naming convention that the source module of + // the prebuilt is Name() without "prebuilt_" prefix + Source_module_name *string } func (a *AndroidAppImport) IsInstallable() bool { @@ -274,6 +279,10 @@ func (a *AndroidAppImport) InstallApkName() string { return a.BaseModuleName() } +func (a *AndroidAppImport) BaseModuleName() string { + return proptools.StringDefault(a.properties.Source_module_name, a.ModuleBase.Name()) +} + func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext) { if a.Name() == "prebuilt_framework-res" { ctx.ModuleErrorf("prebuilt_framework-res found. This used to have special handling in soong, but was removed due to prebuilt_framework-res no longer existing. This check is to ensure it doesn't come back without readding the special handling.")