Sandbox inputs to aidl rule in cc

Bug: 279960133
Test: go test
Test: Remove hdrs prop from IDropBoxManagerService_aidl && run  BUILD_BROKEN_DISABLE_BAZEL=true m libservices && Expect an error from aidl
Change-Id: Ifdb260d8e2da9a5767f1e212393de4134b210616
diff --git a/cc/library.go b/cc/library.go
index 09a7253..98096a8 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -2118,8 +2118,14 @@
 	// Optionally export aidl headers.
 	if Bool(library.Properties.Aidl.Export_aidl_headers) {
 		if library.baseCompiler.hasAidl(deps) {
-			dir := android.PathForModuleGen(ctx, "aidl")
-			library.reexportDirs(dir)
+			if library.baseCompiler.hasSrcExt(".aidl") {
+				dir := android.PathForModuleGen(ctx, "aidl")
+				library.reexportDirs(dir)
+			}
+			if len(deps.AidlLibraryInfos) > 0 {
+				dir := android.PathForModuleGen(ctx, "aidl_library")
+				library.reexportDirs(dir)
+			}
 
 			library.reexportDeps(library.baseCompiler.aidlOrderOnlyDeps...)
 			library.addExportedGeneratedHeaders(library.baseCompiler.aidlHeaders...)