Log to logcat.

Bug: 182159441
Test: Ran on VIM3L
Change-Id: I9336cd6fea2f94d5b8924d94544cd84b1925dd26
This commit is contained in:
Andrew Walbran 2021-03-15 16:54:09 +00:00
parent bba7e174c8
commit bf1fb04f23
2 changed files with 8 additions and 3 deletions

View File

@ -9,7 +9,7 @@ rust_binary {
edition: "2018",
rustlibs: [
"android.system.virtmanager-rust",
"libenv_logger",
"libandroid_logger",
"liblog_rust",
"libserde_json",
"libserde",

View File

@ -21,17 +21,22 @@ mod crosvm;
use crate::aidl::{VirtManager, BINDER_SERVICE_IDENTIFIER};
use android_system_virtmanager::aidl::android::system::virtmanager::IVirtManager::BnVirtManager;
use android_system_virtmanager::binder::{add_service, ProcessState};
use log::info;
use log::{info, Level};
/// The first CID to assign to a guest VM managed by the Virt Manager. CIDs lower than this are
/// reserved for the host or other usage.
const FIRST_GUEST_CID: Cid = 10;
const LOG_TAG: &str = "VirtManager";
/// The unique ID of a VM used (together with a port number) for vsock communication.
type Cid = u32;
fn main() {
env_logger::init();
android_logger::init_once(android_logger::Config::default().with_tag(LOG_TAG).with_min_level(
if env!("TARGET_BUILD_VARIANT") == "user" { Level::Info } else { Level::Trace },
));
let virt_manager = VirtManager::default();
let virt_manager = BnVirtManager::new_binder(virt_manager);
add_service(BINDER_SERVICE_IDENTIFIER, virt_manager.as_binder()).unwrap();