Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d756e60 authored by Jiyong Park's avatar Jiyong Park Committed by Android (Google) Code Review
Browse files

Merge changes from topics "presubmit-am-4cd8cd324e7e4d359a3ec54800a0c725",...

Merge changes from topics "presubmit-am-4cd8cd324e7e4d359a3ec54800a0c725", "presubmit-am-724cd6e390214cefa6370a38673590b7" into tm-mainline-prod

* changes:
  Put base APK when AppSet is included in APEX
  Use PackedAdditionalOutputs when reading apk_set for canned_fs_config
parents 8a7dad00 e7cc3513
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -7285,12 +7285,18 @@ func TestAppSetBundle(t *testing.T) {
	ensureContains(t, content, `"compression":{"uncompressed_glob":["apex_payload.img","apex_manifest.*"]}`)
	s := mod.Rule("apexRule").Args["copy_commands"]
	copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
	if len(copyCmds) != 3 {
		t.Fatalf("Expected 3 commands, got %d in:\n%s", len(copyCmds), s)
	if len(copyCmds) != 4 {
		t.Fatalf("Expected 4 commands, got %d in:\n%s", len(copyCmds), s)
	}
	ensureMatches(t, copyCmds[0], "^rm -rf .*/app/AppSet@TEST.BUILD_ID$")
	ensureMatches(t, copyCmds[1], "^mkdir -p .*/app/AppSet@TEST.BUILD_ID$")
	ensureMatches(t, copyCmds[2], "^unzip .*-d .*/app/AppSet@TEST.BUILD_ID .*/AppSet.zip$")
	ensureMatches(t, copyCmds[2], "^cp -f .*/app/AppSet@TEST.BUILD_ID/AppSet.apk$")
	ensureMatches(t, copyCmds[3], "^unzip .*-d .*/app/AppSet@TEST.BUILD_ID .*/AppSet.zip$")

	// Ensure that canned_fs_config has an entry for the app set zip file
	generateFsRule := mod.Rule("generateFsConfig")
	cmd := generateFsRule.RuleParams.Command
	ensureContains(t, cmd, "AppSet.zip")
}

func TestAppSetBundlePrebuilt(t *testing.T) {
+9 −2
Original line number Diff line number Diff line
@@ -463,8 +463,13 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
			pathOnDevice := filepath.Join("/system", fi.path())
			copyCommands = append(copyCommands, "ln -sfn "+pathOnDevice+" "+destPath)
		} else {
			// Copy the file into APEX
			copyCommands = append(copyCommands, "cp -f "+fi.builtFile.String()+" "+destPath)

			var installedPath android.InstallPath
			if fi.class == appSet {
				// In case of AppSet, we need to copy additional APKs as well. They
				// are zipped. So we need to unzip them.
				copyCommands = append(copyCommands,
					fmt.Sprintf("unzip -qDD -d %s %s", destPathDir,
						fi.module.(*java.AndroidAppSet).PackedAdditionalOutputs().String()))
@@ -473,7 +478,6 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
						fi.stem(), fi.builtFile, fi.module.(*java.AndroidAppSet).PackedAdditionalOutputs())
				}
			} else {
				copyCommands = append(copyCommands, "cp -f "+fi.builtFile.String()+" "+destPath)
				if installSymbolFiles {
					installedPath = ctx.InstallFile(pathWhenActivated.Join(ctx, fi.installDir), fi.stem(), fi.builtFile)
				}
@@ -1090,8 +1094,11 @@ func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.Outp
				executablePaths = append(executablePaths, filepath.Join(f.installDir, s))
			}
		} else if f.class == appSet {
			// base APK
			readOnlyPaths = append(readOnlyPaths, pathInApex)
			// Additional APKs
			appSetDirs = append(appSetDirs, f.installDir)
			appSetFiles[f.installDir] = f.builtFile
			appSetFiles[f.installDir] = f.module.(*java.AndroidAppSet).PackedAdditionalOutputs()
		} else {
			readOnlyPaths = append(readOnlyPaths, pathInApex)
		}