Android: load url from Intent, plus fixed some warnings (#32160)

* update gitignore folder with android build files

* address some warnings

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* fix servo not loading url from Intent

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* format

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* InitOptions, added url field to avoid override homepage url

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* actually there is a gitignore file in the android folder

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

* Restore buildToolsVersion property

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24 2024-04-29 15:14:10 +02:00 committed by GitHub
parent 5a4c81f841
commit fe6e1cfb29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 50 additions and 66 deletions

View file

@ -73,7 +73,7 @@ pub extern "C" fn Java_org_mozilla_servoview_JNIServo_init(
callbacks_obj: JObject,
surface: JObject,
) {
let (mut opts, log, log_str, _gst_debug_str) = match get_options(&env, opts, surface) {
let (opts, log, log_str, _gst_debug_str) = match get_options(&env, opts, surface) {
Ok((opts, log, log_str, gst_debug_str)) => (opts, log, log_str, gst_debug_str),
Err(err) => {
throw(&env, &err);
@ -875,6 +875,7 @@ fn get_options(
let opts = InitOptions {
args: args.unwrap_or(vec![]),
url,
coordinates,
density,
xr_discovery: None,

View file

@ -52,6 +52,7 @@ pub use servo::embedder_traits::EventLoopWaker;
pub struct InitOptions {
pub args: Vec<String>,
pub url: Option<String>,
pub coordinates: Coordinates,
pub density: f32,
pub xr_discovery: Option<webxr::Discovery>,
@ -253,10 +254,11 @@ pub fn init(
args.insert(0, "servo".to_string());
opts::from_cmdline_args(Options::new(), &args);
let embedder_url = init_opts.url.as_ref().and_then(|s| ServoUrl::parse(s).ok());
let pref_url = ServoUrl::parse(&pref!(shell.homepage)).ok();
let blank_url = ServoUrl::parse("about:blank").ok();
let url = pref_url.or(blank_url).unwrap();
let url = embedder_url.or(pref_url).or(blank_url).unwrap();
gl.clear_color(1.0, 1.0, 1.0, 1.0);
gl.clear(gl::COLOR_BUFFER_BIT);