GuiApi

Struct GuiApi 

Source
pub struct GuiApi<P: CheckedPermissions> { /* private fields */ }
Expand description

Full GUI API, usable by GUI apps

Implementations§

Source§

impl<P: CheckedPermissions> GuiApi<P>

Source

pub fn navigate_finish(&self, response: Vec<u8>) -> Result<(), GuiServerError>

Permission: os/gui-server / FinishResponse

Groups: ui-and-input.navigation

Sender policy: signed

Grant timing: install-review

Source

pub fn navigate_cancel(&self) -> Result<(), GuiServerError>

Permission: os/gui-server / NavigationCancel

Groups: ui-and-input.navigation

Sender policy: signed

Grant timing: install-review

Source

pub fn navigate_pending(&self) -> Result<Option<Vec<u8>>, GuiServerError>

Permission: os/gui-server / GetPendingNavRequest

Groups: ui-and-input.navigation

Sender policy: signed

Grant timing: install-review

Source§

impl<P: CheckedPermissions> GuiApi<P>

Source

pub fn register(name: &str, height: usize) -> Result<Self, GuiServerError>

Permission: os/gui-server / RegisterAppMessage

Groups: ui-and-input.app-surface

Sender policy: signed

Grant timing: install-review

Registers an ordinary app window.

Source

pub fn register_control_center(height: usize) -> Result<Self, GuiServerError>

Permission: os/gui-server / RegisterControlCenter

Groups: TBD

Sender policy: TBD

Grant timing: TBD

Registers as the control center, which gui-server tracks as a dedicated overlay window rather than an ordinary app.

Source

pub fn register_keyboard(height: usize) -> Result<Self, GuiServerError>

Permission: os/gui-server / RegisterKeyboard

Groups: TBD

Sender policy: TBD

Grant timing: TBD

Registers as the keyboard, which gui-server tracks as a dedicated overlay window rather than an ordinary app.

Source

pub fn register_with_role<M>( name: &str, height: usize, ) -> Result<Self, GuiServerError>

  • Permission: os/gui-server / RegisterAppMessage

    Groups: ui-and-input.app-surface

    Sender policy: signed

    Grant timing: install-review

  • Permission: TBD (MessageAllowed<M>)

    Groups: TBD

    Sender policy: TBD

    Grant timing: TBD

Claims a privileged role, then registers an ordinary app window. The role is granted per message type, so an app can only claim a role its manifest permits.

Source

pub fn sid(&self) -> SID

Permission: none

Source

pub fn submit_frame(&self, buffer: MemoryRange) -> Result<(), GuiServerError>

Permission: os/gui-server / SubmitFrame

Groups: ui-and-input.app-surface

Sender policy: signed

Grant timing: install-review

Submit a frame for display.

Source

pub fn show_camera(&self, y_pos: u16) -> Result<(), GuiServerError>

Permission: os/gui-server / ShowCamera

Groups: ui-and-input.navigation

Sender policy: signed

Grant timing: install-review

Source

pub fn hide_camera(&self) -> Result<(), GuiServerError>

Permission: os/gui-server / HideCamera

Groups: ui-and-input.navigation

Sender policy: signed

Grant timing: install-review

Source

pub fn update_keyboard(&self, msg: UpdateKeyboard) -> Result<(), GuiServerError>

Permission: os/gui-server / UpdateKeyboard

Groups: ui-and-input.app-surface

Sender policy: signed

Grant timing: install-review

Source

pub fn hide_keyboard(&self) -> Result<(), GuiServerError>

Permission: os/gui-server / HideKeyboard

Groups: ui-and-input.app-surface

Sender policy: signed

Grant timing: install-review

Source

pub fn notify_login_success(&self) -> Result<(), GuiServerError>

Permission: os/gui-server / LoginSuccess

Groups: ui-and-input.privileged-navigation

Sender policy: static-server

Grant timing: policy-only

Source

pub fn wake_event_loop(&self)

Permission: none

Source

pub fn request_redraw(&self) -> Result<(), GuiServerError>

Permission: os/gui-server / RequestRedraw

Groups: ui-and-input.app-surface

Sender policy: signed

Grant timing: install-review

Source

pub fn try_receive_input(&self) -> Option<(InputMessage, MessageEnvelope)>

Permission: none

Source

pub fn receive_input( &self, ) -> Result<(InputMessage, MessageEnvelope), GuiServerError>

Permission: none

Source

pub fn key_pressed(&self, key: Key) -> Result<(), GuiServerError>

Permission: os/gui-server / KeyPressed

Groups: ui-and-input.system-key-events

Sender policy: static-server

Grant timing: policy-only

Source

pub fn key_released(&self, key: Key) -> Result<(), GuiServerError>

Permission: os/gui-server / KeyReleased

Groups: ui-and-input.system-key-events

Sender policy: static-server

Grant timing: policy-only

Source

pub fn animate_next_frame( &self, animation_kind: NextFrameAnimationKind, ) -> Result<(), GuiServerError>

Permission: os/gui-server / AnimateNextFrame

Groups: ui-and-input.app-surface

Sender policy: signed

Grant timing: install-review

Methods from Deref<Target = GuiApiLight<P>>§

