Android-cuttlefish cvd tool
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
cuttlefish::confui Namespace Reference

Namespaces

namespace  anonymous_namespace{host_server.cc}
 
namespace  anonymous_namespace{protocol.cpp}
 
namespace  anonymous_namespace{secure_input.cc}
 
namespace  anonymous_namespace{sign.cc}
 
namespace  packet
 
namespace  support
 
namespace  thread
 

Classes

class  Cbor
 
class  ConfUiAckMessage
 
class  ConfUiCliResponseMessage
 
class  ConfUiGenericMessage
 
class  ConfUiMessage
 
class  ConfUiRenderer
 
class  ConfUiRendererImpl
 
class  ConfUiSecureUserSelectionMessage
 
class  ConfUiSecureUserTouchMessage
 
class  ConfUiStartMessage
 
class  ConfUiUserSelectionMessage
 
class  ConfUiUserTouchMessage
 
class  HMacImplementation
 
struct  HostError
 
class  HostServer
 
class  HostVirtualInput
 
class  HostVirtualInputEventSink
 
struct  PipeConnectionPair
 
class  Session
 
struct  SignRawMessage
 
class  TeeUiFrameWrapper
 
struct  UserResponse
 

Typedefs

using ConfUiAbortMessage = ConfUiGenericMessage< ConfUiCmd::kAbort >
 
using ConfUiStopMessage = ConfUiGenericMessage< ConfUiCmd::kStop >
 
using TeeUiFrame = std::vector< std::uint32_t >
 

Enumerations

enum class  ConfUiCmd : std::uint32_t {
  kUnknown = 100 , kStart = 111 , kStop = 112 , kCliAck = 113 ,
  kCliRespond = 114 , kAbort = 115 , kUserInputEvent = 200 , kUserTouchEvent = 201
}
 
enum class  SignMessageError : std::uint8_t { kOk = 0 , kUnknownError = 1 }
 
enum class  ConfUiKeys : std::uint32_t { Confirm = 7 , Cancel = 8 }
 
enum class  MainLoopState : std::uint32_t {
  kInit = 1 , kInSession = 2 , kWaitStop = 3 , kAwaitCleanup = 5 ,
  kTerminated = 8 , kInvalid = 9
}
 
enum class  FsmInput : std::uint32_t {
  kUserEvent = 1 , kHalStart , kHalStop , kHalAbort ,
  kHalUnknown
}
 
enum class  TestKeyBits : uint8_t { BYTE = 165 }
 

Functions

std::string ToString (const ConfUiMessage &msg)
 
std::unique_ptr< ConfUiMessageRecvConfUiMsg (SharedFD fd)
 
std::unique_ptr< ConfUiMessageRecvConfUiMsg (const std::string &session_id, SharedFD fd)
 
bool SendAbortCmd (SharedFD fd, const std::string &session_id)
 
bool SendStopCmd (SharedFD fd, const std::string &session_id)
 
bool SendAck (SharedFD fd, const std::string &session_id, const bool is_success, const std::string &status_message)
 
bool SendResponse (SharedFD fd, const std::string &session_id, const UserResponse::type &plain_selection, const std::vector< std::uint8_t > &signed_response, const std::vector< std::uint8_t > &message)
 
bool SendStartCmd (SharedFD fd, const std::string &session_id, const std::string &prompt_text, const std::vector< std::uint8_t > &extra_data, const std::string &locale, const std::vector< teeui::UIOption > &ui_opts)
 
bool SendUserSelection (SharedFD fd, const std::string &session_id, const UserResponse::type &confirm_cancel)
 
std::string ToDebugString (const ConfUiCmd &cmd, const bool is_verbose)
 
std::string ToString (const ConfUiCmd &cmd)
 
ConfUiCmd ToCmd (std::uint32_t i)
 
ConfUiCmd ToCmd (const std::string &cmd_str)
 
std::string ToString (const teeui::UIOption ui_opt)
 
std::optional< teeui::UIOptionToUiOption (const std::string &src)
 
template<typename T >
static std::string ByteVecToString (const std::vector< T > &v)
 
template<typename Delim , typename... Args>
std::string ArgsToStringWithDelim (Delim &&delim, Args &&... args)
 
template<typename... Args>
std::string ArgsToString (Args &&... args)
 
bool IsOnlyDigits (const std::string &src)
 
static teeui::Color alfaCombineChannel (std::uint32_t shift, double alfa, teeui::Color a, teeui::Color b)
 
