blob: 8c73c40227a5a5f1394d75b919f065239293e504 [file] [log] [blame]
Seungjae Yoo529d53c2024-05-14 14:36:18 +09001// Copyright 2024 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! Android Vmnic (Virtual Machine Network Interface Creator)
16
17mod aidl;
18
19use crate::aidl::Vmnic;
20use android_logger::Config;
21use android_system_virtualizationservice_internal::aidl::android::system::virtualizationservice_internal::IVmnic::{
22 BnVmnic,
23 BpVmnic,
24 IVmnic,
25};
26use binder::{register_lazy_service, BinderFeatures, ProcessState};
27use log::{info, LevelFilter};
28
29const LOG_TAG: &str = "Vmnic";
30
31fn main() {
32 android_logger::init_once(
33 Config::default()
34 .with_tag(LOG_TAG)
35 .with_max_level(LevelFilter::Info)
36 .with_log_buffer(android_logger::LogId::System),
37 );
38
39 let service = Vmnic::init();
40 let service = BnVmnic::new_binder(service, BinderFeatures::default());
41 register_lazy_service(<BpVmnic as IVmnic>::get_descriptor(), service.as_binder()).unwrap();
42 info!("Registered Binder service, joining threadpool.");
43 ProcessState::join_thread_pool();
44}