Source

pub fn show_modal( &self, app_id: AppId, modal_style: ModalStyle, args: &[u8], ) -> Result<NavigationResult, GuiServerError>

Permission: os/gui-server / ShowModal

Groups: ui-and-input.app-surface

Sender policy: signed

Grant timing: install-review

Shows a modal of the app, giving it a navigation object

Source

pub fn navigate_to( &self, app_id: AppId, args: &[u8], ) -> Result<NavigationResult, GuiServerError>

Permission: os/gui-server / NavigateTo

Groups: ui-and-input.navigation

Sender policy: signed

Grant timing: install-review

Source

pub fn run_app(&self, app_id: AppId) -> Result<RunAppResponse, GuiServerError>

Permission: os/gui-server / RunApp

Groups: ui-and-input.privileged-navigation

Sender policy: static-server

Grant timing: policy-only

Source

pub fn check_user_presence( &self, options: UserPresenceOptions, ) -> Result<Option<UserPresenceResult>, GuiServerError>

Permission: os/gui-server / NavigateTo

Groups: ui-and-input.navigation

Sender policy: signed

Grant timing: install-review

Source

pub fn invoke_alert( &self, alert: InvokeAlert, ) -> Result<AlertResult, GuiServerError>

Permission: os/gui-server / ShowModal

Groups: ui-and-input.app-surface

Sender policy: signed

Grant timing: install-review

Source

pub fn switch_to( &self, next_pid: PID, x: usize, y: usize, ) -> Result<(), GuiServerError>

Permission: os/gui-server / SwitchTo

Groups: ui-and-input.navigation

Sender policy: signed

Grant timing: install-review

Switches the focus to the app window of the given PID and the app zoom-in start position. Used by the app launcher, app switcher, and usb-debug protocol.

Source

pub fn switch_to_launcher(&self) -> Result<bool, GuiServerError>

Permission: os/gui-server / SwitchToLauncher

Groups: ui-and-input.navigation

Sender policy: signed

Grant timing: install-review

Switches the focus to the launcher app window. Used by apps.

Source

pub fn is_locked(&self) -> Result<bool, GuiServerError>

Permission: os/gui-server / IsLocked

Groups: TBD

Sender policy: TBD

Grant timing: TBD

Source

pub fn shutdown(&self) -> Result<(), GuiServerError>

Permission: os/gui-server / Shutdown

Groups: ui-and-input.capture-and-injection

Sender policy: static-server

Grant timing: policy-only

Source

pub fn reboot(&self) -> Result<(), GuiServerError>

Permission: os/gui-server / Shutdown

Groups: ui-and-input.capture-and-injection

Sender policy: static-server

Grant timing: policy-only

Source

pub fn close_app(&self, pid: PID) -> Result<(), GuiServerError>

Permission: os/gui-server / CloseApp

Groups: ui-and-input.navigation

Sender policy: signed

Grant timing: install-review

Closes the app window of the given PID. Used by the launcher, switcher, and usb-debug protocol to gracefully close apps.

Source

pub fn capture_screen(&self) -> Result<DropDeallocate, GuiServerError>

Permission: os/gui-server / CaptureScreen

Groups: ui-and-input.capture-and-injection

Sender policy: static-server

Grant timing: policy-only

Captures the current composited screen as raw pixel data. Returns a DropDeallocate of length FB_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT * 4) that auto-unmaps on drop. Dereferences to MemoryRange / &[u8].

Source

pub fn inject_touch(&self, touch: Touch) -> Result<(), GuiServerError>

Permission: os/gui-server / InjectTouch

Groups: ui-and-input.capture-and-injection

Sender policy: static-server

Grant timing: policy-only

Injects a touch event as if it came from the hardware touch controller.

Source

pub fn inject_key( &self, is_pressed: bool, key: Key, ) -> Result<(), GuiServerError>

Permission: os/gui-server / InjectKey

Groups: ui-and-input.capture-and-injection

Sender policy: static-server

Grant timing: policy-only

Injects a key press or release event into the active app.

Source

pub fn inject_power_button( &self, is_pressed: bool, ) -> Result<(), GuiServerError>

Permission: os/gui-server / InjectPowerButton

Groups: TBD

Sender policy: TBD

Grant timing: TBD

Injects a power button press or release into gui-server’s power-button state machine.

Source

pub fn update_kiosk_policy( &self, policy: UpdateKioskPolicy, ) -> Result<(), GuiServerError>

Permission: os/gui-server / UpdateKioskPolicy

Groups: TBD

Sender policy: TBD

Grant timing: TBD

Trait Implementations§

Source§

impl<P: Debug + CheckedPermissions> Debug for GuiApi<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: CheckedPermissions> Deref for GuiApi<P>

Source§

type Target = GuiApiLight<P>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<P: CheckedPermissions> Drop for GuiApi<P>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<P> Freeze for GuiApi<P>

§

impl<P> RefUnwindSafe for GuiApi<P>

§

impl<P> Send for GuiApi<P>

§

impl<P> Sync for GuiApi<P>

§

impl<P> Unpin for GuiApi<P>

§

impl<P> UnwindSafe for GuiApi<P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.