|
@@ -52,7 +52,7 @@ var combineApk = pctx.AndroidStaticRule("combineApk",
|
|
})
|
|
})
|
|
|
|
|
|
func CreateAndSignAppPackage(ctx android.ModuleContext, outputFile android.WritablePath,
|
|
func CreateAndSignAppPackage(ctx android.ModuleContext, outputFile android.WritablePath,
|
|
- packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths, v4SignatureFile android.WritablePath, lineageFile android.Path, rotationMinSdkVersion string) {
|
|
|
|
|
|
+ packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths, v4SignatureFile android.WritablePath, lineageFile android.Path, rotationMinSdkVersion string, shrinkResources bool) {
|
|
|
|
|
|
unsignedApkName := strings.TrimSuffix(outputFile.Base(), ".apk") + "-unsigned.apk"
|
|
unsignedApkName := strings.TrimSuffix(outputFile.Base(), ".apk") + "-unsigned.apk"
|
|
unsignedApk := android.PathForModuleOut(ctx, unsignedApkName)
|
|
unsignedApk := android.PathForModuleOut(ctx, unsignedApkName)
|
|
@@ -65,7 +65,6 @@ func CreateAndSignAppPackage(ctx android.ModuleContext, outputFile android.Writa
|
|
if jniJarFile != nil {
|
|
if jniJarFile != nil {
|
|
inputs = append(inputs, jniJarFile)
|
|
inputs = append(inputs, jniJarFile)
|
|
}
|
|
}
|
|
-
|
|
|
|
ctx.Build(pctx, android.BuildParams{
|
|
ctx.Build(pctx, android.BuildParams{
|
|
Rule: combineApk,
|
|
Rule: combineApk,
|
|
Inputs: inputs,
|
|
Inputs: inputs,
|
|
@@ -73,6 +72,11 @@ func CreateAndSignAppPackage(ctx android.ModuleContext, outputFile android.Writa
|
|
Implicits: deps,
|
|
Implicits: deps,
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+ if shrinkResources {
|
|
|
|
+ shrunkenApk := android.PathForModuleOut(ctx, "resource-shrunken", unsignedApk.Base())
|
|
|
|
+ ShrinkResources(ctx, unsignedApk, shrunkenApk)
|
|
|
|
+ unsignedApk = shrunkenApk
|
|
|
|
+ }
|
|
SignAppPackage(ctx, outputFile, unsignedApk, certificates, v4SignatureFile, lineageFile, rotationMinSdkVersion)
|
|
SignAppPackage(ctx, outputFile, unsignedApk, certificates, v4SignatureFile, lineageFile, rotationMinSdkVersion)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -84,7 +88,6 @@ func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, u
|
|
certificateArgs = append(certificateArgs, c.Pem.String(), c.Key.String())
|
|
certificateArgs = append(certificateArgs, c.Pem.String(), c.Key.String())
|
|
deps = append(deps, c.Pem, c.Key)
|
|
deps = append(deps, c.Pem, c.Key)
|
|
}
|
|
}
|
|
-
|
|
|
|
outputFiles := android.WritablePaths{signedApk}
|
|
outputFiles := android.WritablePaths{signedApk}
|
|
var flags []string
|
|
var flags []string
|
|
if v4SignatureFile != nil {
|
|
if v4SignatureFile != nil {
|
|
@@ -182,7 +185,7 @@ func BuildBundleModule(ctx android.ModuleContext, outputFile android.WritablePat
|
|
packageFile, jniJarFile, dexJarFile android.Path) {
|
|
packageFile, jniJarFile, dexJarFile android.Path) {
|
|
|
|
|
|
protoResJarFile := android.PathForModuleOut(ctx, "package-res.pb.apk")
|
|
protoResJarFile := android.PathForModuleOut(ctx, "package-res.pb.apk")
|
|
- aapt2Convert(ctx, protoResJarFile, packageFile)
|
|
|
|
|
|
+ aapt2Convert(ctx, protoResJarFile, packageFile, "proto")
|
|
|
|
|
|
var zips android.Paths
|
|
var zips android.Paths
|
|
|
|
|