Restore kernel requirements for frozen matrices.

Requirements for legacy/1/2.xml has changed because
android-base.cfg files are changed. These files should
build from an older snapshot of the requirements.

Fixes: 78576469
Test: builds
Test: vts_treble_vintf_test

Change-Id: I908ebbe495ae06f983ef983a1be7937cf6be1c12
Merged-In: I908ebbe495ae06f983ef983a1be7937cf6be1c12
diff --git a/compatibility_matrices/compatibility_matrix.mk b/compatibility_matrices/compatibility_matrix.mk
index 6dc2b4f..1b6fd3b 100644
--- a/compatibility_matrices/compatibility_matrix.mk
+++ b/compatibility_matrices/compatibility_matrix.mk
@@ -14,17 +14,6 @@
 # limitations under the License.
 #
 
-###########################################################
-## Remove minor revision from a kernel version. For example,
-## 3.18.0 becomes 3.18.
-## $(1): kernel version
-###########################################################
-define remove-minor-revision
-$(strip $(subst $(space),.,$(wordlist 1,2,$(subst .,$(space),$(strip $(1))))))
-endef
-
-# $(warning $(call remove-minor-revision,3.18.0))
-
 ##### Input Variables:
 # LOCAL_MODULE: required. Module name for the build system.
 # LOCAL_MODULE_CLASS: optional. Default is ETC.
@@ -42,8 +31,8 @@
 # LOCAL_ASSEMBLE_VINTF_ENV_VARS_OVERRIDE: Add a list of environment variables that is local to
 #       assemble_vintf invocation. Format is "VINTF_ENFORCE_NO_UNUSED_HALS=true".
 # LOCAL_ASSEMBLE_VINTF_FLAGS: Add additional command line arguments to assemble_vintf invocation.
-# LOCAL_KERNEL_VERSIONS: Parse kernel configurations and add to the output matrix
-#       (corresponds to <kernel> tags.)
+# LOCAL_KERNEL_CONFIG_DATA_PATHS: Paths to search for kernel config requirements. Format for each is
+#       <kernel version x.y.z>:<path that contains android-base*.cfg>.
 # LOCAL_GEN_FILE_DEPENDENCIES: A list of additional dependencies for the generated file.
 
 ifndef LOCAL_MODULE
@@ -88,14 +77,13 @@
 $(GEN): PRIVATE_ENV_VARS += FRAMEWORK_VBMETA_VERSION
 endif # LOCAL_ADD_VBMETA_VERSION
 
-ifneq (,$(strip $(LOCAL_KERNEL_VERSIONS)))
-$(GEN): PRIVATE_KERNEL_CONFIG_DATA := kernel/configs
-$(GEN): PRIVATE_KERNEL_VERSIONS := $(LOCAL_KERNEL_VERSIONS)
-$(GEN): $(foreach version,$(PRIVATE_KERNEL_VERSIONS),\
-    $(wildcard $(PRIVATE_KERNEL_CONFIG_DATA)/android-$(call remove-minor-revision,$(version))/android-base*.cfg))
-$(GEN): PRIVATE_FLAGS += $(foreach version,$(PRIVATE_KERNEL_VERSIONS),\
-    --kernel=$(version):$(call normalize-path-list,\
-        $(wildcard $(PRIVATE_KERNEL_CONFIG_DATA)/android-$(call remove-minor-revision,$(version))/android-base*.cfg)))
+ifneq (,$(strip $(LOCAL_KERNEL_CONFIG_DATA_PATHS)))
+$(GEN): PRIVATE_KERNEL_CONFIG_DATA_PATHS := $(LOCAL_KERNEL_CONFIG_DATA_PATHS)
+$(GEN): $(foreach pair,$(PRIVATE_KERNEL_CONFIG_DATA_PATHS),\
+    $(wildcard $(call word-colon,2,$(pair))/android-base*.cfg))
+$(GEN): PRIVATE_FLAGS += $(foreach pair,$(PRIVATE_KERNEL_CONFIG_DATA_PATHS),\
+	--kernel=$(call word-colon,1,$(pair)):$(call normalize-path-list,\
+		$(wildcard $(call word-colon,2,$(pair))/android-base*.cfg)))
 endif
 
 my_matrix_src_files := \
@@ -124,15 +112,7 @@
 LOCAL_SRC_FILES :=
 LOCAL_GENERATED_SOURCES :=
 
-LOCAL_ADD_VBMETA_VERSION :=
-LOCAL_ASSEMBLE_VINTF_ENV_VARS :=
-LOCAL_ASSEMBLE_VINTF_ENV_VARS_OVERRIDE :=
-LOCAL_ASSEMBLE_VINTF_ERROR_MESSAGE :=
-LOCAL_ASSEMBLE_VINTF_FLAGS :=
-LOCAL_KERNEL_VERSIONS :=
-LOCAL_GEN_FILE_DEPENDENCIES :=
+include $(LOCAL_PATH)/clear_vars.mk
 my_matrix_src_files :=
 
 include $(BUILD_PREBUILT)
-
-remove-minor-revision :=