Android-cuttlefish cvd tool
|
#include <host_server.h>
Public Member Functions | |
INJECT (HostServer(HostModeCtrl &host_mode_ctrl, ConfUiRenderer &host_renderer, const PipeConnectionPair &fd_pair)) | |
void | Start () |
virtual | ~HostServer () |
void | TouchEvent (const int x, const int y, const bool is_down) |
void | UserAbortEvent () |
Private Types | |
using | Multiplexer = Multiplexer< std::unique_ptr< ConfUiMessage >, ThreadSafeQueue< std::unique_ptr< ConfUiMessage > > > |
Private Member Functions | |
HostServer ()=delete | |
void | MainLoop () |
void | HalCmdFetcherLoop () |
bool | IsVirtioConsoleOpen () const |
bool | CheckVirtioConsole () |
std::shared_ptr< Session > | CreateSession (const std::string &session_name) |
void | SendUserSelection (std::unique_ptr< ConfUiMessage > &input) |
void | Transition (std::unique_ptr< ConfUiMessage > &input_ptr) |
std::string | GetCurrentSessionId () |
std::string | GetCurrentState () |
Private Attributes | |
const std::uint32_t | display_num_ |
ConfUiRenderer & | host_renderer_ |
HostModeCtrl & | host_mode_ctrl_ |
std::shared_ptr< Session > | curr_session_ |
SharedFD | from_guest_fifo_fd_ |
SharedFD | to_guest_fifo_fd_ |
Multiplexer | input_multiplexer_ |
int | hal_cmd_q_id_ |
int | user_input_evt_q_id_ |
std::thread | main_loop_thread_ |
std::thread | hal_input_fetcher_thread_ |
|
private |
|
inlinevirtual |
|
privatedelete |
|
private |
|
private |
|
inlineprivate |
|
inlineprivate |
|
private |
cuttlefish::confui::HostServer::INJECT | ( | HostServer(HostModeCtrl &host_mode_ctrl, ConfUiRenderer &host_renderer, const PipeConnectionPair &fd_pair) | ) |
|
private |
|
private |
basic prompt flow: (1) Without preemption send "kStart" with confirmation message wait kCliAck from the host service with the echoed command wait the confirmation/cancellation (or perhaps reset?) send kStop wait kCliAck from the host service with the echoed command
(2) With preemption (e.g.) send "kStart" with confirmation message wait kCliAck from the host service with the echoed command wait the confirmation/cancellation (or perhaps reset?) send kSuspend // when HAL is preempted send kRestore // when HAL resumes send kStop
From the host end, it is a close-to-Mealy FSM. There are four states S = {init, session, wait_ack, suspended}
'session' means in a confirmation session. 'wait_ack' means server sends the confirmation and waiting "stop" command from HAL 'suspended' means the HAL service is preemptied. So, the host should render the Android guest frames but keep the confirmation UI session and frame
The inputs are I = {u, g}. 'u' is the user input from webRTC clients. Note that the host service serialized the concurrent user inputs from multiple clients. 'g' is the command from the HAL service
The transition rules: (S, I) --> (S, O) where O is the output
init, g(start) --> session, set Conf UI mode, render a frame session, u(cancel/confirm) --> waitstop, send the result to HAL session, g(suspend) --> suspend, create a saved session session, g(abort) --> init, clear saved frame waitstop, g(stop) --> init, clear saved frame waitstop, g(suspend) --> suspend, no need to save the session waitstop, g(abort) --> init, clear saved frame suspend, g(restore) --> return to the saved state, restore if there's a saved session suspend, g(abort) --> init, clear saved frame
For now, we did not yet implement suspend or abort.
|
private |
Send inputs generated not by auto-tester but by the human users
Send such inputs into the command queue consumed by the state machine in the main loop/current session.
void cuttlefish::confui::HostServer::Start | ( | ) |
void cuttlefish::confui::HostServer::TouchEvent | ( | const int | x, |
const int | y, | ||
const bool | is_down | ||
) |
|
private |
void cuttlefish::confui::HostServer::UserAbortEvent | ( | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |