1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 //! This implements the MediaQuality Example Service. 17 use android_hardware_tv_mediaquality::aidl::android::hardware::tv::mediaquality::IMediaQuality::{BnMediaQuality, IMediaQuality}; 18 use binder::BinderFeatures; 19 20 mod hal; 21 use hal::media_quality_hal_impl::MediaQualityService; 22 23 const LOG_TAG: &str = "mediaquality_service_example_rust"; 24 25 use log::LevelFilter; 26 main()27fn main() { 28 29 android_logger::init_once( 30 android_logger::Config::default() 31 .with_tag(LOG_TAG) 32 .with_max_level(LevelFilter::Info), 33 ); 34 35 let media_quality_service = MediaQualityService::new(); 36 let media_quality_service_binder = BnMediaQuality::new_binder(media_quality_service, BinderFeatures::default()); 37 38 let service_name = format!("{}/default", MediaQualityService::get_descriptor()); 39 binder::add_service(&service_name, media_quality_service_binder.as_binder()) 40 .expect("Failed to register service"); 41 42 log::info!("MediaQualityHal service is running..."); 43 44 binder::ProcessState::join_thread_pool(); 45 } 46