Repository: servo/servo
File: ports/servoshell/egl/android/mod.rs (Rust)

Code before:
            return;
        };
        env.call_method(
            self.callbacks.as_obj(),
            "onUrlChanged",
            "(Ljava/lang/String;)V",
            &[(&url_string).into()],
        )
        .unwrap();
    }

    fn on_history_changed(&self, can_go_back: bool, can_go_forward: bool) {
        debug!("on_history_changed");
        let mut env = self.jvm.get_env().unwrap();
        let can_go_back = JValue::Bool(can_go_back as jboolean);
        let can_go_forward = JValue::Bool(can_go_forward as jboolean);
        env.call_method(
            self.callbacks.as_obj(),
            "onHistoryChanged",
            "(ZZ)V",
            &[can_go_back, can_go_forward],
        )
        .unwrap();
    }

    fn on_ime_show(&self, control: InputMethodControl) {
        let mut env = self.jvm.get_env().unwrap();
        env.call_method(self.callbacks.as_obj(), "onImeShow", "()V", &[])
            .unwrap();
    }

    fn on_ime_hide(&self) {
        let mut env = self.jvm.get_env().unwrap();
        env.call_method(self.callbacks.as_obj(), "onImeHide", "()V", &[])
            .unwrap();
    }

    fn on_media_session_metadata(&self, title: String, artist: String, album: String) {
        info!("on_media_session_metadata");
        let mut env = self.jvm.get_env().unwrap();
        let Ok(title) = new_string_as_jvalue(&mut env, &title) else {
            return;
        };

        let Ok(artist) = new_string_as_jvalue(&mut env, &artist) else {
            return;
        };

        let Ok(album) = new_string_as_jvalue(&mut env, &album) else {
            return;
        };

Review comment (suggestion):
I think this can be reverted:

```suggestion
    fn on_ime_show(&self, _: InputMethodControl) {
```

Code after:
            return;
        };
        env.call_method(
            self.callbacks.as_obj(),
            "onUrlChanged",
            "(Ljava/lang/String;)V",
            &[(&url_string).into()],
        )
        .unwrap();
    }

    fn on_history_changed(&self, can_go_back: bool, can_go_forward: bool) {
        debug!("on_history_changed");
        let mut env = self.jvm.get_env().unwrap();
        let can_go_back = JValue::Bool(can_go_back as jboolean);
        let can_go_forward = JValue::Bool(can_go_forward as jboolean);
        env.call_method(
            self.callbacks.as_obj(),
            "onHistoryChanged",
            "(ZZ)V",
            &[can_go_back, can_go_forward],
        )
        .unwrap();
    }

    fn on_ime_show(&self, _: InputMethodControl) {
        let mut env = self.jvm.get_env().unwrap();
        env.call_method(self.callbacks.as_obj(), "onImeShow", "()V", &[])
            .unwrap();
    }

    fn on_ime_hide(&self) {
        let mut env = self.jvm.get_env().unwrap();
        env.call_method(self.callbacks.as_obj(), "onImeHide", "()V", &[])
            .unwrap();
    }

    fn on_media_session_metadata(&self, title: String, artist: String, album: String) {
        info!("on_media_session_metadata");
        let mut env = self.jvm.get_env().unwrap();
        let Ok(title) = new_string_as_jvalue(&mut env, &title) else {
            return;
        };

        let Ok(artist) = new_string_as_jvalue(&mut env, &artist) else {
            return;
        };

        let Ok(album) = new_string_as_jvalue(&mut env, &album) else {
            return;
        };