Disable java when JAVA_NOT_REQUIRED is set
Change-Id: Id3056cde93302be20000bf7af33aeed0fa8fdf52
diff --git a/core/config.mk b/core/config.mk
index 0034c43..5485fe2 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -844,4 +844,12 @@
RSCOMPAT_32BIT_ONLY_API_LEVELS := 8 9 10 11 12 13 14 15 16 17 18 19 20
RSCOMPAT_NO_USAGEIO_API_LEVELS := 8 9 10 11 12 13
+ifeq ($(JAVA_NOT_REQUIRED),true)
+# Remove java and tools from our path so that we make sure nobody uses them.
+unexport ANDROID_JAVA_HOME
+unexport JAVA_HOME
+export ANDROID_BUILD_PATHS:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(ANDROID_BUILD_PATHS)
+export PATH:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(PATH)
+endif
+
include $(BUILD_SYSTEM)/dumpvar.mk