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

Commit 50dbe0a0 authored by William Loh's avatar William Loh Committed by Gerrit Code Review
Browse files

Merge "Propagate max_sdk_version to manifest_fixer"

parents ca53ed39 5a082f9a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -28,6 +28,9 @@ type SdkContext interface {
	// MinSdkVersion returns SdkSpec that corresponds to the min_sdk_version property of the current module,
	// or from sdk_version if it is not set.
	MinSdkVersion(ctx EarlyModuleContext) SdkSpec
	// ReplaceMaxSdkVersionPlaceholder returns SdkSpec to replace the maxSdkVersion property of permission and
	// uses-permission tags if it is set.
	ReplaceMaxSdkVersionPlaceholder(ctx EarlyModuleContext) SdkSpec
	// TargetSdkVersion returns the SdkSpec that corresponds to the target_sdk_version property of the current module,
	// or from sdk_version if it is not set.
	TargetSdkVersion(ctx EarlyModuleContext) SdkSpec
+4 −0
Original line number Diff line number Diff line
@@ -678,6 +678,10 @@ func (a *AARImport) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpe
	return a.SdkVersion(ctx)
}

func (a *AARImport) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.SdkSpec {
	return android.SdkSpecFrom(ctx, "")
}

func (a *AARImport) TargetSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
	return a.SdkVersion(ctx)
}
+6 −0
Original line number Diff line number Diff line
@@ -136,6 +136,11 @@ func ManifestFixer(ctx android.ModuleContext, manifest android.Path,
			ctx.ModuleErrorf("invalid minSdkVersion: %s", err)
		}

		replaceMaxSdkVersionPlaceholder, err := params.SdkContext.ReplaceMaxSdkVersionPlaceholder(ctx).EffectiveVersion(ctx)
		if err != nil {
			ctx.ModuleErrorf("invalid ReplaceMaxSdkVersionPlaceholder: %s", err)
		}

		if UseApiFingerprint(ctx) && ctx.ModuleName() != "framework-res" {
			minSdkVersion = ctx.Config().PlatformSdkCodename() + fmt.Sprintf(".$$(cat %s)", ApiFingerprintPath(ctx).String())
			deps = append(deps, ApiFingerprintPath(ctx))
@@ -145,6 +150,7 @@ func ManifestFixer(ctx android.ModuleContext, manifest android.Path,
			ctx.ModuleErrorf("invalid minSdkVersion: %s", err)
		}
		args = append(args, "--minSdkVersion ", minSdkVersion)
		args = append(args, "--replaceMaxSdkVersionPlaceholder ", strconv.Itoa(replaceMaxSdkVersionPlaceholder.FinalOrFutureInt()))
		args = append(args, "--raise-min-sdk-version")
	}

+9 −0
Original line number Diff line number Diff line
@@ -204,6 +204,10 @@ type DeviceProperties struct {
	// Defaults to empty string "". See sdk_version for possible values.
	Max_sdk_version *string

	// if not blank, set the maxSdkVersion properties of permission and uses-permission tags.
	// Defaults to empty string "". See sdk_version for possible values.
	Replace_max_sdk_version_placeholder *string

	// if not blank, set the targetSdkVersion in the AndroidManifest.xml.
	// Defaults to sdk_version if not set. See sdk_version for possible values.
	Target_sdk_version *string
@@ -649,6 +653,11 @@ func (j *Module) MaxSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
	return android.SdkSpecFrom(ctx, maxSdkVersion)
}

func (j *Module) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.SdkSpec {
	replaceMaxSdkVersionPlaceholder := proptools.StringDefault(j.deviceProperties.Replace_max_sdk_version_placeholder, "")
	return android.SdkSpecFrom(ctx, replaceMaxSdkVersionPlaceholder)
}

func (j *Module) MinSdkVersionString() string {
	return j.minSdkVersion.Raw
}
+4 −0
Original line number Diff line number Diff line
@@ -256,6 +256,10 @@ func (j *Javadoc) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec
	return j.SdkVersion(ctx)
}

func (j *Javadoc) ReplaceMaxSdkVersionPlaceholder(ctx android.EarlyModuleContext) android.SdkSpec {
	return j.SdkVersion(ctx)
}

func (j *Javadoc) TargetSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
	return j.SdkVersion(ctx)
}
Loading