Merge "Install .idsig files to test suite dirs." into rvc-dev
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 1db73ae..15d7a0e 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -811,6 +811,16 @@
 ALL_MODULES.$(my_register_name).PICKUP_FILES := \
     $(ALL_MODULES.$(my_register_name).PICKUP_FILES) $(LOCAL_PICKUP_FILES)
 endif
+# Record the platform availability of this module. Note that the availability is not
+# meaningful for non-installable modules (e.g., static libs) or host modules.
+# We only care about modules that are installable to the device.
+ifeq (true,$(LOCAL_NOT_AVAILABLE_FOR_PLATFORM))
+  ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
+    ifndef LOCAL_IS_HOST_MODULE
+      ALL_MODULES.$(my_register_name).NOT_AVAILABLE_FOR_PLATFORM := true
+    endif
+  endif
+endif
 
 my_required_modules := $(LOCAL_REQUIRED_MODULES) \
     $(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 3d481df..0c613fa 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -192,6 +192,7 @@
 LOCAL_NOSANITIZE:=
 LOCAL_NO_STANDARD_LIBRARIES:=
 LOCAL_NO_STATIC_ANALYZER:=
+LOCAL_NOT_AVAILABLE_FOR_PLATFORM:=
 LOCAL_NOTICE_FILE:=
 LOCAL_ODM_MODULE:=
 LOCAL_OEM_MODULE:=
diff --git a/core/line_coverage.mk b/core/line_coverage.mk
index a32eea6..9b0b528 100644
--- a/core/line_coverage.mk
+++ b/core/line_coverage.mk
@@ -35,6 +35,7 @@
 	libvold \
 	libyuv
 
+# Format is <module_name> or <module_name>:<apex_name>
 critical_components_shared := \
 	libaudioprocessing \
 	libbinder \
@@ -47,7 +48,7 @@
 	libopus \
 	libstagefright \
 	libunwind \
-	libvixl
+	libvixl:com.android.art.debug
 
 # Use the intermediates directory to avoid installing libraries to the device.
 intermediates := $(call intermediates-dir-for,PACKAGING,haiku-line-coverage)
@@ -60,7 +61,9 @@
 	$(call intermediates-dir-for,STATIC_LIBRARIES,$(lib))/$(lib).a)
 
 critical_components_shared_inputs := $(foreach lib,$(critical_components_shared), \
-	$(call intermediates-dir-for,SHARED_LIBRARIES,$(lib))/$(lib).so)
+	$(eval filename := $(call word-colon,1,$(lib))) \
+	$(eval modulename := $(subst :,.,$(lib))) \
+	$(call intermediates-dir-for,SHARED_LIBRARIES,$(modulename))/$(filename).so)
 
 fuzz_target_inputs := $(foreach fuzz,$(fuzz_targets), \
 	$(call intermediates-dir-for,EXECUTABLES,$(fuzz))/$(fuzz))
diff --git a/core/tasks/platform_availability_check.mk b/core/tasks/platform_availability_check.mk
new file mode 100644
index 0000000..043d130
--- /dev/null
+++ b/core/tasks/platform_availability_check.mk
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2020 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.
+#
+
+# Check whether there is any module that isn't available for platform
+# is installed to the platform.
+
+# Filter FAKE and NON_INSTALLABLE modules out and then collect those are not
+# available for platform
+_modules_not_available_for_platform := \
+$(strip $(foreach m,$(product_MODULES),\
+  $(if $(filter-out FAKE,$(ALL_MODULES.$(m).CLASS)),\
+    $(if $(ALL_MODULES.$(m).INSTALLED),\
+      $(if $(filter true,$(ALL_MODULES.$(m).NOT_AVAILABLE_FOR_PLATFORM)),\
+        $(m))))))
+
+_violators_with_path := $(foreach m,$(sort $(_modules_not_available_for_platform)),\
+    $(m):$(word 1,$(ALL_MODULES.$(m).PATH))\
+)
+
+$(call maybe-print-list-and-error,$(_violators_with_path),\
+Following modules are requested to be installed. But are not available \
+for platform because they do not have "//apex_available:platform" or \
+they depend on other modules that are not available for platform)
diff --git a/target/product/go_defaults_common.mk b/target/product/go_defaults_common.mk
index 64728f0..ca171df 100644
--- a/target/product/go_defaults_common.mk
+++ b/target/product/go_defaults_common.mk
@@ -40,7 +40,7 @@
 PRODUCT_PACKAGES += InProcessNetworkStack
 PRODUCT_PACKAGES += CellBroadcastAppPlatform
 PRODUCT_PACKAGES += CellBroadcastServiceModulePlatform
-PRODUCT_PACKAGES += InProcessTethering
+PRODUCT_PACKAGES += com.android.tethering.inprocess
 
 # Strip the local variable table and the local variable type table to reduce
 # the size of the system image. This has no bearing on stack traces, but will
diff --git a/target/product/media_system.mk b/target/product/media_system.mk
index 5ff747f..26fb7f3 100644
--- a/target/product/media_system.mk
+++ b/target/product/media_system.mk
@@ -52,9 +52,7 @@
 PRODUCT_SYSTEM_SERVER_JARS := \
     com.android.location.provider \
     services \
-    ethernet-service \
-    service-jobscheduler \
-    service-blobstore
+    ethernet-service
 
 # system server jars which are updated via apex modules.
 # The values should be of the format <apex name>:<jar name>
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index df57e37..d4c73a4 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -360,10 +360,13 @@
     self.oem_dicts = oem_dicts
 
     self._is_ab = info_dict.get("ab_update") == "true"
-    self._oem_props = info_dict.get("oem_fingerprint_properties")
 
-    if self._oem_props:
-      assert oem_dicts, "OEM source required for this build"
+    # Skip _oem_props if oem_dicts is None to use BuildInfo in
+    # sign_target_files_apks
+    if self.oem_dicts:
+      self._oem_props = info_dict.get("oem_fingerprint_properties")
+    else:
+      self._oem_props = None
 
     def check_fingerprint(fingerprint):
       if (" " in fingerprint or any(ord(ch) > 127 for ch in fingerprint)):
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 029d46f..173ef53 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -175,10 +175,6 @@
     self.assertEqual('brand3/product-name/device3:build-thumbprint',
                      target_info.fingerprint)
 
-    # Missing oem_dict should be rejected.
-    self.assertRaises(AssertionError, common.BuildInfo,
-                      self.TEST_INFO_DICT_USES_OEM_PROPS, None)
-
   def test_init_badFingerprint(self):
     info_dict = copy.deepcopy(self.TEST_INFO_DICT)
     info_dict['build.prop']['ro.build.fingerprint'] = 'bad fingerprint'
diff --git a/tools/warn/android_project_list.py b/tools/warn/android_project_list.py
index 4726fa2..1010b24 100644
--- a/tools/warn/android_project_list.py
+++ b/tools/warn/android_project_list.py
@@ -102,6 +102,7 @@
     create_pattern('ndk'),
     # match vendor/unbungled_google/packages before other packages
     create_pattern('unbundled_google'),
+    create_pattern('packages/providers/MediaProvider'),
     create_pattern('packages'),
     create_pattern('pdk'),
     create_pattern('prebuilts'),