Add trace flag for cpp/Java AIDL generation.
The AIDL code generator can now include trace code in every generated AIDL call. We don't want to enable this by default for all interfaces for two reasons: 1) Potential performance overhead 2) For Java targets, the code depends on @hide APIs in android.os.Trace, and I haven't found a clean way to determine whether a target is allowed to use @hide stuff in the SDK. LOCAL_PRIVATE_PLATFORM_APIS is almost it, but it's not set for the core framework (which is exactly one of the things we'd like to trace). Bug: 74416314 Test: verify correct code is generated when flag is set Change-Id: Ic6ab8aee3e708207813da3e803911a844ff3e52b Merged-In: Ic6ab8aee3e708207813da3e803911a844ff3e52b
This commit is contained in:
parent
070f605485
commit
22071ca4b4
|
@ -106,6 +106,9 @@ type BaseCompilerProperties struct {
|
|||
// list of directories relative to the Blueprints file that will
|
||||
// be added to the aidl include paths.
|
||||
Local_include_dirs []string
|
||||
|
||||
// whether to generate traces (for systrace) for this interface
|
||||
Generate_traces *bool
|
||||
}
|
||||
|
||||
Renderscript struct {
|
||||
|
@ -477,6 +480,10 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
|||
flags.aidlFlags = append(flags.aidlFlags, includeDirsToFlags(rootAidlIncludeDirs))
|
||||
}
|
||||
|
||||
if Bool(compiler.Properties.Aidl.Generate_traces) {
|
||||
flags.aidlFlags = append(flags.aidlFlags, "-t")
|
||||
}
|
||||
|
||||
flags.GlobalFlags = append(flags.GlobalFlags,
|
||||
"-I"+android.PathForModuleGen(ctx, "aidl").String())
|
||||
}
|
||||
|
|
|
@ -175,6 +175,9 @@ type CompilerDeviceProperties struct {
|
|||
// directories that should be added as include directories for any aidl sources of modules
|
||||
// that depend on this module, as well as to aidl for this module.
|
||||
Export_include_dirs []string
|
||||
|
||||
// whether to generate traces (for systrace) for this interface
|
||||
Generate_traces *bool
|
||||
}
|
||||
|
||||
// If true, export a copy of the module as a -hostdex module for host testing.
|
||||
|
@ -534,6 +537,10 @@ func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.Opt
|
|||
flags = append(flags, "-I"+src.String())
|
||||
}
|
||||
|
||||
if Bool(j.deviceProperties.Aidl.Generate_traces) {
|
||||
flags = append(flags, "-t")
|
||||
}
|
||||
|
||||
return flags
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue