Merge changes from topic "soong_ui_java"

* changes:
  Remove Java PATH check, deprecate using PATH in Kati
  Remove JAVA_NOT_REQUIRED
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index 122d8bc..dac2628 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -1,10 +1,6 @@
 # Selects a Java compiler.
 #
-# Inputs:
-#   OVERRIDE_ANDROID_JAVA_HOME -- alternate location to use for jdk
-#
 # Outputs:
-#   ANDROID_JAVA_HOME -- Directory that contains JDK
 #   ANDROID_JAVA_TOOLCHAIN -- Directory that contains javac and other java tools
 #
 
@@ -16,19 +12,7 @@
   endif
 endif
 
-ifneq ($(OVERRIDE_ANDROID_JAVA_HOME),)
-  # Use this build toolchain instead of the bundled one.
-  ANDROID_JAVA_HOME := $(OVERRIDE_ANDROID_JAVA_HOME)
-else # !OVERRIDE_ANDROID_JAVA_HOME
-  ifneq ($(EXPERIMENTAL_USE_OPENJDK9),)
-    ANDROID_JAVA_HOME := prebuilts/jdk/jdk9/$(HOST_PREBUILT_TAG)
-  else
-    ANDROID_JAVA_HOME := prebuilts/jdk/jdk8/$(HOST_PREBUILT_TAG)
-  endif
-endif
-
 ANDROID_JAVA_TOOLCHAIN := $(ANDROID_JAVA_HOME)/bin
-export JAVA_HOME := $(abspath $(ANDROID_JAVA_HOME))
 
 # TODO(ccross): remove this, it is needed for now because it is used by
 # config.mk before makevars from soong are loaded
diff --git a/core/config.mk b/core/config.mk
index cc3a2f0..86fc399 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -58,6 +58,9 @@
 # If a rule fails, delete $@.
 .DELETE_ON_ERROR:
 
+# Mark variables deprecated/obsolete
+$(KATI_deprecated_var PATH,Do not use PATH directly)
+
 # Used to force goals to build.  Only use for conditionally defined goals.
 .PHONY: FORCE
 FORCE:
@@ -860,25 +863,6 @@
 APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)
 endif
 
-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)
-else
-  # Put java first on the path
-  # TODO(ccross): remove this once tools run during the build no longer depend on
-  # finding java in the path
-  ifeq (,$(strip $(CALLED_FROM_SETUP)))
-    ifneq ($(shell which java),$(abspath $(ANDROID_JAVA_TOOLCHAIN)/java))
-      $(warning Found incorrect java $(shell which java) in $$PATH)
-      $(warning Adding $(abspath $(ANDROID_JAVA_TOOLCHAIN)) to $$PATH)
-      export PATH:=$(abspath $(ANDROID_JAVA_TOOLCHAIN)):$(PATH)
-    endif
-  endif
-endif
-
 # Projects clean of compiler warnings should be compiled with -Werror.
 # If most modules in a directory such as external/ have warnings,
 # the directory should be in ANDROID_WARNING_ALLOWED_PROJECTS list.
diff --git a/core/no_java_path/jar b/core/no_java_path/jar
deleted file mode 120000
index 8586397..0000000
--- a/core/no_java_path/jar
+++ /dev/null
@@ -1 +0,0 @@
-java
\ No newline at end of file
diff --git a/core/no_java_path/jarsigner b/core/no_java_path/jarsigner
deleted file mode 120000
index 8586397..0000000
--- a/core/no_java_path/jarsigner
+++ /dev/null
@@ -1 +0,0 @@
-java
\ No newline at end of file
diff --git a/core/no_java_path/java b/core/no_java_path/java
deleted file mode 100755
index f3422f3..0000000
--- a/core/no_java_path/java
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-echo "Error: JAVA_NOT_REQUIRED=true, $(basename $0) is unavailable." 1>&2
-exit 1
diff --git a/core/no_java_path/javac b/core/no_java_path/javac
deleted file mode 120000
index 8586397..0000000
--- a/core/no_java_path/javac
+++ /dev/null
@@ -1 +0,0 @@
-java
\ No newline at end of file
diff --git a/core/no_java_path/keytool b/core/no_java_path/keytool
deleted file mode 120000
index 8586397..0000000
--- a/core/no_java_path/keytool
+++ /dev/null
@@ -1 +0,0 @@
-java
\ No newline at end of file