• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2017 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package hidl
16
17import (
18	"fmt"
19	"strings"
20
21	"github.com/google/blueprint"
22	"github.com/google/blueprint/proptools"
23
24	"android/soong/android"
25	"android/soong/bazel"
26	"android/soong/cc"
27	"android/soong/genrule"
28	"android/soong/java"
29)
30
31var (
32	hidlInterfaceSuffix       = "_interface"
33	hidlMetadataSingletonName = "hidl_metadata_json"
34
35	pctx = android.NewPackageContext("android/hidl")
36
37	hidl             = pctx.HostBinToolVariable("hidl", "hidl-gen")
38	hidlLint         = pctx.HostBinToolVariable("lint", "hidl-lint")
39	soong_zip        = pctx.HostBinToolVariable("soong_zip", "soong_zip")
40	intermediatesDir = pctx.IntermediatesPathVariable("intermediatesDir", "")
41
42	hidlRule = pctx.StaticRule("hidlRule", blueprint.RuleParams{
43		Depfile:     "${depfile}",
44		Deps:        blueprint.DepsGCC,
45		Command:     "rm -rf ${genDir} && ${hidl} -R -p . -d ${depfile} -o ${genDir} -L ${language} ${options} ${fqName}",
46		CommandDeps: []string{"${hidl}"},
47		Description: "HIDL ${language}: ${in} => ${out}",
48	}, "depfile", "fqName", "genDir", "language", "options")
49
50	hidlSrcJarRule = pctx.StaticRule("hidlSrcJarRule", blueprint.RuleParams{
51		Depfile: "${depfile}",
52		Deps:    blueprint.DepsGCC,
53		Command: "rm -rf ${genDir} && " +
54			"${hidl} -R -p . -d ${depfile} -o ${genDir}/srcs -L ${language} ${options} ${fqName} && " +
55			"${soong_zip} -o ${genDir}/srcs.srcjar -C ${genDir}/srcs -D ${genDir}/srcs",
56		CommandDeps: []string{"${hidl}", "${soong_zip}"},
57		Description: "HIDL ${language}: ${in} => srcs.srcjar",
58	}, "depfile", "fqName", "genDir", "language", "options")
59
60	lintRule = pctx.StaticRule("lintRule", blueprint.RuleParams{
61		Command:     "rm -f ${output} && touch ${output} && ${lint} -j -e -R -p . ${options} ${fqName} > ${output}",
62		CommandDeps: []string{"${lint}"},
63		Description: "hidl-lint ${fqName}: ${out}",
64	}, "output", "options", "fqName")
65
66	zipLintRule = pctx.StaticRule("zipLintRule", blueprint.RuleParams{
67		Rspfile:        "$out.rsp",
68		RspfileContent: "$files",
69		Command:        "rm -f ${output} && ${soong_zip} -o ${output} -C ${intermediatesDir} -l ${out}.rsp",
70		CommandDeps:    []string{"${soong_zip}"},
71		Description:    "Zipping hidl-lints into ${output}",
72	}, "output", "files")
73
74	inheritanceHierarchyRule = pctx.StaticRule("inheritanceHierarchyRule", blueprint.RuleParams{
75		Command:     "rm -f ${out} && ${hidl} -L inheritance-hierarchy ${options} ${fqInterface} > ${out}",
76		CommandDeps: []string{"${hidl}"},
77		Description: "HIDL inheritance hierarchy: ${fqInterface} => ${out}",
78	}, "options", "fqInterface")
79
80	joinJsonObjectsToArrayRule = pctx.StaticRule("joinJsonObjectsToArrayRule", blueprint.RuleParams{
81		Rspfile:        "$out.rsp",
82		RspfileContent: "$files",
83		Command: "rm -rf ${out} && " +
84			// Start the output array with an opening bracket.
85			"echo '[' >> ${out} && " +
86			// Add prebuilt declarations
87			"echo \"${extras}\" >> ${out} && " +
88			// Append each input file and a comma to the output.
89			"for file in $$(cat ${out}.rsp); do " +
90			"cat $$file >> ${out}; echo ',' >> ${out}; " +
91			"done && " +
92			// Remove the last comma, replacing it with the closing bracket.
93			"sed -i '$$d' ${out} && echo ']' >> ${out}",
94		Description: "Joining JSON objects into array ${out}",
95	}, "extras", "files")
96)
97
98func init() {
99	android.RegisterModuleType("prebuilt_hidl_interfaces", prebuiltHidlInterfaceFactory)
100	android.RegisterModuleType("hidl_interface", HidlInterfaceFactory)
101	android.RegisterSingletonType("all_hidl_lints", allHidlLintsFactory)
102	android.RegisterModuleType("hidl_interfaces_metadata", hidlInterfacesMetadataSingletonFactory)
103	pctx.Import("android/soong/android")
104}
105
106func hidlInterfacesMetadataSingletonFactory() android.Module {
107	i := &hidlInterfacesMetadataSingleton{}
108	android.InitAndroidModule(i)
109	return i
110}
111
112type hidlInterfacesMetadataSingleton struct {
113	android.ModuleBase
114
115	inheritanceHierarchyPath android.OutputPath
116}
117
118var _ android.OutputFileProducer = (*hidlInterfacesMetadataSingleton)(nil)
119
120func (m *hidlInterfacesMetadataSingleton) GenerateAndroidBuildActions(ctx android.ModuleContext) {
121	if m.Name() != hidlMetadataSingletonName {
122		ctx.PropertyErrorf("name", "must be %s", hidlMetadataSingletonName)
123		return
124	}
125
126	var inheritanceHierarchyOutputs android.Paths
127	additionalInterfaces := []string{}
128	ctx.VisitDirectDeps(func(m android.Module) {
129		if !m.ExportedToMake() {
130			return
131		}
132		if t, ok := m.(*hidlGenRule); ok {
133			if t.properties.Language == "inheritance-hierarchy" {
134				inheritanceHierarchyOutputs = append(inheritanceHierarchyOutputs, t.genOutputs.Paths()...)
135			}
136		} else if t, ok := m.(*prebuiltHidlInterface); ok {
137			additionalInterfaces = append(additionalInterfaces, t.properties.Interfaces...)
138		}
139	})
140
141	m.inheritanceHierarchyPath = android.PathForIntermediates(ctx, "hidl_inheritance_hierarchy.json")
142
143	ctx.Build(pctx, android.BuildParams{
144		Rule:   joinJsonObjectsToArrayRule,
145		Inputs: inheritanceHierarchyOutputs,
146		Output: m.inheritanceHierarchyPath,
147		Args: map[string]string{
148			"extras": strings.Join(wrap("{\\\"interface\\\":\\\"", additionalInterfaces, "\\\"},"), " "),
149			"files":  strings.Join(inheritanceHierarchyOutputs.Strings(), " "),
150		},
151	})
152}
153
154func (m *hidlInterfacesMetadataSingleton) OutputFiles(tag string) (android.Paths, error) {
155	if tag != "" {
156		return nil, fmt.Errorf("unsupported tag %q", tag)
157	}
158
159	return android.Paths{m.inheritanceHierarchyPath}, nil
160}
161
162func allHidlLintsFactory() android.Singleton {
163	return &allHidlLintsSingleton{}
164}
165
166type allHidlLintsSingleton struct {
167	outPath string
168}
169
170func (m *allHidlLintsSingleton) GenerateBuildActions(ctx android.SingletonContext) {
171	var hidlLintOutputs android.Paths
172	ctx.VisitAllModules(func(m android.Module) {
173		if t, ok := m.(*hidlGenRule); ok {
174			if t.properties.Language == "lint" {
175				if len(t.genOutputs) == 1 {
176					hidlLintOutputs = append(hidlLintOutputs, t.genOutputs[0])
177				} else {
178					panic("-hidl-lint target was not configured correctly")
179				}
180			}
181		}
182	})
183
184	outPath := android.PathForIntermediates(ctx, "hidl-lint.zip")
185	m.outPath = outPath.String()
186
187	ctx.Build(pctx, android.BuildParams{
188		Rule:   zipLintRule,
189		Inputs: hidlLintOutputs,
190		Output: outPath,
191		Args: map[string]string{
192			"output": outPath.String(),
193			"files":  strings.Join(hidlLintOutputs.Strings(), " "),
194		},
195	})
196}
197
198func (m *allHidlLintsSingleton) MakeVars(ctx android.MakeVarsContext) {
199	ctx.Strict("ALL_HIDL_LINTS_ZIP", m.outPath)
200}
201
202type hidlGenProperties struct {
203	Language       string
204	FqName         string
205	Root           string
206	Interfaces     []string
207	Inputs         []string
208	Outputs        []string
209	Apex_available []string
210}
211
212type hidlGenRule struct {
213	android.ModuleBase
214
215	properties hidlGenProperties
216
217	genOutputDir android.Path
218	genInputs    android.Paths
219	genOutputs   android.WritablePaths
220}
221
222var _ android.SourceFileProducer = (*hidlGenRule)(nil)
223var _ genrule.SourceFileGenerator = (*hidlGenRule)(nil)
224
225func (g *hidlGenRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
226	g.genOutputDir = android.PathForModuleGen(ctx)
227
228	for _, input := range g.properties.Inputs {
229		g.genInputs = append(g.genInputs, android.PathForModuleSrc(ctx, input))
230	}
231
232	var interfaces []string
233	for _, src := range g.properties.Inputs {
234		if strings.HasSuffix(src, ".hal") && strings.HasPrefix(src, "I") {
235			interfaces = append(interfaces, strings.TrimSuffix(src, ".hal"))
236		}
237	}
238
239	switch g.properties.Language {
240	case "lint":
241		g.genOutputs = append(g.genOutputs, android.PathForModuleGen(ctx, "lint.json"))
242	case "inheritance-hierarchy":
243		for _, intf := range interfaces {
244			g.genOutputs = append(g.genOutputs, android.PathForModuleGen(ctx, intf+"_inheritance_hierarchy.json"))
245		}
246	default:
247		for _, output := range g.properties.Outputs {
248			g.genOutputs = append(g.genOutputs, android.PathForModuleGen(ctx, output))
249		}
250	}
251
252	var extraOptions []string // including roots
253	var currentPath android.OptionalPath
254	ctx.VisitDirectDeps(func(dep android.Module) {
255		switch t := dep.(type) {
256		case *hidlInterface:
257			extraOptions = append(extraOptions, t.properties.Full_root_option)
258		case *hidlPackageRoot:
259			if currentPath.Valid() {
260				panic(fmt.Sprintf("Expecting only one path, but found %v %v", currentPath, t.getCurrentPath()))
261			}
262
263			currentPath = t.getCurrentPath()
264
265			if t.requireFrozen() {
266				extraOptions = append(extraOptions, "-F")
267			}
268		}
269	})
270
271	extraOptions = android.FirstUniqueStrings(extraOptions)
272
273	inputs := g.genInputs
274	if currentPath.Valid() {
275		inputs = append(inputs, currentPath.Path())
276	}
277
278	rule := hidlRule
279	if g.properties.Language == "java" {
280		rule = hidlSrcJarRule
281	}
282
283	if g.properties.Language == "lint" {
284		ctx.Build(pctx, android.BuildParams{
285			Rule:   lintRule,
286			Inputs: inputs,
287			Output: g.genOutputs[0],
288			Args: map[string]string{
289				"output":  g.genOutputs[0].String(),
290				"fqName":  g.properties.FqName,
291				"options": strings.Join(extraOptions, " "),
292			},
293		})
294
295		return
296	}
297
298	if g.properties.Language == "inheritance-hierarchy" {
299		for i, intf := range interfaces {
300			ctx.Build(pctx, android.BuildParams{
301				Rule:   inheritanceHierarchyRule,
302				Inputs: inputs,
303				Output: g.genOutputs[i],
304				Args: map[string]string{
305					"fqInterface": g.properties.FqName + "::" + intf,
306					"options":     strings.Join(extraOptions, " "),
307				},
308			})
309		}
310
311		return
312	}
313
314	ctx.ModuleBuild(pctx, android.ModuleBuildParams{
315		Rule:            rule,
316		Inputs:          inputs,
317		Output:          g.genOutputs[0],
318		ImplicitOutputs: g.genOutputs[1:],
319		Args: map[string]string{
320			"depfile":  g.genOutputs[0].String() + ".d",
321			"genDir":   g.genOutputDir.String(),
322			"fqName":   g.properties.FqName,
323			"language": g.properties.Language,
324			"options":  strings.Join(extraOptions, " "),
325		},
326	})
327}
328
329func (g *hidlGenRule) GeneratedSourceFiles() android.Paths {
330	return g.genOutputs.Paths()
331}
332
333func (g *hidlGenRule) Srcs() android.Paths {
334	return g.genOutputs.Paths()
335}
336
337func (g *hidlGenRule) GeneratedDeps() android.Paths {
338	return g.genOutputs.Paths()
339}
340
341func (g *hidlGenRule) GeneratedHeaderDirs() android.Paths {
342	return android.Paths{g.genOutputDir}
343}
344
345func (g *hidlGenRule) DepsMutator(ctx android.BottomUpMutatorContext) {
346	ctx.AddDependency(ctx.Module(), nil, g.properties.FqName+hidlInterfaceSuffix)
347	ctx.AddDependency(ctx.Module(), nil, wrap("", g.properties.Interfaces, hidlInterfaceSuffix)...)
348	ctx.AddDependency(ctx.Module(), nil, g.properties.Root)
349
350	ctx.AddReverseDependency(ctx.Module(), nil, hidlMetadataSingletonName)
351}
352
353func hidlGenFactory() android.Module {
354	g := &hidlGenRule{}
355	g.AddProperties(&g.properties)
356	android.InitAndroidModule(g)
357	return g
358}
359
360type prebuiltHidlInterfaceProperties struct {
361	// List of interfaces to consider valid, e.g. "vendor.foo.bar@1.0::IFoo" for typo checking
362	// between init.rc, VINTF, and elsewhere. Note that inheritance properties will not be
363	// checked for these (but would be checked in a branch where the actual hidl_interface
364	// exists).
365	Interfaces []string
366}
367
368type prebuiltHidlInterface struct {
369	android.ModuleBase
370
371	properties prebuiltHidlInterfaceProperties
372}
373
374func (p *prebuiltHidlInterface) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
375
376func (p *prebuiltHidlInterface) DepsMutator(ctx android.BottomUpMutatorContext) {
377	ctx.AddReverseDependency(ctx.Module(), nil, hidlMetadataSingletonName)
378}
379
380func prebuiltHidlInterfaceFactory() android.Module {
381	i := &prebuiltHidlInterface{}
382	i.AddProperties(&i.properties)
383	android.InitAndroidModule(i)
384	return i
385}
386
387type hidlInterfaceProperties struct {
388	// Vndk properties for interface library only.
389	cc.VndkProperties
390
391	// List of .hal files which compose this interface.
392	Srcs []string
393
394	// List of hal interface packages that this library depends on.
395	Interfaces []string
396
397	// Package root for this package, must be a prefix of name
398	Root string
399
400	// Unused/deprecated: List of non-TypeDef types declared in types.hal.
401	Types []string
402
403	// Whether to generate the Java library stubs.
404	// Default: true
405	Gen_java *bool
406
407	// Whether to generate a Java library containing constants
408	// expressed by @export annotations in the hal files.
409	Gen_java_constants bool
410
411	// Whether to generate VTS-related testing libraries.
412	Gen_vts *bool
413
414	// example: -randroid.hardware:hardware/interfaces
415	Full_root_option string `blueprint:"mutated"`
416
417	// List of APEX modules this interface can be used in.
418	//
419	// WARNING: HIDL is not fully supported in APEX since VINTF currently doesn't
420	// read files from APEXes (b/130058564).
421	//
422	// "//apex_available:anyapex" is a pseudo APEX name that matches to any APEX.
423	// "//apex_available:platform" refers to non-APEX partitions like "system.img"
424	//
425	// Note, this only applies to C++ libs, Java libs, and Java constant libs. It
426	// does  not apply to VTS targets targets/fuzzers since these components
427	// should not be shipped on device.
428	Apex_available []string
429
430	// Installs the vendor variant of the module to the /odm partition instead of
431	// the /vendor partition.
432	Odm_available *bool
433}
434
435type hidlInterface struct {
436	android.ModuleBase
437	android.BazelModuleBase
438
439	properties hidlInterfaceProperties
440}
441
442func processSources(mctx android.LoadHookContext, srcs []string) ([]string, []string, bool) {
443	var interfaces []string
444	var types []string // hidl-gen only supports types.hal, but don't assume that here
445
446	hasError := false
447
448	for _, v := range srcs {
449		if !strings.HasSuffix(v, ".hal") {
450			mctx.PropertyErrorf("srcs", "Source must be a .hal file: "+v)
451			hasError = true
452			continue
453		}
454
455		name := strings.TrimSuffix(v, ".hal")
456
457		if strings.HasPrefix(name, "I") {
458			baseName := strings.TrimPrefix(name, "I")
459			interfaces = append(interfaces, baseName)
460		} else {
461			types = append(types, name)
462		}
463	}
464
465	return interfaces, types, !hasError
466}
467
468func processDependencies(mctx android.LoadHookContext, interfaces []string) ([]string, []string, bool) {
469	var dependencies []string
470	var javaDependencies []string
471
472	hasError := false
473
474	for _, v := range interfaces {
475		name, err := parseFqName(v)
476		if err != nil {
477			mctx.PropertyErrorf("interfaces", err.Error())
478			hasError = true
479			continue
480		}
481		dependencies = append(dependencies, name.string())
482		javaDependencies = append(javaDependencies, name.javaName())
483	}
484
485	return dependencies, javaDependencies, !hasError
486}
487
488func removeCoreDependencies(mctx android.LoadHookContext, dependencies []string) []string {
489	var ret []string
490
491	for _, i := range dependencies {
492		if !isCorePackage(i) {
493			ret = append(ret, i)
494		}
495	}
496
497	return ret
498}
499
500func hidlInterfaceMutator(mctx android.LoadHookContext, i *hidlInterface) {
501	if !canInterfaceExist(i.ModuleBase.Name()) {
502		mctx.PropertyErrorf("name", "No more HIDL interfaces can be added to Android. Please use AIDL.")
503		return
504	}
505
506	name, err := parseFqName(i.ModuleBase.Name())
507	if err != nil {
508		mctx.PropertyErrorf("name", err.Error())
509	}
510
511	if !name.inPackage(i.properties.Root) {
512		mctx.PropertyErrorf("root", i.properties.Root+" must be a prefix of  "+name.string()+".")
513	}
514	if lookupPackageRoot(i.properties.Root) == nil {
515		mctx.PropertyErrorf("interfaces", `Cannot find package root specification for package `+
516			`root '%s' needed for module '%s'. Either this is a mispelling of the package `+
517			`root, or a new hidl_package_root module needs to be added. For example, you can `+
518			`fix this error by adding the following to <some path>/Android.bp:
519
520hidl_package_root {
521name: "%s",
522// if you want to require <some path>/current.txt for interface versioning
523use_current: true,
524}
525
526This corresponds to the "-r%s:<some path>" option that would be passed into hidl-gen.`,
527			i.properties.Root, name, i.properties.Root, i.properties.Root)
528	}
529
530	interfaces, types, _ := processSources(mctx, i.properties.Srcs)
531
532	if len(interfaces) == 0 && len(types) == 0 {
533		mctx.PropertyErrorf("srcs", "No sources provided.")
534	}
535
536	dependencies, javaDependencies, _ := processDependencies(mctx, i.properties.Interfaces)
537	cppDependencies := removeCoreDependencies(mctx, dependencies)
538
539	if mctx.Failed() {
540		return
541	}
542
543	shouldGenerateLibrary := !isCorePackage(name.string())
544	// explicitly true if not specified to give early warning to devs
545	shouldGenerateJava := proptools.BoolDefault(i.properties.Gen_java, true)
546	shouldGenerateJavaConstants := i.properties.Gen_java_constants
547
548	var productAvailable *bool
549	if !mctx.ProductSpecific() {
550		productAvailable = proptools.BoolPtr(true)
551	}
552
553	var vendorAvailable *bool
554	if !proptools.Bool(i.properties.Odm_available) {
555		vendorAvailable = proptools.BoolPtr(true)
556	}
557
558	// TODO(b/69002743): remove filegroups
559	mctx.CreateModule(android.FileGroupFactory, &fileGroupProperties{
560		Name: proptools.StringPtr(name.fileGroupName()),
561		Srcs: i.properties.Srcs,
562	},
563		&bazelProperties{
564			&Bazel_module{
565				Bp2build_available: proptools.BoolPtr(false),
566			}},
567	)
568
569	mctx.CreateModule(hidlGenFactory, &nameProperties{
570		Name: proptools.StringPtr(name.sourcesName()),
571	}, &hidlGenProperties{
572		Language:   "c++-sources",
573		FqName:     name.string(),
574		Root:       i.properties.Root,
575		Interfaces: i.properties.Interfaces,
576		Inputs:     i.properties.Srcs,
577		Outputs:    concat(wrap(name.dir(), interfaces, "All.cpp"), wrap(name.dir(), types, ".cpp")),
578	})
579	mctx.CreateModule(hidlGenFactory, &nameProperties{
580		Name: proptools.StringPtr(name.headersName()),
581	}, &hidlGenProperties{
582		Language:   "c++-headers",
583		FqName:     name.string(),
584		Root:       i.properties.Root,
585		Interfaces: i.properties.Interfaces,
586		Inputs:     i.properties.Srcs,
587		Outputs: concat(wrap(name.dir()+"I", interfaces, ".h"),
588			wrap(name.dir()+"Bs", interfaces, ".h"),
589			wrap(name.dir()+"BnHw", interfaces, ".h"),
590			wrap(name.dir()+"BpHw", interfaces, ".h"),
591			wrap(name.dir()+"IHw", interfaces, ".h"),
592			wrap(name.dir(), types, ".h"),
593			wrap(name.dir()+"hw", types, ".h")),
594	})
595
596	if shouldGenerateLibrary {
597		mctx.CreateModule(cc.LibraryFactory, &ccProperties{
598			Name:               proptools.StringPtr(name.string()),
599			Host_supported:     proptools.BoolPtr(true),
600			Recovery_available: proptools.BoolPtr(true),
601			Vendor_available:   vendorAvailable,
602			Odm_available:      i.properties.Odm_available,
603			Product_available:  productAvailable,
604			Double_loadable:    proptools.BoolPtr(isDoubleLoadable(name.string())),
605			Defaults:           []string{"hidl-module-defaults"},
606			Generated_sources:  []string{name.sourcesName()},
607			Generated_headers:  []string{name.headersName()},
608			Shared_libs: concat(cppDependencies, []string{
609				"libhidlbase",
610				"liblog",
611				"libutils",
612				"libcutils",
613			}),
614			Export_shared_lib_headers: concat(cppDependencies, []string{
615				"libhidlbase",
616				"libutils",
617			}),
618			Export_generated_headers: []string{name.headersName()},
619			Apex_available:           i.properties.Apex_available,
620			Min_sdk_version:          getMinSdkVersion(name.string()),
621		}, &i.properties.VndkProperties,
622			// TODO(b/237810289): We need to disable/enable based on if a module has
623			// been converted or not, otherwise mixed build will fail.
624			&bazelProperties{
625				&Bazel_module{
626					Bp2build_available: proptools.BoolPtr(false),
627				}},
628		)
629	}
630
631	if shouldGenerateJava {
632		mctx.CreateModule(hidlGenFactory, &nameProperties{
633			Name: proptools.StringPtr(name.javaSourcesName()),
634		}, &hidlGenProperties{
635			Language:   "java",
636			FqName:     name.string(),
637			Root:       i.properties.Root,
638			Interfaces: i.properties.Interfaces,
639			Inputs:     i.properties.Srcs,
640			Outputs:    []string{"srcs.srcjar"},
641		})
642
643		commonJavaProperties := javaProperties{
644			Defaults:    []string{"hidl-java-module-defaults"},
645			Installable: proptools.BoolPtr(true),
646			Srcs:        []string{":" + name.javaSourcesName()},
647
648			// This should ideally be system_current, but android.hidl.base-V1.0-java is used
649			// to build framework, which is used to build system_current.  Use core_current
650			// plus hwbinder.stubs, which together form a subset of system_current that does
651			// not depend on framework.
652			Sdk_version:     proptools.StringPtr("core_current"),
653			Libs:            []string{"hwbinder.stubs"},
654			Apex_available:  i.properties.Apex_available,
655			Min_sdk_version: getMinSdkVersion(name.string()),
656		}
657
658		mctx.CreateModule(java.LibraryFactory, &javaProperties{
659			Name:        proptools.StringPtr(name.javaName()),
660			Static_libs: javaDependencies,
661		}, &commonJavaProperties)
662		mctx.CreateModule(java.LibraryFactory, &javaProperties{
663			Name: proptools.StringPtr(name.javaSharedName()),
664			Libs: javaDependencies,
665		}, &commonJavaProperties)
666	}
667
668	if shouldGenerateJavaConstants {
669		mctx.CreateModule(hidlGenFactory, &nameProperties{
670			Name: proptools.StringPtr(name.javaConstantsSourcesName()),
671		}, &hidlGenProperties{
672			Language:   "java-constants",
673			FqName:     name.string(),
674			Root:       i.properties.Root,
675			Interfaces: i.properties.Interfaces,
676			Inputs:     i.properties.Srcs,
677			Outputs:    []string{name.sanitizedDir() + "Constants.java"},
678		})
679		mctx.CreateModule(java.LibraryFactory, &javaProperties{
680			Name:            proptools.StringPtr(name.javaConstantsName()),
681			Defaults:        []string{"hidl-java-module-defaults"},
682			Sdk_version:     proptools.StringPtr("core_current"),
683			Srcs:            []string{":" + name.javaConstantsSourcesName()},
684			Apex_available:  i.properties.Apex_available,
685			Min_sdk_version: getMinSdkVersion(name.string()),
686		})
687	}
688
689	mctx.CreateModule(hidlGenFactory, &nameProperties{
690		Name: proptools.StringPtr(name.lintName()),
691	}, &hidlGenProperties{
692		Language:   "lint",
693		FqName:     name.string(),
694		Root:       i.properties.Root,
695		Interfaces: i.properties.Interfaces,
696		Inputs:     i.properties.Srcs,
697	})
698
699	mctx.CreateModule(hidlGenFactory, &nameProperties{
700		Name: proptools.StringPtr(name.inheritanceHierarchyName()),
701	}, &hidlGenProperties{
702		Language:   "inheritance-hierarchy",
703		FqName:     name.string(),
704		Root:       i.properties.Root,
705		Interfaces: i.properties.Interfaces,
706		Inputs:     i.properties.Srcs,
707	})
708}
709
710func (h *hidlInterface) Name() string {
711	return h.ModuleBase.Name() + hidlInterfaceSuffix
712}
713func (h *hidlInterface) GenerateAndroidBuildActions(ctx android.ModuleContext) {
714	visited := false
715	ctx.VisitDirectDeps(func(dep android.Module) {
716		if r, ok := dep.(*hidlPackageRoot); ok {
717			if visited {
718				panic("internal error, multiple dependencies found but only one added")
719			}
720			visited = true
721			h.properties.Full_root_option = r.getFullPackageRoot()
722		}
723	})
724	if !visited {
725		panic("internal error, no dependencies found but dependency added")
726	}
727
728}
729func (h *hidlInterface) DepsMutator(ctx android.BottomUpMutatorContext) {
730	ctx.AddDependency(ctx.Module(), nil, h.properties.Root)
731}
732
733func HidlInterfaceFactory() android.Module {
734	i := &hidlInterface{}
735	i.AddProperties(&i.properties)
736	android.InitAndroidModule(i)
737	android.AddLoadHook(i, func(ctx android.LoadHookContext) { hidlInterfaceMutator(ctx, i) })
738	android.InitBazelModule(i)
739
740	return i
741}
742
743type hidlInterfaceAttributes struct {
744	Srcs                bazel.LabelListAttribute
745	Deps                bazel.LabelListAttribute
746	Root                string
747	Root_interface_file bazel.LabelAttribute
748	Min_sdk_version     *string
749	Tags                []string
750}
751
752func (m *hidlInterface) ConvertWithBp2build(ctx android.TopDownMutatorContext) {
753	srcs := bazel.MakeLabelListAttribute(
754		android.BazelLabelForModuleSrc(ctx, m.properties.Srcs))
755
756	// The interface dependencies are added earlier with the suffix of "_interface",
757	// so we need to look for them with the hidlInterfaceSuffix added to the names.
758	// Later we trim the "_interface" suffix. Here is an example:
759	// hidl_interface(
760	//    name = "android.hardware.nfc@1.1",
761	//    deps = [
762	//        "//hardware/interfaces/nfc/1.0:android.hardware.nfc@1.0",
763	//        "//system/libhidl/transport/base/1.0:android.hidl.base@1.0",
764	//    ],
765	// )
766	deps := android.BazelLabelForModuleDeps(ctx, wrap("", m.properties.Interfaces, hidlInterfaceSuffix))
767	var dep_labels []bazel.Label
768	for _, label := range deps.Includes {
769		dep_labels = append(dep_labels,
770			bazel.Label{Label: strings.TrimSuffix(label.Label, hidlInterfaceSuffix)})
771	}
772
773	var root string
774	var root_interface_file bazel.LabelAttribute
775	if module, exists := ctx.ModuleFromName(m.properties.Root); exists {
776		if pkg_root, ok := module.(*hidlPackageRoot); ok {
777			var path string
778			if pkg_root.properties.Path != nil {
779				path = *pkg_root.properties.Path
780			} else {
781				path = ctx.OtherModuleDir(pkg_root)
782			}
783			// The root and root_interface come from the hidl_package_root module that
784			// this module depends on, we don't convert hidl_package_root module
785			// separately since all the other properties of that module are deprecated.
786			root = pkg_root.Name()
787			if path == ctx.ModuleDir() {
788				root_interface_file = *bazel.MakeLabelAttribute(":" + "current.txt")
789			} else {
790				root_interface_file = *bazel.MakeLabelAttribute("//" + path + ":" + "current.txt")
791			}
792		}
793	}
794
795	attrs := &hidlInterfaceAttributes{
796		Srcs:                srcs,
797		Deps:                bazel.MakeLabelListAttribute(bazel.MakeLabelList(dep_labels)),
798		Root:                root,
799		Root_interface_file: root_interface_file,
800		Min_sdk_version:     getMinSdkVersion(m.Name()),
801		Tags:                android.ConvertApexAvailableToTags(m.properties.Apex_available),
802	}
803
804	props := bazel.BazelTargetModuleProperties{
805		Rule_class:        "hidl_interface",
806		Bzl_load_location: "//build/bazel/rules/hidl:hidl_interface.bzl",
807	}
808
809	ctx.CreateBazelTargetModule(props, android.CommonAttributes{Name: strings.TrimSuffix(m.Name(), hidlInterfaceSuffix)}, attrs)
810}
811
812var minSdkVersion = map[string]string{
813	"android.hardware.audio.common@5.0":            "30",
814	"android.hardware.audio.common@6.0":            "31",
815	"android.hardware.automotive.audiocontrol@1.0": "31",
816	"android.hardware.automotive.audiocontrol@2.0": "31",
817	"android.hardware.automotive.vehicle@2.0":      "31",
818	"android.hardware.bluetooth.a2dp@1.0":          "30",
819	"android.hardware.bluetooth.audio@2.0":         "30",
820	"android.hardware.bluetooth.audio@2.1":         "30",
821	"android.hardware.bluetooth.audio@2.2":         "30",
822	"android.hardware.bluetooth@1.0":               "30",
823	"android.hardware.bluetooth@1.1":               "30",
824	"android.hardware.health@1.0":                  "31",
825	"android.hardware.health@2.0":                  "31",
826	"android.hardware.neuralnetworks@1.0":          "30",
827	"android.hardware.neuralnetworks@1.1":          "30",
828	"android.hardware.neuralnetworks@1.2":          "30",
829	"android.hardware.neuralnetworks@1.3":          "30",
830	"android.hardware.wifi@1.0":                    "30",
831	"android.hardware.wifi@1.1":                    "30",
832	"android.hardware.wifi@1.2":                    "30",
833	"android.hardware.wifi@1.3":                    "30",
834	"android.hardware.wifi@1.4":                    "30",
835	"android.hardware.wifi@1.5":                    "30",
836	"android.hardware.wifi@1.6":                    "30",
837	"android.hardware.wifi.hostapd@1.0":            "30",
838	"android.hardware.wifi.hostapd@1.1":            "30",
839	"android.hardware.wifi.hostapd@1.2":            "30",
840	"android.hardware.wifi.hostapd@1.3":            "30",
841	"android.hardware.wifi.supplicant@1.0":         "30",
842	"android.hardware.wifi.supplicant@1.1":         "30",
843	"android.hardware.wifi.supplicant@1.2":         "30",
844	"android.hardware.wifi.supplicant@1.3":         "30",
845	"android.hardware.wifi.supplicant@1.4":         "30",
846	"android.hidl.manager@1.0":                     "30",
847	"android.hidl.manager@1.1":                     "30",
848	"android.hidl.manager@1.2":                     "30",
849}
850
851func getMinSdkVersion(name string) *string {
852	if ver, ok := minSdkVersion[name]; ok {
853		return proptools.StringPtr(ver)
854	}
855	// legacy, as used
856	if name == "android.hardware.tetheroffload.config@1.0" ||
857		name == "android.hardware.tetheroffload.control@1.0" ||
858		name == "android.hardware.tetheroffload.control@1.1" ||
859		name == "android.hardware.radio@1.0" ||
860		name == "android.hidl.base@1.0" {
861
862		return nil
863	}
864	return proptools.StringPtr("29")
865}
866
867var doubleLoadablePackageNames = []string{
868	"android.frameworks.bufferhub@1.0",
869	"android.hardware.cas@1.0",
870	"android.hardware.cas.native@1.0",
871	"android.hardware.configstore@",
872	"android.hardware.drm@",
873	"android.hardware.graphics.allocator@",
874	"android.hardware.graphics.bufferqueue@",
875	"android.hardware.media@",
876	"android.hardware.media.bufferpool@",
877	"android.hardware.media.c2@",
878	"android.hardware.media.omx@",
879	"android.hardware.memtrack@1.0",
880	"android.hardware.neuralnetworks@",
881	"android.hidl.allocator@",
882	"android.hidl.token@",
883	"android.system.suspend@1.0",
884}
885
886func isDoubleLoadable(name string) bool {
887	for _, pkgname := range doubleLoadablePackageNames {
888		if strings.HasPrefix(name, pkgname) {
889			return true
890		}
891	}
892	return false
893}
894
895// packages in libhidlbase
896var coreDependencyPackageNames = []string{
897	"android.hidl.base@",
898	"android.hidl.manager@",
899}
900
901func isCorePackage(name string) bool {
902	for _, pkgname := range coreDependencyPackageNames {
903		if strings.HasPrefix(name, pkgname) {
904			return true
905		}
906	}
907	return false
908}
909
910var fuzzerPackageNameBlacklist = []string{
911	"android.hardware.keymaster@", // to avoid deleteAllKeys()
912	// Same-process HALs are always opened in the same process as their client.
913	// So stability guarantees don't apply to them, e.g. it's OK to crash on
914	// NULL input from client. Disable corresponding fuzzers as they create too
915	// much noise.
916	"android.hardware.graphics.mapper@",
917	"android.hardware.renderscript@",
918	"android.hidl.memory@",
919}
920
921func isFuzzerEnabled(name string) bool {
922	// TODO(151338797): re-enable fuzzers
923	return false
924}
925
926func canInterfaceExist(name string) bool {
927	if strings.HasPrefix(name, "android.") {
928		return allAospHidlInterfaces[name]
929	}
930
931	return true
932}
933
934var allAospHidlInterfaces = map[string]bool{
935	"android.frameworks.automotive.display@1.0":    true,
936	"android.frameworks.bufferhub@1.0":             true,
937	"android.frameworks.cameraservice.common@2.0":  true,
938	"android.frameworks.cameraservice.device@2.0":  true,
939	"android.frameworks.cameraservice.device@2.1":  true,
940	"android.frameworks.cameraservice.service@2.0": true,
941	"android.frameworks.cameraservice.service@2.1": true,
942	"android.frameworks.cameraservice.service@2.2": true,
943	"android.frameworks.displayservice@1.0":        true,
944	"android.frameworks.schedulerservice@1.0":      true,
945	"android.frameworks.sensorservice@1.0":         true,
946	"android.frameworks.stats@1.0":                 true,
947	"android.frameworks.vr.composer@1.0":           true,
948	"android.frameworks.vr.composer@2.0":           true,
949	"android.hardware.atrace@1.0":                  true,
950	"android.hardware.audio@2.0":                   true,
951	"android.hardware.audio@4.0":                   true,
952	"android.hardware.audio@5.0":                   true,
953	"android.hardware.audio@6.0":                   true,
954	"android.hardware.audio@7.0":                   true,
955	"android.hardware.audio@7.1":                   true,
956	"android.hardware.audio.common@2.0":            true,
957	"android.hardware.audio.common@4.0":            true,
958	"android.hardware.audio.common@5.0":            true,
959	"android.hardware.audio.common@6.0":            true,
960	"android.hardware.audio.common@7.0":            true,
961	"android.hardware.audio.effect@2.0":            true,
962	"android.hardware.audio.effect@4.0":            true,
963	"android.hardware.audio.effect@5.0":            true,
964	"android.hardware.audio.effect@6.0":            true,
965	"android.hardware.audio.effect@7.0":            true,
966	"android.hardware.authsecret@1.0":              true,
967	"android.hardware.automotive.audiocontrol@1.0": true,
968	"android.hardware.automotive.audiocontrol@2.0": true,
969	"android.hardware.automotive.can@1.0":          true,
970	"android.hardware.automotive.evs@1.0":          true,
971	"android.hardware.automotive.evs@1.1":          true,
972	"android.hardware.automotive.sv@1.0":           true,
973	"android.hardware.automotive.vehicle@2.0":      true,
974	"android.hardware.biometrics.face@1.0":         true,
975	"android.hardware.biometrics.fingerprint@2.1":  true,
976	"android.hardware.biometrics.fingerprint@2.2":  true,
977	"android.hardware.biometrics.fingerprint@2.3":  true,
978	"android.hardware.bluetooth@1.0":               true,
979	"android.hardware.bluetooth@1.1":               true,
980	"android.hardware.bluetooth.a2dp@1.0":          true,
981	"android.hardware.bluetooth.audio@2.0":         true,
982	"android.hardware.bluetooth.audio@2.1":         true,
983	"android.hardware.bluetooth.audio@2.2":         true,
984	"android.hardware.boot@1.0":                    true,
985	"android.hardware.boot@1.1":                    true,
986	"android.hardware.boot@1.2":                    true,
987	"android.hardware.broadcastradio@1.0":          true,
988	"android.hardware.broadcastradio@1.1":          true,
989	"android.hardware.broadcastradio@2.0":          true,
990	"android.hardware.camera.common@1.0":           true,
991	"android.hardware.camera.device@1.0":           true,
992	"android.hardware.camera.device@3.2":           true,
993	"android.hardware.camera.device@3.3":           true,
994	"android.hardware.camera.device@3.4":           true,
995	"android.hardware.camera.device@3.5":           true,
996	"android.hardware.camera.device@3.6":           true,
997	"android.hardware.camera.device@3.7":           true,
998	"android.hardware.camera.device@3.8":           true,
999	"android.hardware.camera.metadata@3.2":         true,
1000	"android.hardware.camera.metadata@3.3":         true,
1001	"android.hardware.camera.metadata@3.4":         true,
1002	"android.hardware.camera.metadata@3.5":         true,
1003	"android.hardware.camera.metadata@3.6":         true,
1004	// TODO: Remove metadata@3.8 after AIDL migration b/196432585
1005	"android.hardware.camera.metadata@3.7":              true,
1006	"android.hardware.camera.metadata@3.8":              true,
1007	"android.hardware.camera.provider@2.4":              true,
1008	"android.hardware.camera.provider@2.5":              true,
1009	"android.hardware.camera.provider@2.6":              true,
1010	"android.hardware.camera.provider@2.7":              true,
1011	"android.hardware.cas@1.0":                          true,
1012	"android.hardware.cas@1.1":                          true,
1013	"android.hardware.cas@1.2":                          true,
1014	"android.hardware.cas.native@1.0":                   true,
1015	"android.hardware.configstore@1.0":                  true,
1016	"android.hardware.configstore@1.1":                  true,
1017	"android.hardware.confirmationui@1.0":               true,
1018	"android.hardware.contexthub@1.0":                   true,
1019	"android.hardware.contexthub@1.1":                   true,
1020	"android.hardware.contexthub@1.2":                   true,
1021	"android.hardware.drm@1.0":                          true,
1022	"android.hardware.drm@1.1":                          true,
1023	"android.hardware.drm@1.2":                          true,
1024	"android.hardware.drm@1.3":                          true,
1025	"android.hardware.drm@1.4":                          true,
1026	"android.hardware.dumpstate@1.0":                    true,
1027	"android.hardware.dumpstate@1.1":                    true,
1028	"android.hardware.fastboot@1.0":                     true,
1029	"android.hardware.fastboot@1.1":                     true,
1030	"android.hardware.gatekeeper@1.0":                   true,
1031	"android.hardware.gnss@1.0":                         true,
1032	"android.hardware.gnss@1.1":                         true,
1033	"android.hardware.gnss@2.0":                         true,
1034	"android.hardware.gnss@2.1":                         true,
1035	"android.hardware.gnss.measurement_corrections@1.0": true,
1036	"android.hardware.gnss.measurement_corrections@1.1": true,
1037	"android.hardware.gnss.visibility_control@1.0":      true,
1038	"android.hardware.graphics.allocator@2.0":           true,
1039	"android.hardware.graphics.allocator@3.0":           true,
1040	"android.hardware.graphics.allocator@4.0":           true,
1041	"android.hardware.graphics.bufferqueue@1.0":         true,
1042	"android.hardware.graphics.bufferqueue@2.0":         true,
1043	"android.hardware.graphics.common@1.0":              true,
1044	"android.hardware.graphics.common@1.1":              true,
1045	"android.hardware.graphics.common@1.2":              true,
1046	"android.hardware.graphics.composer@2.1":            true,
1047	"android.hardware.graphics.composer@2.2":            true,
1048	"android.hardware.graphics.composer@2.3":            true,
1049	"android.hardware.graphics.composer@2.4":            true,
1050	"android.hardware.graphics.mapper@2.0":              true,
1051	"android.hardware.graphics.mapper@2.1":              true,
1052	"android.hardware.graphics.mapper@3.0":              true,
1053	"android.hardware.graphics.mapper@4.0":              true,
1054	"android.hardware.health@1.0":                       true,
1055	"android.hardware.health@2.0":                       true,
1056	"android.hardware.health@2.1":                       true,
1057	"android.hardware.health.storage@1.0":               true,
1058	"android.hardware.input.classifier@1.0":             true,
1059	"android.hardware.input.common@1.0":                 true,
1060	"android.hardware.ir@1.0":                           true,
1061	"android.hardware.keymaster@3.0":                    true,
1062	"android.hardware.keymaster@4.0":                    true,
1063	"android.hardware.keymaster@4.1":                    true,
1064	"android.hardware.light@2.0":                        true,
1065	"android.hardware.media@1.0":                        true,
1066	"android.hardware.media.bufferpool@1.0":             true,
1067	"android.hardware.media.bufferpool@2.0":             true,
1068	"android.hardware.media.c2@1.0":                     true,
1069	"android.hardware.media.c2@1.1":                     true,
1070	"android.hardware.media.c2@1.2":                     true,
1071	"android.hardware.media.omx@1.0":                    true,
1072	"android.hardware.memtrack@1.0":                     true,
1073	"android.hardware.neuralnetworks@1.0":               true,
1074	"android.hardware.neuralnetworks@1.1":               true,
1075	"android.hardware.neuralnetworks@1.2":               true,
1076	"android.hardware.neuralnetworks@1.3":               true,
1077	"android.hardware.nfc@1.0":                          true,
1078	"android.hardware.nfc@1.1":                          true,
1079	"android.hardware.nfc@1.2":                          true,
1080	"android.hardware.oemlock@1.0":                      true,
1081	"android.hardware.power@1.0":                        true,
1082	"android.hardware.power@1.1":                        true,
1083	"android.hardware.power@1.2":                        true,
1084	"android.hardware.power@1.3":                        true,
1085	"android.hardware.power.stats@1.0":                  true,
1086	"android.hardware.radio@1.0":                        true,
1087	"android.hardware.radio@1.1":                        true,
1088	"android.hardware.radio@1.2":                        true,
1089	"android.hardware.radio@1.3":                        true,
1090	"android.hardware.radio@1.4":                        true,
1091	"android.hardware.radio@1.5":                        true,
1092	"android.hardware.radio@1.6":                        true,
1093	"android.hardware.radio.config@1.0":                 true,
1094	"android.hardware.radio.config@1.1":                 true,
1095	"android.hardware.radio.config@1.2":                 true,
1096	"android.hardware.radio.config@1.3":                 true,
1097	"android.hardware.radio.deprecated@1.0":             true,
1098	"android.hardware.renderscript@1.0":                 true,
1099	"android.hardware.secure_element@1.0":               true,
1100	"android.hardware.secure_element@1.1":               true,
1101	"android.hardware.secure_element@1.2":               true,
1102	"android.hardware.sensors@1.0":                      true,
1103	"android.hardware.sensors@2.0":                      true,
1104	"android.hardware.sensors@2.1":                      true,
1105	"android.hardware.soundtrigger@2.0":                 true,
1106	"android.hardware.soundtrigger@2.1":                 true,
1107	"android.hardware.soundtrigger@2.2":                 true,
1108	"android.hardware.soundtrigger@2.3":                 true,
1109	"android.hardware.soundtrigger@2.4":                 true,
1110	"android.hardware.tests.bar@1.0":                    true,
1111	"android.hardware.tests.baz@1.0":                    true,
1112	"android.hardware.tests.expression@1.0":             true,
1113	"android.hardware.tests.extension.light@2.0":        true,
1114	"android.hardware.tests.foo@1.0":                    true,
1115	"android.hardware.tests.hash@1.0":                   true,
1116	"android.hardware.tests.inheritance@1.0":            true,
1117	"android.hardware.tests.lazy@1.0":                   true,
1118	"android.hardware.tests.lazy@1.1":                   true,
1119	"android.hardware.tests.lazy_cb@1.0":                true,
1120	"android.hardware.tests.libhwbinder@1.0":            true,
1121	"android.hardware.tests.memory@1.0":                 true,
1122	"android.hardware.tests.memory@2.0":                 true,
1123	"android.hardware.tests.msgq@1.0":                   true,
1124	"android.hardware.tests.multithread@1.0":            true,
1125	"android.hardware.tests.safeunion@1.0":              true,
1126	"android.hardware.tests.safeunion.cpp@1.0":          true,
1127	"android.hardware.tests.trie@1.0":                   true,
1128	"android.hardware.tetheroffload.config@1.0":         true,
1129	"android.hardware.tetheroffload.control@1.0":        true,
1130	"android.hardware.tetheroffload.control@1.1":        true,
1131	"android.hardware.thermal@1.0":                      true,
1132	"android.hardware.thermal@1.1":                      true,
1133	"android.hardware.thermal@2.0":                      true,
1134	"android.hardware.tv.cec@1.0":                       true,
1135	"android.hardware.tv.cec@1.1":                       true,
1136	"android.hardware.tv.input@1.0":                     true,
1137	"android.hardware.tv.tuner@1.0":                     true,
1138	"android.hardware.tv.tuner@1.1":                     true,
1139	"android.hardware.usb@1.0":                          true,
1140	"android.hardware.usb@1.1":                          true,
1141	"android.hardware.usb@1.2":                          true,
1142	"android.hardware.usb@1.3":                          true,
1143	"android.hardware.usb.gadget@1.0":                   true,
1144	"android.hardware.usb.gadget@1.1":                   true,
1145	"android.hardware.usb.gadget@1.2":                   true,
1146	"android.hardware.vibrator@1.0":                     true,
1147	"android.hardware.vibrator@1.1":                     true,
1148	"android.hardware.vibrator@1.2":                     true,
1149	"android.hardware.vibrator@1.3":                     true,
1150	"android.hardware.vr@1.0":                           true,
1151	"android.hardware.weaver@1.0":                       true,
1152	"android.hardware.wifi@1.0":                         true,
1153	"android.hardware.wifi@1.1":                         true,
1154	"android.hardware.wifi@1.2":                         true,
1155	"android.hardware.wifi@1.3":                         true,
1156	"android.hardware.wifi@1.4":                         true,
1157	"android.hardware.wifi@1.5":                         true,
1158	"android.hardware.wifi@1.6":                         true,
1159	"android.hardware.wifi.hostapd@1.0":                 true,
1160	"android.hardware.wifi.hostapd@1.1":                 true,
1161	"android.hardware.wifi.hostapd@1.2":                 true,
1162	"android.hardware.wifi.hostapd@1.3":                 true,
1163	"android.hardware.wifi.offload@1.0":                 true,
1164	"android.hardware.wifi.supplicant@1.0":              true,
1165	"android.hardware.wifi.supplicant@1.1":              true,
1166	"android.hardware.wifi.supplicant@1.2":              true,
1167	"android.hardware.wifi.supplicant@1.3":              true,
1168	"android.hardware.wifi.supplicant@1.4":              true,
1169	"android.hidl.allocator@1.0":                        true,
1170	"android.hidl.base@1.0":                             true,
1171	"android.hidl.manager@1.0":                          true,
1172	"android.hidl.manager@1.1":                          true,
1173	"android.hidl.manager@1.2":                          true,
1174	"android.hidl.memory@1.0":                           true,
1175	"android.hidl.memory.block@1.0":                     true,
1176	"android.hidl.memory.token@1.0":                     true,
1177	"android.hidl.safe_union@1.0":                       true,
1178	"android.hidl.token@1.0":                            true,
1179	"android.system.net.netd@1.0":                       true,
1180	"android.system.net.netd@1.1":                       true,
1181	"android.system.suspend@1.0":                        true,
1182	"android.system.wifi.keystore@1.0":                  true,
1183}
1184