Android-cuttlefish cvd tool
Classes | Public Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
cuttlefish::confui::ConfUiRendererImpl Class Reference
Collaboration diagram for cuttlefish::confui::ConfUiRendererImpl:
Collaboration graph
[legend]

Classes

struct  Boundary
 

Public Types

using LabelConfMsg = teeui::LabelBody
 

Private Member Functions

std::unique_ptr< TeeUiFrameWrapper > & RenderRawFrame ()
 
bool IsFrameReady () const
 
bool IsInConfirm (std::uint32_t x, std::uint32_t y)
 
bool IsInCancel (std::uint32_t x, std::uint32_t y)
 
bool IsSetUpSuccessful () const
 
 ConfUiRendererImpl (std::uint32_t display, const std::string &confirmation_msg, const std::string &locale, bool inverted, bool magnified)
 
template<typename LayoutElement >
Boundary GetBoundary (LayoutElement &&e) const
 
template<typename Element >
bool IsInside (std::uint32_t x, std::uint32_t y) const
 
std::unique_ptr< TeeUiFrameWrapperRepaintRawFrame (int w, int h)
 
bool InitLayout (const std::string &lang_id)
 
teeui::Error UpdateTranslations ()
 
teeui::Error UpdateLocale ()
 
void SetDeviceContext (unsigned long long w, unsigned long long h, bool is_inverted, bool is_magnified)
 
teeui::Error UpdatePixels (TeeUiFrameWrapper &raw_frame, std::uint32_t x, std::uint32_t y, teeui::Color color)
 
void UpdateColorScheme (bool is_inverted)
 
template<typename Label >
auto SetText (const std::string &text)
 
template<typename Label >
teeui::Error UpdateString ()
 

Static Private Member Functions

static Result< std::unique_ptr< ConfUiRendererImpl > > GenerateRenderer (std::uint32_t display, const std::string &confirmation_msg, const std::string &locale, bool inverted, bool magnified)
 
template<typename... Elements>
static teeui::Error drawElements (std::tuple< Elements... > &layout, const teeui::PixelDrawer &drawPixel)
 

Private Attributes

std::uint32_t display_num_
 
teeui::layout_t< teeui::ConfUILayout > layout_
 
std::string lang_id_
 
std::string prompt_text_
 
std::unique_ptr< TeeUiFrameWrapperraw_frame_
 
std::uint32_t current_height_
 
std::uint32_t current_width_
 
teeui::Color color_bg_
 
teeui::Color color_text_
 
teeui::Color shield_color_
 
bool is_inverted_
 
bool is_magnified_
 
teeui::context< teeui::ConfUIParameters > ctx_
 
bool is_setup_well_
 

Static Private Attributes

static constexpr const teeui::Color kColorBackground = 0xffffffff
 
static constexpr const teeui::Color kColorBackgroundInv = 0xff212121
 
static constexpr const teeui::Color kColorDisabled = 0xffbdbdbd
 
static constexpr const teeui::Color kColorDisabledInv = 0xff424242
 
static constexpr const teeui::Color kColorEnabled = 0xff212121
 
static constexpr const teeui::Color kColorEnabledInv = 0xffdedede
 
static constexpr const teeui::Color kColorShield = 0xff778500
 
static constexpr const teeui::Color kColorShieldInv = 0xffc4cb80
 
static constexpr const teeui::Color kColorText = 0xff212121
 
static constexpr const teeui::Color kColorTextInv = 0xffdedede
 

Friends

class ConfUiRenderer
 

Detailed Description

create a raw frame for confirmation UI dialog

Many rendering code borrowed from the following source https://android.googlesource.com/trusty/app/confirmationui/+/0429cc7/src

Member Typedef Documentation

◆ LabelConfMsg

Constructor & Destructor Documentation

◆ ConfUiRendererImpl()

cuttlefish::confui::ConfUiRendererImpl::ConfUiRendererImpl ( std::uint32_t  display,
const std::string &  confirmation_msg,
const std::string &  locale,
bool  inverted,
bool  magnified 
)
private

