Remove Java PATH check, deprecate using PATH in Kati

The Java PATH fixup is now handled within soong_ui, along with the
values of ANDROID_JAVA_HOME based on OVERRIDE_ANDROID_JAVA_HOME /
EXPERIMENTAL_USE_OPENJDK9.

Mark PATH as deprecated, so that any reads/writes will cause warnings.
This will be switched to obsolete once it's verified that there are no
more users.

Using PATH within Kati means that we've got to rebuild the ninja files
whenever your PATH changes, which is not ideal, especially since some of
the envsetup functions can change your PATH. In most cases you only need
to use PATH within the bash portions of the build rules ($${PATH}), which
isn't treated as a make variable, so won't produce an error.

I'm also planning on replacing PATH in a future change with our own
directory that has placeholders for everything in your PATH. This will
let us remove tools that shouldn't be used from the build.

Test: m nothing
Test: build/soong/build_test.bash on AOSP and internal master
Change-Id: I18d8d19cfba313ff9176345bf73ac34e8dbebfbb
diff --git a/core/config.mk b/core/config.mk
index bf567d0..f557698 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,17 +863,6 @@
 APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)
 endif
 
-# 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
-
 # 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.