From 22071ca4b44f8a7136e370fc50415a0dfb860f52 Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Fri, 9 Mar 2018 09:29:59 +0100 Subject: 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 --- cc/compiler.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cc') diff --git a/cc/compiler.go b/cc/compiler.go index ef222854..b9ba31a7 100644 --- a/cc/compiler.go +++ b/cc/compiler.go @@ -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()) } -- cgit v1.2.3