Harden dependency on generated sources.

Previously if a library has custom generated headers in
LOCAL_GENERATED_SOURCES and export its include path with
LOCAL_EXPORT_C_INCLUDE_DIRS, there is almost no way for the users of the
library to set up dependency of their object files on the generated
headers.
This change makes the generated sources dependency of the library's
export_includes, which is guaranteed generated before client code gets
compiled.

Also we added proto-generated cpp files to my_generated_sources so that
we can deal solely with $(my_generated_sources). Because many
Android.mks assume the generted .pb.hs are in $(generated_sources_dir)
instead of $(intermediates), we have to generate the source files in
$(generated_sources_dir) and make a copy in $(intermediates).

Bug: 28622149
Change-Id: I73b21443fa706f3735faf16356ed8c08fbfecca6
(Cherry-pick from commit 05f9f358363da66a51ebcba57409116dfa9e3a53)
2 files changed