Merge tag 'android-13.0.0_r11' into staging/lineage-20.0_merge-android-13.0.0_r11

Android 13.0.0 release 11

# -----BEGIN PGP SIGNATURE-----
#
# iF0EABECAB0WIQRDQNE1cO+UXoOBCWTorT+BmrEOeAUCY0jiMAAKCRDorT+BmrEO
# eFntAJ9J2uBaX6wQnktg5H5364zdU29IvgCfcTU/eoANkYymK0W6bbtTHZjJfI8=
# =TKR3
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri Oct 14 07:14:40 2022 EEST
# gpg:                using DSA key 4340D13570EF945E83810964E8AD3F819AB10E78
# gpg: Good signature from "The Android Open Source Project <initial-contribution@android.com>" [marginal]
# gpg: initial-contribution@android.com: Verified 1351 signatures in the past
#      11 months.  Encrypted 4 messages in the past 9 months.
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 4340 D135 70EF 945E 8381  0964 E8AD 3F81 9AB1 0E78

# By Kousik Kumar (5) and others
# Via Android Build Coastguard Worker (261) and others
* tag 'android-13.0.0_r11':
  Use implementation jar for updatable-media in snapshot for S
  Add ability to force compile as 64 bit.
  Stop exporting systemserverclasspath_fragment when targeting S
  [RESTRICT AUTOMERGE] Cleanup RBE logs directory
  Cleanup RBE logs directory
  [RESTRICT AUTOMERGE] Cleanup RBE logs directory
  Pass along local resource fraction to reproxy
  Do not dump metrics if reproxy was never started
  Allow framework-media to build the framework-media.impl

Change-Id: Ia3efd73f45282c4a7d669c7a9f6b359cc5e77212
diff --git a/android/config.go b/android/config.go
index 3c99659..9301df8 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1239,6 +1239,10 @@
 	return c.config.productVariables.DeviceKernelHeaders
 }
 
+func (c *deviceConfig) TargetSpecificHeaderPath() string {
+	return String(c.config.productVariables.TargetSpecificHeaderPath)
+}
+
 // JavaCoverageEnabledForPath returns whether Java code coverage is enabled for
 // path. Coverage is enabled by default when the product variable
 // JavaCoveragePaths is empty. If JavaCoveragePaths is not empty, coverage is
diff --git a/android/namespace.go b/android/namespace.go
index fc7bc29..85f276a 100644
--- a/android/namespace.go
+++ b/android/namespace.go
@@ -136,6 +136,9 @@
 			return fmt.Errorf("a namespace must be the first module in the file")
 		}
 	}
+	if (namespace.exportToKati) {
+		r.rootNamespace.visibleNamespaces = append(r.rootNamespace.visibleNamespaces, namespace)
+	}
 	r.sortedNamespaces.add(namespace)
 
 	r.namespacesByDir.Store(namespace.Path, namespace)
diff --git a/android/paths.go b/android/paths.go
index e7829b9..fd04830 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -1080,6 +1080,31 @@
 	return ret, nil
 }
 
+// pathForSourceRelaxed creates a SourcePath from pathComponents, but does not check that it exists.
+// It differs from pathForSource in that the path is allowed to exist outside of the PathContext.
+func pathForSourceRelaxed(ctx PathContext, pathComponents ...string) (SourcePath, error) {
+	p := filepath.Join(pathComponents...)
+	ret := SourcePath{basePath{p, ""}, "."}
+
+	abs, err := filepath.Abs(ret.String())
+	if err != nil {
+		return ret, err
+	}
+	buildroot, err := filepath.Abs(ctx.Config().soongOutDir)
+	if err != nil {
+		return ret, err
+	}
+	if strings.HasPrefix(abs, buildroot) {
+		return ret, fmt.Errorf("source path %s is in output", abs)
+	}
+
+	if pathtools.IsGlob(ret.String()) {
+		return ret, fmt.Errorf("path may not contain a glob: %s", ret.String())
+	}
+
+	return ret, nil
+}
+
 // existsWithDependencies returns true if the path exists, and adds appropriate dependencies to rerun if the
 // path does not exist.
 func existsWithDependencies(ctx PathContext, path SourcePath) (exists bool, err error) {
@@ -1134,6 +1159,31 @@
 	return path
 }
 
+// PathForSourceRelaxed joins the provided path components.  Unlike PathForSource,
+// the result is allowed to exist outside of the source dir.
+// On error, it will return a usable, but invalid SourcePath, and report a ModuleError.
+func PathForSourceRelaxed(ctx PathContext, pathComponents ...string) SourcePath {
+	path, err := pathForSourceRelaxed(ctx, pathComponents...)
+	if err != nil {
+		reportPathError(ctx, err)
+	}
+
+	if modCtx, ok := ctx.(ModuleContext); ok && ctx.Config().AllowMissingDependencies() {
+		exists, err := existsWithDependencies(ctx, path)
+		if err != nil {
+			reportPathError(ctx, err)
+		}
+		if !exists {
+			modCtx.AddMissingDependencies([]string{path.String()})
+		}
+	} else if exists, _, err := ctx.Config().fs.Exists(path.String()); err != nil {
+		ReportPathErrorf(ctx, "%s: %s", path, err.Error())
+	} else if !exists {
+		ReportPathErrorf(ctx, "source path %s does not exist", path)
+	}
+	return path
+}
+
 // ExistentPathForSource returns an OptionalPath with the SourcePath, rooted from SrcDir, *not*
 // rooted from the module's local source directory, if the path exists, or an empty OptionalPath if
 // it doesn't exist. Dependencies are added so that the ninja file will be regenerated if the state
diff --git a/android/variable.go b/android/variable.go
index 4420684..0748086 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -73,6 +73,13 @@
 			Header_libs         []string `android:"arch_variant"`
 		} `android:"arch_variant"`
 
+		Malloc_not_svelte_libc32 struct {
+			Cflags              []string `android:"arch_variant"`
+			Shared_libs         []string `android:"arch_variant"`
+			Whole_static_libs   []string `android:"arch_variant"`
+			Exclude_static_libs []string `android:"arch_variant"`
+		} `android:"arch_variant"`
+
 		Malloc_zero_contents struct {
 			Cflags []string `android:"arch_variant"`
 		} `android:"arch_variant"`
@@ -134,6 +141,7 @@
 		Eng struct {
 			Cflags   []string
 			Cppflags []string
+			Init_rc  []string
 			Lto      struct {
 				Never *bool
 			}
@@ -259,6 +267,7 @@
 	Always_use_prebuilt_sdks     *bool    `json:",omitempty"`
 	Skip_boot_jars_check         *bool    `json:",omitempty"`
 	Malloc_not_svelte            *bool    `json:",omitempty"`
+	Malloc_not_svelte_libc32     *bool    `json:",omitempty"`
 	Malloc_zero_contents         *bool    `json:",omitempty"`
 	Malloc_pattern_fill_contents *bool    `json:",omitempty"`
 	Safestack                    *bool    `json:",omitempty"`
@@ -330,6 +339,8 @@
 
 	DeviceKernelHeaders []string `json:",omitempty"`
 
+	TargetSpecificHeaderPath *string `json:",omitempty"`
+
 	ExtraVndkVersions []string `json:",omitempty"`
 
 	NamespacesToExport []string `json:",omitempty"`
@@ -489,6 +500,7 @@
 		AAPTPrebuiltDPI:     []string{"xhdpi", "xxhdpi"},
 
 		Malloc_not_svelte:            boolPtr(true),
+		Malloc_not_svelte_libc32:     boolPtr(true),
 		Malloc_zero_contents:         boolPtr(true),
 		Malloc_pattern_fill_contents: boolPtr(false),
 		Safestack:                    boolPtr(false),
diff --git a/androidmk/androidmk/android.go b/androidmk/androidmk/android.go
index 954f8d0..ef347d8 100644
--- a/androidmk/androidmk/android.go
+++ b/androidmk/androidmk/android.go
@@ -758,6 +758,13 @@
 	return includeVariableNow(bpVariable{"cflags", bpparser.ListType}, ctx)
 }
 
