Closing application once the task is done
This commit is contained in:
parent
9249d49d54
commit
33230ba98e
18
atf.inc.php
18
atf.inc.php
|
@ -179,14 +179,28 @@ function get_ext_status_async(string $atf_host, string $device, int $timeout = 2
|
|||
});
|
||||
}
|
||||
|
||||
function stop_app_async(string $atf_host, string $device) : Amp\Promise
|
||||
{
|
||||
return Amp\call(function() use($atf_host, $device) {
|
||||
yield host_exec_async($atf_host, "%{adb}% -s $device shell am force-stop %{package_id}%", DEPLOY_OPT_ERR_OK, 30);
|
||||
});
|
||||
}
|
||||
|
||||
function start_app_async(string $atf_host, string $device) : Amp\Promise
|
||||
{
|
||||
return Amp\call(function() use($atf_host, $device) {
|
||||
yield host_exec_async($atf_host, "%{adb}% -s $device shell am start -n %{package_id}%/%{activity}%", 0, 30);
|
||||
});
|
||||
}
|
||||
|
||||
function start_ext_cmd_on_device_async(string $atf_host, string $device, Cmd $cmd, array $cmd_args) : Amp\Promise
|
||||
{
|
||||
return Amp\call(function() use($atf_host, $device, $cmd, $cmd_args) {
|
||||
|
||||
yield device_del_file_async($atf_host, $device, 'atf_status.js', DEPLOY_OPT_ERR_OK);
|
||||
yield host_exec_async($atf_host, "%{adb}% -s $device shell am force-stop %{package_id}%", DEPLOY_OPT_ERR_OK, 30);
|
||||
yield stop_app_async($atf_host, $device);
|
||||
yield update_ext_cmd_async($atf_host, $device, $cmd, $cmd_args);
|
||||
yield host_exec_async($atf_host, "%{adb}% -s $device shell am start -n %{package_id}%/%{activity}%", 0, 30);
|
||||
yield start_app_async($atf_host, $device);
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
@ -277,6 +277,10 @@ class Plan
|
|||
{
|
||||
//let's reset bogus stats for this device
|
||||
$this->session->resetBogusDeviceCount($task->device);
|
||||
|
||||
//let's quit the application once the task is done
|
||||
yield stop_app_async($this->session->conf->atf_host, $task->device);
|
||||
|
||||
//let's free the device
|
||||
$task->device = null;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue