OHOS: Use native API to get most of the information needed for starting servoshell. (#37392)

Uses the native ohos-api crates to get the required information for
starting servoshell.
This increases the minimum API version requirement to API-14.

Testing: Tested on device.

---------

Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Co-authored-by: Jonathan Schwender <55576758+jschwe@users.noreply.github.com>
This commit is contained in:
Narfinger 2025-06-13 11:38:56 +02:00 committed by GitHub
parent 7a801f0ef5
commit 099fd10317
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 95 additions and 47 deletions

View file

@ -45,12 +45,8 @@ mod simpleservo;
#[derive(Debug)]
pub struct InitOpts {
pub url: String,
pub device_type: String,
pub os_full_name: String,
/// Path to application data bundled with the servo app, e.g. web-pages.
pub resource_dir: String,
pub cache_dir: String,
pub display_density: f64,
pub commandline_args: String,
}
@ -626,10 +622,6 @@ pub fn register_prompt_toast_callback(callback: Function<String, ()>) -> napi_oh
#[napi]
pub fn init_servo(init_opts: InitOpts) -> napi_ohos::Result<()> {
info!("Servo is being initialised with the following Options: ");
info!(
"Device Type: {}, DisplayDensity: {}",
init_opts.device_type, init_opts.display_density
);
info!("Initial URL: {}", init_opts.url);
let channel = if let Some(channel) = SERVO_CHANNEL.get() {
channel