Merge "Check if vintf aidl interface has been frozen on a release platform" into rvc-dev
diff --git a/build/aidl_interface.go b/build/aidl_interface.go
index c71ca40..cca736e 100644
--- a/build/aidl_interface.go
+++ b/build/aidl_interface.go
@@ -879,9 +879,16 @@
 
 	// TODO(b/136027762): should we allow more types of stability (e.g. for APEX) or
 	// should we switch this flag to be something like "vintf { enabled: true }"
-	if *i.properties.Stability != "vintf" {
+	isVintf := "vintf" == proptools.String(i.properties.Stability)
+	if !isVintf {
 		mctx.PropertyErrorf("stability", "must be empty or \"vintf\"")
 	}
+
+	// TODO(b/152655544): might need to change the condition
+	sdkIsFinal := mctx.Config().DefaultAppTargetSdkInt() != android.FutureApiLevel
+	if sdkIsFinal && !i.hasVersion() && isVintf && i.Owner() == "" {
+		mctx.PropertyErrorf("versions", "must be set(need to be frozen) when stability is \"vintf\" and PLATFORM_VERSION_CODENAME is REL.")
+	}
 }
 
 func (i *aidlInterface) currentVersion(ctx android.LoadHookContext) string {