2014-10-15 04:36:04 -05:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
use strict;
|
2014-10-21 09:12:03 -05:00
|
|
|
use IO::Handle;
|
2014-10-15 04:36:04 -05:00
|
|
|
|
|
|
|
die "Usage: $0 identifier\n" .
|
|
|
|
"(identifier is for example org.libreoffice)" unless $#ARGV == 0;
|
|
|
|
|
|
|
|
my $id = $ARGV[0];
|
|
|
|
|
|
|
|
open (LOGCAT, "adb logcat |") || die "Could not open pipe from adb logcat";
|
|
|
|
my $pid = '';
|
|
|
|
|
|
|
|
while (<LOGCAT>) {
|
|
|
|
if (m!^I/ActivityManager\( *\d+\): Start proc $id for activity .*: pid=(\d+)!) {
|
|
|
|
$pid = $1;
|
2014-10-22 08:52:25 -05:00
|
|
|
} elsif (m!^[EIWD]/[^(]+\( *$pid\)!) {
|
2014-10-15 04:36:04 -05:00
|
|
|
print $_;
|
2014-10-21 09:12:03 -05:00
|
|
|
STDOUT->flush();
|
2014-10-15 04:36:04 -05:00
|
|
|
}
|
|
|
|
}
|