+func exportCflags(ctx variableAssignmentContext) error {
+	// The Soong replacement for EXPORT_CFLAGS doesn't need the same extra escaped quotes that were present in Make
+	ctx.mkvalue = ctx.mkvalue.Clone()
+	ctx.mkvalue.ReplaceLiteral(`\"`, `"`)
+	return includeVariableNow(bpVariable{"export_cflags", bpparser.ListType}, ctx)
+}
+
 func proguardEnabled(ctx variableAssignmentContext) error {
 	val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
 	if err != nil {
diff --git a/cc/cc.go b/cc/cc.go
index 456b736..d17369c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2223,6 +2223,22 @@
 	variantNdkLibs := []string{}
 	variantLateNdkLibs := []string{}
 	if ctx.Os() == android.Android {
+		rewriteHeaderLibs := func(list []string) (newHeaderLibs []string) {
+			newHeaderLibs = []string{}
+			for _, entry := range list {
+				// Replace device_kernel_headers with generated_kernel_headers
+				// for inline kernel building
+				if entry == "device_kernel_headers" || entry == "qti_kernel_headers" {
+					newHeaderLibs = append(newHeaderLibs, "generated_kernel_headers")
+					continue
+				}
+				newHeaderLibs = append(newHeaderLibs, entry)
+			}
+			return newHeaderLibs
+		}
+
+		deps.HeaderLibs = rewriteHeaderLibs(deps.HeaderLibs)
+
 		deps.SharedLibs, variantNdkLibs = RewriteLibs(c, &snapshotInfo, actx, ctx.Config(), deps.SharedLibs)
 		deps.LateSharedLibs, variantLateNdkLibs = RewriteLibs(c, &snapshotInfo, actx, ctx.Config(), deps.LateSharedLibs)
 		deps.ReexportSharedLibHeaders, _ = RewriteLibs(c, &snapshotInfo, actx, ctx.Config(), deps.ReexportSharedLibHeaders)
diff --git a/cc/compiler.go b/cc/compiler.go
index eb5458f..36e5094 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -333,6 +333,16 @@
 	tc := ctx.toolchain()
 	modulePath := android.PathForModuleSrc(ctx).String()
 
+	additionalIncludeDirs := ctx.DeviceConfig().TargetSpecificHeaderPath()
+	if len(additionalIncludeDirs) > 0 {
+		// devices can have multiple paths in TARGET_SPECIFIC_HEADER_PATH
+		// add -I in front of all of them
+		if (strings.Contains(additionalIncludeDirs, " ")) {
+			additionalIncludeDirs = strings.ReplaceAll(additionalIncludeDirs, " ", " -I")
+		}
+		flags.Local.CommonFlags = append(flags.Local.CommonFlags, "-I" + additionalIncludeDirs)
+	}
+
 	compiler.srcsBeforeGen = android.PathsForModuleSrcExcludes(ctx, compiler.Properties.Srcs, compiler.Properties.Exclude_srcs)
 	compiler.srcsBeforeGen = append(compiler.srcsBeforeGen, deps.GeneratedSources...)
 
diff --git a/cc/library.go b/cc/library.go
index f9bef6c..c689389 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -199,6 +199,9 @@
 	// using -isystem for this module and any module that links against this module.
 	Export_system_include_dirs []string `android:"arch_variant,variant_prepend"`
 
+	// list of plain cc flags to be used for any module that links against this module.
+	Export_cflags []string  `android:"arch_variant"`
+
 	Target struct {
 		Vendor, Product struct {
 			// list of exported include directories, like
@@ -519,6 +522,10 @@
 	f.systemDirs = append(f.systemDirs, android.PathsForModuleSrc(ctx, f.Properties.Export_system_include_dirs)...)
 }
 
+func (f *flagExporter) exportExtraFlags(ctx ModuleContext) {
+	f.flags = append(f.flags, f.Properties.Export_cflags...)
+}
+
 // exportIncludesAsSystem registers the include directories and system include directories to be
 // exported transitively both as system include directories to modules depending on this module.
 func (f *flagExporter) exportIncludesAsSystem(ctx ModuleContext) {
@@ -1729,6 +1736,7 @@
 
 	// Export include paths and flags to be propagated up the tree.
 	library.exportIncludes(ctx)
+	library.exportExtraFlags(ctx)
 	library.reexportDirs(deps.ReexportedDirs...)
 	library.reexportSystemDirs(deps.ReexportedSystemDirs...)
 	library.reexportFlags(deps.ReexportedFlags...)
diff --git a/java/aar.go b/java/aar.go
index 00ff7e7..4e31e68 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -233,7 +233,7 @@
 
 	if !hasVersionName {
 		var versionName string
-		if ctx.ModuleName() == "framework-res" {
+		if ctx.ModuleName() == "framework-res" || ctx.ModuleName() == "org.lineageos.platform-res" {
 			// Some builds set AppsDefaultVersionName() to include the build number ("O-123456").  aapt2 copies the
 			// version name of framework-res into app manifests as compileSdkVersionCodename, which confuses things
 			// if it contains the build number.  Use the PlatformVersionName instead.
@@ -258,6 +258,9 @@
 	if sdkDep.frameworkResModule != "" {
 		ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule)
 	}
+	if sdkDep.lineageResModule != "" {
+		ctx.AddVariationDependencies(nil, lineageResTag, sdkDep.lineageResModule)
+	}
 }
 
 var extractAssetsRule = pctx.AndroidStaticRule("extractAssets",
@@ -440,7 +443,7 @@
 			if exportPackage != nil {
 				sharedLibs = append(sharedLibs, exportPackage)
 			}
-		case frameworkResTag:
+		case frameworkResTag, lineageResTag:
 			if exportPackage != nil {
 				sharedLibs = append(sharedLibs, exportPackage)
 			}
@@ -741,6 +744,9 @@
 		if sdkDep.useModule && sdkDep.frameworkResModule != "" {
 			ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule)
 		}
+		if sdkDep.useModule && sdkDep.lineageResModule != "" {
+			ctx.AddVariationDependencies(nil, lineageResTag, sdkDep.lineageResModule)
+		}
 	}
 
 	ctx.AddVariationDependencies(nil, libTag, a.properties.Libs...)
diff --git a/java/android_manifest.go b/java/android_manifest.go
index 7772b70..fb6e984 100644
--- a/java/android_manifest.go
+++ b/java/android_manifest.go
@@ -126,7 +126,7 @@
 		targetSdkVersion := targetSdkVersionForManifestFixer(ctx, params.SdkContext)
 		args = append(args, "--targetSdkVersion ", targetSdkVersion)
 
-		if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" {
+		if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "org.lineageos.platform-res" {
 			targetSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
 			deps = append(deps, ApiFingerprintPath(ctx))
 		}
@@ -136,7 +136,7 @@
 			ctx.ModuleErrorf("invalid minSdkVersion: %s", err)
 		}
 
-		if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" {
+		if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "org.lineageos.platform-res" {
 			minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
 			deps = append(deps, ApiFingerprintPath(ctx))
 		}
diff --git a/java/androidmk.go b/java/androidmk.go
index 7322637..49ca176 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -347,7 +347,7 @@
 				entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_DICT", app.dexer.proguardDictionary)
 				entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", app.dexer.proguardUsageZip)
 
-				if app.Name() == "framework-res" {
+				if app.Name() == "framework-res" || app.Name() == "org.lineageos.platform-res" {
 					entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
 					// Make base_rules.mk not put framework-res in a subdirectory called
 					// framework_res.
@@ -475,7 +475,7 @@
 			entries.SetPath("LOCAL_SOONG_AAR", a.aarFile)
 		}
 
-		if a.Name() == "framework-res" {
+		if a.Name() == "framework-res" || a.Name() == "org.lineageos.platform-res" {
 			entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
 			// Make base_rules.mk not put framework-res in a subdirectory called
 			// framework_res.
diff --git a/java/app.go b/java/app.go
index 41419ba..b46f2b1 100755
--- a/java/app.go
+++ b/java/app.go
@@ -449,6 +449,9 @@
 	if ctx.ModuleName() == "framework-res" {
 		// framework-res.apk is installed as system/framework/framework-res.apk
 		installDir = "framework"
+	} else if ctx.ModuleName() == "org.lineageos.platform-res" {
+		// org.lineageos.platform-res.apk is installed as system/framework/org.lineageos.platform-res.apk
+		installDir = "framework"
 	} else if a.Privileged() {
 		installDir = filepath.Join("priv-app", a.installApkName)
 	} else {
@@ -471,7 +474,7 @@
 	a.dexpreopter.manifestFile = a.mergedManifestFile
 	a.dexpreopter.preventInstall = a.appProperties.PreventInstall
 
-	if ctx.ModuleName() != "framework-res" {
+	if ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "org.lineageos.platform-res" {
 		a.Module.compile(ctx, a.aaptSrcJar)
 	}
 
@@ -578,6 +581,9 @@
 	if ctx.ModuleName() == "framework-res" {
 		// framework-res.apk is installed as system/framework/framework-res.apk
 		a.installDir = android.PathForModuleInstall(ctx, "framework")
+	} else if ctx.ModuleName() == "org.lineageos.platform-res" {
+		// org.lineageos.platform-res.apk is installed as system/framework/org.lineageos.platform-res.apk
+		a.installDir = android.PathForModuleInstall(ctx, "framework")
 	} else if a.Privileged() {
 		a.installDir = android.PathForModuleInstall(ctx, "priv-app", a.installApkName)
 	} else if ctx.InstallInTestcases() {
diff --git a/java/app_test.go b/java/app_test.go
index 8e331d4..239bd52 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -77,8 +77,11 @@
 			expectedLinkImplicits = append(expectedLinkImplicits, manifestFixer.Output.String())
 
 			frameworkRes := result.ModuleForTests("framework-res", "android_common")
+			lineageRes := result.ModuleForTests("org.lineageos.platform-res", "android_common")
 			expectedLinkImplicits = append(expectedLinkImplicits,
 				frameworkRes.Output("package-res.apk").Output.String())
+			expectedLinkImplicits = append(expectedLinkImplicits,
+				lineageRes.Output("package-res.apk").Output.String())
 
 			// Test the mapping from input files to compiled output file names
 			compile := foo.Output(compiledResourceFiles[0])
diff --git a/java/java.go b/java/java.go
index 1e99aa3..7eeead6 100644
--- a/java/java.go
+++ b/java/java.go
@@ -361,6 +361,7 @@
 	bootClasspathTag        = dependencyTag{name: "bootclasspath", runtimeLinked: true}
 	systemModulesTag        = dependencyTag{name: "system modules", runtimeLinked: true}
 	frameworkResTag         = dependencyTag{name: "framework-res"}
+	lineageResTag           = dependencyTag{name: "org.lineageos.platform-res"}
 	kotlinStdlibTag         = dependencyTag{name: "kotlin-stdlib", runtimeLinked: true}
 	kotlinAnnotationsTag    = dependencyTag{name: "kotlin-annotations", runtimeLinked: true}
 	kotlinPluginTag         = dependencyTag{name: "kotlin-plugin", toolchain: true}
@@ -400,6 +401,7 @@
 	java9Classpath []string
 
 	frameworkResModule string
+	lineageResModule   string
 
 	jars android.Paths
 	aidl android.OptionalPath
@@ -439,6 +441,10 @@
 	if sdkDep.systemModules != "" {
 		ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules)
 	}
+
+	if ctx.ModuleName() == "org.lineageos.platform-res" {
+		ctx.AddVariationDependencies(nil, frameworkResTag, "framework-res")
+	}
 }
 
 type deps struct {
diff --git a/java/sdk.go b/java/sdk.go
index 0dddd40..d0664ec 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -152,6 +152,7 @@
 			systemModules:      fmt.Sprintf("core-%s-stubs-system-modules", systemModulesKind),
 			java9Classpath:     []string{module},
 			frameworkResModule: "framework-res",
+			lineageResModule:   "org.lineageos.platform-res",
 			aidl:               android.OptionalPathForPath(aidl),
 		}
 	}
@@ -164,6 +165,7 @@
 			bootclasspath:      corePlatformBootclasspathLibraries(ctx),
 			classpath:          config.FrameworkLibraries,
 			frameworkResModule: "framework-res",
+			lineageResModule:   "org.lineageos.platform-res",
 		}
 	case android.SdkNone:
 		systemModules := sdkContext.SystemModules()
diff --git a/java/testing.go b/java/testing.go
index 511cc5d..cfe1455 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -370,6 +370,11 @@
 		android_app {
 			name: "framework-res",
 			sdk_version: "core_platform",
+		}
+
+		android_app {
+			name: "org.lineageos.platform-res",
+			sdk_version: "core_platform",
 		}`
 
 	systemModules := []string{
diff --git a/scripts/check_boot_jars/package_allowed_list.txt b/scripts/check_boot_jars/package_allowed_list.txt
index a02c195..1b9b8ac 100644
--- a/scripts/check_boot_jars/package_allowed_list.txt
+++ b/scripts/check_boot_jars/package_allowed_list.txt
@@ -251,3 +251,20 @@
 # Packages used for Android in Chrome OS
 org\.chromium\.arc
 org\.chromium\.arc\..*
+
+# NV adds
+com\.nvidia
+com\.nvidia\..*
+
+# QC adds
+com.qualcomm.qti
+com.quicinc.tcmiface
+com.qualcomm.wfd
+com.qualcomm.wfd.service
+org.codeaurora.ims
+org.codeaurora.internal
+qcom.fmradio
+
+###################################################
+# IFAA Manager used for Alipay and/or WeChat payment
+org\.ifaa\.android\.manager.*
diff --git a/ui/build/cleanbuild.go b/ui/build/cleanbuild.go
index 1c80cff..df1470a 100644
--- a/ui/build/cleanbuild.go
+++ b/ui/build/cleanbuild.go
@@ -154,11 +154,13 @@
 		hostCommonOut("obj/PACKAGING"),
 		productOut("*.img"),
 		productOut("*.zip"),
+		productOut("*.zip.sha256sum"),
 		productOut("android-info.txt"),
 		productOut("misc_info.txt"),
 		productOut("apex"),
 		productOut("kernel"),
 		productOut("kernel-*"),
+		productOut("recovery_kernel"),
 		productOut("data"),
 		productOut("skin"),
 		productOut("obj/NOTICE_FILES"),
@@ -187,7 +189,8 @@
 		productOut("odm_dlkm"),
 		productOut("sysloader"),
 		productOut("testcases"),
-		productOut("symbols"))
+		productOut("symbols"),
+		productOut("install"))
 }
 
 // Since products and build variants (unfortunately) shared the same
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index 285f156..359e354 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -139,6 +139,7 @@
 var BannerVars = []string{
 	"PLATFORM_VERSION_CODENAME",
 	"PLATFORM_VERSION",
+	"LINEAGE_VERSION",
 	"TARGET_PRODUCT",
 	"TARGET_BUILD_VARIANT",
 	"TARGET_BUILD_TYPE",
@@ -166,6 +167,12 @@
 	"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE",
 	"SOONG_SDK_SNAPSHOT_USE_SOURCE_CONFIG_VAR",
 	"SOONG_SDK_SNAPSHOT_VERSION",
+	"WITH_SU",
+	"WITH_GMS",
+	"PRODUCT_IS_ATV",
+	"PRODUCT_IS_AUTO",
+	"GMS_MAKEFILE",
+	"MAINLINE_MODULES_MAKEFILE",
 }
 
 func Banner(make_vars map[string]string) string {
diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go
index 5b2046e..6b18079 100644
--- a/ui/build/sandbox_linux.go
+++ b/ui/build/sandbox_linux.go
@@ -235,6 +235,13 @@
 		sandboxArgs = append(sandboxArgs, "-N")
 	}
 
+	if ccacheExec := os.Getenv("CCACHE_EXEC"); ccacheExec != "" {
+		bytes, err := exec.Command(ccacheExec, "-k", "cache_dir").Output()
+		if err == nil {
+			sandboxArgs = append(sandboxArgs, "-B", strings.TrimSpace(string(bytes)))
+		}
+	}
+
 	// Stop nsjail from parsing arguments
 	sandboxArgs = append(sandboxArgs, "--")