diff options
author | 2018-03-19 15:15:06 +0000 | |
---|---|---|
committer | 2018-03-19 15:15:06 +0000 | |
commit | cebbb65c19a511e76c5024b9e6713bf74be3f7c3 (patch) | |
tree | e984d49e422bf90b3453457a6077b98f60b60022 | |
parent | 722093c305de5646759318fdeedc022c08a6723c (diff) |
Fix find_api_violations script.
- The log tag seems to have changed, no longer zygote[64]
- Add option to output just method signatures, for adding to the light
greylist.
Test: $ find_api_violations.pl -s -b --nolightgrey < bugreport.txt
Change-Id: I31fd21c0d77e23188c010a412db41b4bcdc53ee8
-rwxr-xr-x | tools/hiddenapi/find_api_violations.pl | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/tools/hiddenapi/find_api_violations.pl b/tools/hiddenapi/find_api_violations.pl index a022999ea5..caa4f543a1 100755 --- a/tools/hiddenapi/find_api_violations.pl +++ b/tools/hiddenapi/find_api_violations.pl @@ -52,6 +52,10 @@ get all packages names, you should process the logcat from device boot time. Process a bugreport, rather than raw logcat +=item --short|-s + +Output API signatures only, don't include CSV header/package names/list name. + =item --help =back @@ -62,12 +66,14 @@ my $lightgrey = 1; my $darkgrey = 1; my $black = 1; my $bugreport = 0; +my $short = 0; my $help = 0; GetOptions("lightgrey!" => \$lightgrey, "darkgrey!" => \$darkgrey, "black!" => \$black, "bugreport|b" => \$bugreport, + "short|s" => \$short, "help" => \$help) or pod2usage(q(-verbose) => 1); @@ -90,7 +96,7 @@ if ($bugreport) { } my $procmap = {}; -print "package,symbol,list\n"; +print "package,symbol,list\n" unless $short; while (my $line = <>) { chomp $line; last if $bugreport and $line =~ m/^------ \d+\.\d+s was the duration of 'SYSTEM LOG' ------/; @@ -110,14 +116,17 @@ while (my $line = <>) { } $procmap->{$new_pid} = $package; } - if ($tag eq "zygote" || $tag eq "zygote64") { - if ($msg =~ m/Accessing hidden (\w+) (L.*?) \((.*list), (.*?)\)/) { - my ($member_type, $symbol, $list, $access_type) = ($1, $2, $3, $4); - my $package = $procmap->{$pid} || "unknown($pid)"; - print "$package,$symbol,$list\n" - if (($list =~ m/light/ && $lightgrey) - || ($list =~ m/dark/ && $darkgrey) - || ($list =~ m/black/ && $black)); + if ($msg =~ m/Accessing hidden (\w+) (L.*?) \((.*list), (.*?)\)/) { + my ($member_type, $symbol, $list, $access_type) = ($1, $2, $3, $4); + my $package = $procmap->{$pid} || "unknown($pid)"; + if (($list =~ m/light/ && $lightgrey) + || ($list =~ m/dark/ && $darkgrey) + || ($list =~ m/black/ && $black)) { + if ($short) { + print "$symbol\n"; + } else { + print "$package,$symbol,$list\n" + } } } } |