Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6507ee14 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Fix method call tree log

When method call log is enabled, we print "method call tree" in the log.
This feature has baked-in filtering to avoid unnecessary verbosity.
For example, we don't want to log every single "Log.i" calls or
"ArrayMap" class use.

We also filter out nested calls from such ignored methods, because
otherwise some of the "loggable" APIs are used by ignored APIs
and it'd also be too verbose.

Previously, this nest call check was done by keeping track of the
nest level where a "disable" happened.
This would work if we get method call callbacks for every single method
call, but in reality, this only happens from HostStubGen-processed
classes. This confused the original logic.

To fix it, we'd need "method exit callback" too, but I don't think it's
worth implementing that. Instead, let's do the following:

Now, we just always check every single class in every method call.
Even before this, we had to get the stack trace to get the nest level,
so there's no extra const in getting the stacktrace.

But stacktraces don't contain class objects, while our innermost check
method operates on class objects. So we now use reflections. But we
now cache the result to mitigate the performance hit.

We could rewrite the check method to operate on Strings too, but
we also have some inheritance check too, so let's not change that.
Having a cache should be good enough.

Bug: 292141694
Flag: TEST_ONLY
Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh -r
Test: Enable method call log and manually check the output
Change-Id: Iedef9791116140a01b27b27d8821a3b5bcd8204d
parent de5e925e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment