Merge "refactor kernel module build, add version support"
diff --git a/core/construct_context.sh b/core/construct_context.sh
index 794795a..d620d08 100755
--- a/core/construct_context.sh
+++ b/core/construct_context.sh
@@ -67,6 +67,10 @@
   add_to_contexts "${conditional_host_libs_29}" "${conditional_target_libs_29}"
 fi
 
+if [[ "${target_sdk_version}" -lt "30" ]]; then
+  add_to_contexts "${conditional_host_libs_30}" "${conditional_target_libs_30}"
+fi
+
 add_to_contexts "${dex_preopt_host_libraries}" "${dex_preopt_target_libraries}"
 
 # Generate the actual context string.
diff --git a/core/definitions.mk b/core/definitions.mk
index 1467e96..3672900 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2693,32 +2693,6 @@
 	$$(transform-prebuilt-to-target)
 endef
 
-
-###########################################################
-## API Check
-###########################################################
-
-# eval this to define a rule that runs apicheck.
-#
-# Args:
-#    $(1)  target
-#    $(2)  stable api file
-#    $(3)  api file to be tested
-#    $(4)  stable removed api file
-#    $(5)  removed api file to be tested
-#    $(6)  arguments for apicheck
-#    $(7)  command to run if apicheck failed
-#    $(8)  target dependent on this api check
-#    $(9)  additional dependencies
-define check-api
-$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp: $(2) $(3) $(4) $(APICHECK) $(9)
-	@echo "Checking API:" $(1)
-	$(hide) ( $(APICHECK_COMMAND) --check-api-files $(6) $(2) $(3) $(4) $(5) || ( $(7) ; exit 38 ) )
-	$(hide) mkdir -p $$(dir $$@)
-	$(hide) touch $$@
-$(8): $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/$(strip $(1))-timestamp
-endef
-
 ## Whether to build from source if prebuilt alternative exists
 ###########################################################
 # $(1): module name
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index a33b2b4..2a2427d 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -195,6 +195,7 @@
     org.apache.http.legacy \
     android.hidl.base-V1.0-java \
     android.hidl.manager-V1.0-java \
+    android.test.base \
 
   my_dexpreopt_libs := $(sort \
     $(LOCAL_USES_LIBRARIES) \
diff --git a/target/product/handheld_system.mk b/target/product/handheld_system.mk
index 6463a54..b540fdf 100644
--- a/target/product/handheld_system.mk
+++ b/target/product/handheld_system.mk
@@ -43,7 +43,6 @@
     CaptivePortalLogin \
     CertInstaller \
     clatd \
-    clatd.conf \
     DocumentsUI \
     DownloadProviderUi \
     EasterEgg \
diff --git a/target/product/mainline.mk b/target/product/mainline.mk
deleted file mode 100644
index 22436e6..0000000
--- a/target/product/mainline.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright (C) 2019 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# This makefile is intended to serve as a base for completely AOSP based
-# mainline devices, It contain the mainline system partition and sensible
-# defaults for the system_ext, product and vendor partitions.
-$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
-
-$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_system_ext.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_product.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_product.mk)
-
-$(call inherit-product, frameworks/base/data/sounds/AllAudio.mk)
-
-PRODUCT_PROPERTY_OVERRIDES += \
-    ro.config.ringtone=Ring_Synth_04.ogg \
-    ro.com.android.dataroaming=true \
-
-PRODUCT_PACKAGES += \
-    PhotoTable \
-    WallpaperPicker \
-
-PRODUCT_COPY_FILES += device/sample/etc/apns-full-conf.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/apns-conf.xml
diff --git a/tools/releasetools/Android.bp b/tools/releasetools/Android.bp
index d6f2116..b52da87 100644
--- a/tools/releasetools/Android.bp
+++ b/tools/releasetools/Android.bp
@@ -73,9 +73,6 @@
         "releasetools_build_super_image",
         "releasetools_common",
     ],
-    required: [
-        "zip2zip",
-    ],
 }
 
 python_defaults {
@@ -468,9 +465,6 @@
     data: [
         "testdata/**/*",
     ],
-    required: [
-        "otatools",
-    ],
 }
 
 python_test_host {