Allow recording ALL_DEPS by setting RECORD_ALL_DEPS

This change enables recording ALL_DEPS information
without having to specify the deps-license goal, which
can be useful to populate the dependencies field of
module-info.json for various types of post-processing.

Usage: `RECORD_ALL_DEPS=true make droid` (preferred), or
`make RECORD_ALL_DEPS=true droid`.

Test: make, inspect module-info.json
Test: RECORD_ALL_DEPS=true make, inspect module-info.json
Bug: 151755703
Change-Id: Ib81a8dfb0ecbe0b63be320a9d33e558b419cb4b2
diff --git a/core/base_rules.mk b/core/base_rules.mk
index b161384..9576a80 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -895,7 +895,7 @@
 ##########################################################
 # Track module-level dependencies.
 # Use $(LOCAL_MODULE) instead of $(my_register_name) to ignore module's bitness.
-ifneq (,$(filter deps-license,$(MAKECMDGOALS)))
+ifdef RECORD_ALL_DEPS
 ALL_DEPS.MODULES := $(ALL_DEPS.MODULES) $(LOCAL_MODULE)
 ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
   $(ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS) \