Add license modules to the sdk

Adds initial support for adding license modules to the sdk, along with
any referenced license text files. There is a number of minor
improvements to be made but the core of the support is there and it
works for ART sdks.

Basically, this change will automatically add license modules
referenced from any sdk member module as an internal sdk member. An
internal module has an sdk snapshot specific name that will not
conflict with the source module and which cannot be referenced from
outside the sdk snapshot.

Bug: 181569894
Test: m art-module-sdk art-module-host-exports art-module-test-exports
      - diff output before and after this change
        made sure that every prebuilt had a licenses field
        and that the license modules were added
Change-Id: I0c5ccabf58f4ef487e42ef8e61a5b2a74c0e81af
diff --git a/sdk/update.go b/sdk/update.go
index a265676..deac0ec 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -893,6 +893,13 @@
 		m.AddProperty("apex_available", apexAvailable)
 	}
 
+	// The licenses are the same for all variants.
+	mctx := s.ctx
+	licenseInfo := mctx.OtherModuleProvider(variant, android.LicenseInfoProvider).(android.LicenseInfo)
+	if len(licenseInfo.Licenses) > 0 {
+		m.AddPropertyWithTag("licenses", licenseInfo.Licenses, s.OptionalSdkMemberReferencePropertyTag())
+	}
+
 	deviceSupported := false
 	hostSupported := false
 
@@ -920,6 +927,12 @@
 }
 
 func addHostDeviceSupportedProperties(deviceSupported bool, hostSupported bool, bpModule *bpModule) {
+	// If neither device or host is supported then this module does not support either so will not
+	// recognize the properties.
+	if !deviceSupported && !hostSupported {
+		return
+	}
+
 	if !deviceSupported {
 		bpModule.AddProperty("device_supported", false)
 	}