AAPT2: library resource compilation

- Switch to static library's package-res.apk as the link artifact.
- For prebuilt AAR file, build package-res.apk using aapt2's "--dir"
  option.
- New LOCAL variables:
  LOCAL_USE_AAPT2: a module can opt-in with "LOCAL_USE_AAPT2 := true".
  LOCAL_STATIC_ANDROID_LIBRARIES: static Java libraries with compiled
                   resources.
  LOCAL_SHARED_ANDROID_LIBRARIES: shared Java libraries with compiled
                   resources.

Bug: 25958912
Change-Id: I4be2d1e8137555986338c2583cb39b0c97391751
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 069fbf9..bb6ce93 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -193,6 +193,9 @@
 LOCAL_MODULE_HOST_OS:=
 LOCAL_FINDBUGS_FLAGS:=
 LOCAL_NOTICE_FILE:=
+LOCAL_USE_AAPT2:=$(USE_AAPT2)
+LOCAL_STATIC_ANDROID_LIBRARIES:=
+LOCAL_SHARED_ANDROID_LIBRARIES:=
 
 # arch specific variables
 LOCAL_SRC_FILES_$(TARGET_ARCH):=