static int GetDpi (int display_num=0)
 
static std::unique_ptr< ConfUiMessageWrapWithSecureFlag (std::unique_ptr< ConfUiMessage > &&base_msg, const bool secure)
 
static bool IsUserAbort (ConfUiMessage &msg)
 
std::unique_ptr< ConfUiSecureUserSelectionMessageToSecureSelectionMessage (std::unique_ptr< ConfUiUserSelectionMessage > &&msg, const bool secure)
 
std::unique_ptr< ConfUiSecureUserTouchMessageToSecureTouchMessage (std::unique_ptr< ConfUiUserTouchMessage > &&msg, const bool secure)
 
FsmInput ToFsmInput (const ConfUiMessage &msg)
 
std::string ToString (FsmInput input)
 
std::string ToString (const MainLoopState &state)
 
std::unique_ptr< ConfUiMessageCreateFromUserSelection (const std::string &session_id, const UserResponse::type user_selection)
 
static std::chrono::milliseconds GetGracePeriod ()
 
std::optional< std::vector< std::uint8_t > > TestSign (const std::vector< std::uint8_t > &message)
 
std::optional< std::vector< std::uint8_t > > Sign (const std::vector< std::uint8_t > &message)
 

Variables

constexpr auto SESSION_ANY = ""
 
constexpr const ssize_t kMaxMessageLength = packet::kMaxPayloadLength
 

Typedef Documentation

◆ ConfUiAbortMessage

◆ ConfUiStopMessage

◆ TeeUiFrame

using cuttlefish::confui::TeeUiFrame = typedef std::vector<std::uint32_t>

Enumeration Type Documentation

◆ ConfUiCmd

enum class cuttlefish::confui::ConfUiCmd : std::uint32_t
strong
Enumerator
kUnknown 
kStart 
kStop 
kCliAck 
kCliRespond 
kAbort 
kUserInputEvent 
kUserTouchEvent 

◆ ConfUiKeys

enum class cuttlefish::confui::ConfUiKeys : std::uint32_t
strong
Enumerator
Confirm 
Cancel 

◆ FsmInput

enum class cuttlefish::confui::FsmInput : std::uint32_t
strong
Enumerator
kUserEvent 
kHalStart 
kHalStop 
kHalAbort 
kHalUnknown 

◆ MainLoopState

enum class cuttlefish::confui::MainLoopState : std::uint32_t
strong
Enumerator
kInit 
kInSession 
kWaitStop 
kAwaitCleanup 
kTerminated 
kInvalid 

◆ SignMessageError

enum class cuttlefish::confui::SignMessageError : std::uint8_t
strong
Enumerator
kOk 
kUnknownError 

◆ TestKeyBits

enum class cuttlefish::confui::TestKeyBits : uint8_t
strong

The test key is 32byte word with all bytes set to TestKeyBits::BYTE.

Enumerator
BYTE 

Function Documentation

◆ alfaCombineChannel()

static teeui::Color cuttlefish::confui::alfaCombineChannel ( std::uint32_t  shift,
double  alfa,
teeui::Color  a,
teeui::Color  b 
)
static

◆ ArgsToString()

template<typename... Args>
std::string cuttlefish::confui::ArgsToString ( Args &&...  args)

◆ ArgsToStringWithDelim()

template<typename Delim , typename... Args>
std::string cuttlefish::confui::ArgsToStringWithDelim ( Delim &&  delim,
Args &&...  args 
)

◆ ByteVecToString()

template<typename T >
static std::string cuttlefish::confui::ByteVecToString ( const std::vector< T > &  v)
static

◆ CreateFromUserSelection()

std::unique_ptr< ConfUiMessage > cuttlefish::confui::CreateFromUserSelection ( const std::string &  session_id,
const UserResponse::type  user_selection 
)

◆ GetDpi()

static int cuttlefish::confui::GetDpi ( int  display_num = 0)
static

◆ GetGracePeriod()

static std::chrono::milliseconds cuttlefish::confui::GetGracePeriod ( )
static

return grace period + alpha

grace period is the gap between user seeing the dialog and the UI starts to take the user inputs Grace period should be at least 1s. Session requests the Renderer to render the dialog, but it might not be immediate. So, add alpha to 1s

◆ IsOnlyDigits()

bool cuttlefish::confui::IsOnlyDigits ( const std::string &  src)
inline

◆ IsUserAbort()

