| 1 | package Android::ADB; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use 5.014000; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | our $VERSION = '0.001'; | |||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 1 | ▶ | use Android::ADB::Device; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 1 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 1 | ▶ | use File::Slurp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 1 | ▶ | use IPC::Open2; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||
| 15 | 0 | my ($class, %args) = @_; | |||||||||||||||||||
| 16 | 0 | ▶ | $args{path} //= $ENV{ADB}; | ||||||||||||||||||
|
Condition0%0/3
$args{"path"} //= $ENV{"ADB"}
MC/DC0%0/2
$args{"path"} //= $ENV{"ADB"}
$args{"path"}
$ENV{"ADB"}
Truth table0%0/3
A //= B
A= $args{"path"}B= $ENV{"ADB"}
| |||||||||||||||||||||
| 17 | 0 | ▶ | $args{path} //= 'adb'; | ||||||||||||||||||
|
Condition0%0/2
$args{"path"} //= "adb"
MC/DC0%0/1
$args{"path"} //= "adb"
$args{"path"}
Truth table0%0/2
A
A= $args{"path"}
| |||||||||||||||||||||
| 18 | 0 | ▶ | $args{args} //= []; | ||||||||||||||||||
|
Condition0%0/2
$args{"args"} //= []
MC/DC0%0/1
$args{"args"} //= []
$args{"args"}
Truth table0%0/2
A
A= $args{"args"}
| |||||||||||||||||||||
| 19 | 0 | bless \%args, $class | |||||||||||||||||||
| 20 | } | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | sub run { | ||||||||||||||||||
|
Subroutine
run: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 23 | 0 | my ($self, @args) = @_; | |||||||||||||||||||
| 24 | 0 | my ($out, $in); | |||||||||||||||||||
| 25 | 0 | ▶ | my @dev_args = $self->{device_serial} ? ('-s', $self->{device_serial}) : (); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | 0 | my $pid = open2 $out, $in, $self->{path}, @{$self->{args}}, @args; | |||||||||||||||||||
| 27 | 0 | my $result = read_file $out; | |||||||||||||||||||
| 28 | 0 | close $out; | |||||||||||||||||||
| 29 | 0 | close $in; | |||||||||||||||||||
| 30 | 0 | ▶ | waitpid $pid, 0 or croak "$!"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 31 | 0 | $result; | |||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 0 | ▶ | sub start_server { shift->run('start-server') } | ||||||||||||||||||
|
Subroutine
start_server: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 35 | 0 | ▶ | sub kill_server { shift->run('kill-server') } | ||||||||||||||||||
|
Subroutine
kill_server: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 0 | ▶ | sub connect { shift->run('connect', @_) } | ||||||||||||||||||
|
Subroutine
connect: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 38 | 0 | ▶ | sub disconnect { shift->run('disconnect', @_) } | ||||||||||||||||||
|
Subroutine
disconnect: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | ▶ | sub devices { | ||||||||||||||||||
|
Subroutine
devices: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||
| 41 | 0 | my @devices = split '\n', shift->run('devices', '-l'); | |||||||||||||||||||
| 42 | 0 | my @result; | |||||||||||||||||||
| 43 | 0 | for (@devices) { | |||||||||||||||||||
| 44 | 0 | ▶ | next if /^List of devices/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 45 | 0 | ▶ | next unless / /; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 46 | 0 | push @result, Android::ADB::Device->new(split) | |||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | @result | ||||||||||||||||||||
| 49 | 0 | } | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 0 | ▶ | sub set_device { | ||||||||||||||||||
|
Subroutine
set_device: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 52 | 0 | my ($self, $device) = @_; | |||||||||||||||||||
| 53 | 0 | $self->{device_serial} = $device->serial; | |||||||||||||||||||
| 54 | } | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 0 | ▶ | sub wait_for_device { shift->run('wait-for-device') } | ||||||||||||||||||
|
Subroutine
wait_for_device: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 57 | 0 | ▶ | sub get_state { shift->run('get-state') } | ||||||||||||||||||
|
Subroutine
get_state: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 58 | 0 | ▶ | sub get_serialno { shift->run('get-serialno') } | ||||||||||||||||||
|
Subroutine
get_serialno: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 59 | 0 | ▶ | sub get_devpath { shift->run('get-devpath') } | ||||||||||||||||||
|
Subroutine
get_devpath: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 60 | 0 | ▶ | sub remount { shift->run('remount') } | ||||||||||||||||||
|
Subroutine
remount: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 61 | 0 | ▶ | sub reboot { shift->run('reboot', @_) } | ||||||||||||||||||
|
Subroutine
reboot: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 62 | 0 | ▶ | sub reboot_bootloader { shift->run('reboot-bootloader') } | ||||||||||||||||||
|
Subroutine
reboot_bootloader: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 63 | 0 | ▶ | sub root { shift->run('root') } | ||||||||||||||||||
|
Subroutine
root: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 64 | 0 | ▶ | sub usb { shift->run('usb') } | ||||||||||||||||||
|
Subroutine
usb: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 65 | 0 | ▶ | sub tcpip { shift->run('tcpip', @_) } | ||||||||||||||||||
|
Subroutine
tcpip: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | 0 | ▶ | sub push { | ||||||||||||||||||
|
Subroutine
push: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 68 | 0 | my ($self, $local, $remote) = @_; | |||||||||||||||||||
| 69 | 0 | $self->run(push => $local, $remote) | |||||||||||||||||||
| 70 | } | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 0 | ▶ | sub pull { | ||||||||||||||||||
|
Subroutine
pull: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 73 | 0 | my ($self, $remote, $local) = @_; | |||||||||||||||||||
| 74 | 0 | $self->run(push => $remote, $local) | |||||||||||||||||||
| 75 | } | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | 0 | ▶ | sub pull_archive { | ||||||||||||||||||
|
Subroutine
pull_archive: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 78 | 0 | my ($self, $remote, $local) = @_; | |||||||||||||||||||
| 79 | 0 | $self->run(push => '-a', $remote, $local) | |||||||||||||||||||
| 80 | } | ||||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | 0 | ▶ | sub shell { shift->run(shell => @_) } | ||||||||||||||||||
|
Subroutine
shell: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | 1 | 1; | |||||||||||||||||||
| 85 | __END__ | ||||||||||||||||||||