Run jetifier against prebuilts directly rather than classes.jar

It turns out that the resource files inside the .aar files may
need rewriting too

Bug: 72552006
Test: Set LOCAL_JETIFIED_ENABLED for a prebuilt and built it
      See also one of the patches after this one and its topic
      which contains a sample for testing
Change-Id: I89d0b4aa8d5c6ae3abc2344dd05222cf9672d5c0
(cherry picked from commit ed170e72961dab855848bc58527923cbeba551b5)
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 96e2613..0efda57 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -571,6 +571,12 @@
 my_src_aar := $(filter %.aar, $(my_prebuilt_src_file))
 ifneq ($(my_src_aar),)
 # This is .aar file, archive of classes.jar and Android resources.
+
+# run Jetifier if needed
+LOCAL_JETIFIER_INPUT_FILE := $(my_src_aar)
+include $(BUILD_SYSTEM)/jetifier.mk
+my_src_aar := $(LOCAL_JETIFIER_OUTPUT_FILE)
+
 my_src_jar := $(intermediates.COMMON)/aar/classes.jar
 my_src_proguard_options := $(intermediates.COMMON)/aar/proguard.txt
 
@@ -582,6 +588,12 @@
 	$(hide) touch $@
 	# Make sure the proguard file exists and has a new timestamp.
 	$(hide) touch $(dir $@)/proguard.txt
+else
+
+# run Jetifier if needed
+LOCAL_JETIFIER_INPUT_FILE := $(my_src_jar)
+include $(BUILD_SYSTEM)/jetifier.mk
+my_src_jar := $(LOCAL_JETIFIER_OUTPUT_FILE)
 
 endif