static bool cuttlefish::confui::IsUserAbort ( ConfUiMessage msg)
static

◆ RecvConfUiMsg() [1/2]

std::unique_ptr< ConfUiMessage > cuttlefish::confui::RecvConfUiMsg ( const std::string &  session_id,
SharedFD  fd 
)

◆ RecvConfUiMsg() [2/2]

std::unique_ptr< ConfUiMessage > cuttlefish::confui::RecvConfUiMsg ( SharedFD  fd)

◆ SendAbortCmd()

bool cuttlefish::confui::SendAbortCmd ( SharedFD  fd,
const std::string &  session_id 
)

◆ SendAck()

bool cuttlefish::confui::SendAck ( SharedFD  fd,
const std::string &  session_id,
const bool  is_success,
const std::string &  status_message 
)

◆ SendResponse()

bool cuttlefish::confui::SendResponse ( SharedFD  fd,
const std::string &  session_id,
const UserResponse::type plain_selection,
const std::vector< std::uint8_t > &  signed_response,
const std::vector< std::uint8_t > &  message 
)

◆ SendStartCmd()

bool cuttlefish::confui::SendStartCmd ( SharedFD  fd,
const std::string &  session_id,
const std::string &  prompt_text,
const std::vector< std::uint8_t > &  extra_data,
const std::string &  locale,
const std::vector< teeui::UIOption > &  ui_opts 
)

◆ SendStopCmd()

bool cuttlefish::confui::SendStopCmd ( SharedFD  fd,
const std::string &  session_id 
)

◆ SendUserSelection()

bool cuttlefish::confui::SendUserSelection ( SharedFD  fd,
const std::string &  session_id,
const UserResponse::type confirm_cancel 
)

◆ Sign()

std::optional< std::vector< std::uint8_t > > cuttlefish::confui::Sign ( const std::vector< std::uint8_t > &  message)

◆ TestSign()

std::optional< std::vector< std::uint8_t > > cuttlefish::confui::TestSign ( const std::vector< std::uint8_t > &  message)

◆ ToCmd() [1/2]

ConfUiCmd cuttlefish::confui::ToCmd ( const std::string &  cmd_str)

◆ ToCmd() [2/2]

ConfUiCmd cuttlefish::confui::ToCmd ( std::uint32_t  i)

◆ ToDebugString()

std::string cuttlefish::confui::ToDebugString ( const ConfUiCmd cmd,
const bool  is_verbose 
)

◆ ToFsmInput()

FsmInput cuttlefish::confui::ToFsmInput ( const ConfUiMessage msg)

◆ ToSecureSelectionMessage()

std::unique_ptr< ConfUiSecureUserSelectionMessage > cuttlefish::confui::ToSecureSelectionMessage ( std::unique_ptr< ConfUiUserSelectionMessage > &&  msg,
const bool  secure 
)

◆ ToSecureTouchMessage()

std::unique_ptr< ConfUiSecureUserTouchMessage > cuttlefish::confui::ToSecureTouchMessage ( std::unique_ptr< ConfUiUserTouchMessage > &&  msg,
const bool  secure 
)

◆ ToString() [1/5]

std::string cuttlefish::confui::ToString ( const ConfUiCmd cmd)

◆ ToString() [2/5]

std::string cuttlefish::confui::ToString ( const ConfUiMessage msg)

◆ ToString() [3/5]

std::string cuttlefish::confui::ToString ( const MainLoopState state)

◆ ToString() [4/5]

std::string cuttlefish::confui::ToString ( const teeui::UIOption  ui_opt)

◆ ToString() [5/5]

std::string cuttlefish::confui::ToString ( FsmInput  input)

◆ ToUiOption()

std::optional< teeui::UIOption > cuttlefish::confui::ToUiOption ( const std::string &  src)

◆ WrapWithSecureFlag()

static std::unique_ptr< ConfUiMessage > cuttlefish::confui::WrapWithSecureFlag ( std::unique_ptr< ConfUiMessage > &&  base_msg,
const bool  secure 
)
static

null if not user/touch, or wrap it and ConfUiSecure{Selection,Touch}Message

ConfUiMessage must NOT ConfUiSecure{Selection,Touch}Message types

Variable Documentation

◆ kMaxMessageLength

constexpr const ssize_t cuttlefish::confui::kMaxMessageLength = packet::kMaxPayloadLength
constexpr

◆ SESSION_ANY

constexpr auto cuttlefish::confui::SESSION_ANY = ""
constexpr