device configuration

ctx_{# of pixels in 1 mm, # of pixels per 1 density independent pixels}

The numbers are, however, to fit for the host webRTC local/remote clients in general, not necessarily the supposedly guest device (e.g. Auto, phone, etc)

In general, for a normal PC, roughly ctx_(6.45211, 400.0/412.0) is a good combination for the default DPI, 320. If we want to see the impact of the change in the guest DPI, we could adjust the combination above proportionally

Member Function Documentation

◆ drawElements()

template<typename... Elements>
static teeui::Error cuttlefish::confui::ConfUiRendererImpl::drawElements ( std::tuple< Elements... > &  layout,
const teeui::PixelDrawer drawPixel 
)
inlinestaticprivate

◆ GenerateRenderer()

Result< std::unique_ptr< ConfUiRendererImpl > > cuttlefish::confui::ConfUiRendererImpl::GenerateRenderer ( std::uint32_t  display,
const std::string &  confirmation_msg,
const std::string &  locale,
bool  inverted,
bool  magnified 
)
staticprivate

◆ GetBoundary()

template<typename LayoutElement >
Boundary cuttlefish::confui::ConfUiRendererImpl::GetBoundary ( LayoutElement &&  e) const
inlineprivate

◆ InitLayout()

bool cuttlefish::confui::ConfUiRendererImpl::InitLayout ( const std::string &  lang_id)
private

◆ IsFrameReady()

bool cuttlefish::confui::ConfUiRendererImpl::IsFrameReady ( ) const
inlineprivate

◆ IsInCancel()

bool cuttlefish::confui::ConfUiRendererImpl::IsInCancel ( std::uint32_t  x,
std::uint32_t  y 
)
inlineprivate

◆ IsInConfirm()

bool cuttlefish::confui::ConfUiRendererImpl::IsInConfirm ( std::uint32_t  x,
std::uint32_t  y 
)
inlineprivate

◆ IsInside()

template<typename Element >
bool cuttlefish::confui::ConfUiRendererImpl::IsInside ( std::uint32_t  x,
std::uint32_t  y 
) const
inlineprivate

◆ IsSetUpSuccessful()

bool cuttlefish::confui::ConfUiRendererImpl::IsSetUpSuccessful ( ) const
inlineprivate

◆ RenderRawFrame()

std::unique_ptr< TeeUiFrameWrapper > & cuttlefish::confui::ConfUiRendererImpl::RenderRawFrame ( )
private

this does not repaint from the scratch all the time

It does repaint its frame buffer only when w/h of current display has changed

◆ RepaintRawFrame()

std::unique_ptr< TeeUiFrameWrapper > cuttlefish::confui::ConfUiRendererImpl::RepaintRawFrame ( int  w,
int  h 
)
private

should be uint32_t for teeui APIs. It assumes that each raw frame buffer element is 4 bytes

◆ SetDeviceContext()

void cuttlefish::confui::ConfUiRendererImpl::SetDeviceContext ( unsigned long long  w,
unsigned long long  h,
bool  is_inverted,
bool  is_magnified 
)
private

◆ SetText()

template<typename Label >
auto cuttlefish::confui::ConfUiRendererImpl::SetText ( const std::string &  text)
inlineprivate

◆ UpdateColorScheme()

void cuttlefish::confui::ConfUiRendererImpl::UpdateColorScheme ( bool  is_inverted)
private

◆ UpdateLocale()

teeui::Error cuttlefish::confui::ConfUiRendererImpl::UpdateLocale ( )
private

◆ UpdatePixels()

teeui::Error cuttlefish::confui::ConfUiRendererImpl::UpdatePixels ( TeeUiFrameWrapper raw_frame,
std::uint32_t  x,
std::uint32_t  y,
teeui::Color  color 
)
private

◆ UpdateString()

template<typename Label >
teeui::Error cuttlefish::confui::ConfUiRendererImpl::UpdateString
private

◆ UpdateTranslations()

teeui::Error cuttlefish::confui::ConfUiRendererImpl::UpdateTranslations ( )
private

Friends And Related Function Documentation

◆ ConfUiRenderer

friend class ConfUiRenderer
friend

Member Data Documentation

◆ color_bg_

teeui::Color cuttlefish::confui::ConfUiRendererImpl::color_bg_
private

◆ color_text_

teeui::Color cuttlefish::confui::ConfUiRendererImpl::color_text_
private

◆ ctx_

teeui::context<teeui::ConfUIParameters> cuttlefish::confui::ConfUiRendererImpl::ctx_
private

◆ current_height_

std::uint32_t cuttlefish::confui::ConfUiRendererImpl::current_height_
private

◆ current_width_

std::uint32_t cuttlefish::confui::ConfUiRendererImpl::current_width_
private

◆ display_num_

std::uint32_t cuttlefish::confui::ConfUiRendererImpl::display_num_
private

◆ is_inverted_

bool cuttlefish::confui::ConfUiRendererImpl::is_inverted_
private

◆ is_magnified_

bool cuttlefish::confui::ConfUiRendererImpl::is_magnified_
private

◆ is_setup_well_

bool cuttlefish::confui::ConfUiRendererImpl::is_setup_well_
private

◆ kColorBackground

constexpr const teeui::Color cuttlefish::confui::ConfUiRendererImpl::kColorBackground = 0xffffffff
staticconstexprprivate

◆ kColorBackgroundInv

constexpr const teeui::Color cuttlefish::confui::ConfUiRendererImpl::kColorBackgroundInv = 0xff212121
staticconstexprprivate

◆ kColorDisabled

constexpr const teeui::Color cuttlefish::confui::ConfUiRendererImpl::kColorDisabled = 0xffbdbdbd
staticconstexprprivate

◆ kColorDisabledInv

constexpr const teeui::Color cuttlefish::confui::ConfUiRendererImpl::kColorDisabledInv = 0xff424242
staticconstexprprivate

◆ kColorEnabled

constexpr const teeui::Color cuttlefish::confui::ConfUiRendererImpl::kColorEnabled = 0xff212121
staticconstexprprivate

◆ kColorEnabledInv

constexpr const teeui::Color cuttlefish::confui::ConfUiRendererImpl::kColorEnabledInv = 0xffdedede
staticconstexprprivate

◆ kColorShield

constexpr const teeui::Color cuttlefish::confui::ConfUiRendererImpl::kColorShield = 0xff778500
staticconstexprprivate

◆ kColorShieldInv

constexpr const teeui::Color cuttlefish::confui::ConfUiRendererImpl::kColorShieldInv = 0xffc4cb80
staticconstexprprivate

◆ kColorText

constexpr const teeui::Color cuttlefish::confui::ConfUiRendererImpl::kColorText = 0xff212121
staticconstexprprivate

◆ kColorTextInv

constexpr const teeui::Color cuttlefish::confui::ConfUiRendererImpl::kColorTextInv = 0xffdedede
staticconstexprprivate

◆ lang_id_

std::string cuttlefish::confui::ConfUiRendererImpl::lang_id_
private

◆ layout_

teeui::layout_t<teeui::ConfUILayout> cuttlefish::confui::ConfUiRendererImpl::layout_
private

◆ prompt_text_

std::string cuttlefish::confui::ConfUiRendererImpl::prompt_text_
private

◆ raw_frame_

std::unique_ptr<TeeUiFrameWrapper> cuttlefish::confui::ConfUiRendererImpl::raw_frame_
private

Potentially, the same frame could be requested multiple times.

While another thread/caller is using this frame, the frame should be kept here, too, to be returned upon future requests.

◆ shield_color_

teeui::Color cuttlefish::confui::ConfUiRendererImpl::shield_color_
private

The documentation for this class was generated from the following file: