mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
Update main.rs
This is how I'd do the app switch. It's a special case going to the shellchat. shellchat is aliased to `INITIAL_APP_FOCUS`, so you can refer to that constant directly in this call, instead of using a more generic app-lookup mechanism. Also, because the idea is that we can allow *anyone* to call this method, there are no authorization tokens to check, unlike the SwitchToApp call, which can allow arbitrary apps to be foregrounded. The security assumption is that "no harm" can be done if a malicious process can bring shellchat to the foreground. This might not be a good assumption, but, I can't think of a scenario where this helps someone trying to get control of a device.
This commit is contained in:
parent
371d058941
commit
e9b1e25ca4
1 changed files with 8 additions and 2 deletions
|
|
@ -665,8 +665,14 @@ fn wrapped_main() -> ! {
|
||||||
buffer.replace(spec).unwrap();
|
buffer.replace(spec).unwrap();
|
||||||
}
|
}
|
||||||
Some(Opcode::DefaultApp) => {
|
Some(Opcode::DefaultApp) => {
|
||||||
// FIXME: Switch to shellchat here
|
if let Some(new_app_token) = context_mgr.find_app_token_by_name(INITIAL_APP_FOCUS) {
|
||||||
log::error!("not implemented yet, switch to shellchat: {:?}", msg);
|
match context_mgr.activate(&gfx, &mut canvases, new_app_token, true) {
|
||||||
|
Ok(_) => (),
|
||||||
|
Err(_) => log::warn!("failed to switch to {}, silent error!", switchapp.app_name.as_str().unwrap()),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log::warn!("Request to switch to default app, but the default app has not registered itself yet!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Some(Opcode::Quit) => break,
|
Some(Opcode::Quit) => break,
|
||||||
None => {log::error!("unhandled message {:?}", msg);}
|
None => {log::error!("unhandled message {:?}", msg);}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue