Alan Stokes | ea1f046 | 2024-02-19 16:25:47 +0000 | [diff] [blame^] | 1 | // 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 | use android_system_virtualizationmaintenance::aidl::android::system::virtualizationmaintenance; |
| 16 | use anyhow::anyhow; |
| 17 | use binder::{BinderFeatures, ExceptionCode, Interface, IntoBinderResult, Strong}; |
| 18 | use virtualizationmaintenance::IVirtualizationMaintenance::{ |
| 19 | BnVirtualizationMaintenance, IVirtualizationMaintenance, |
| 20 | }; |
| 21 | |
| 22 | pub(crate) fn new_binder() -> Strong<dyn IVirtualizationMaintenance> { |
| 23 | BnVirtualizationMaintenance::new_binder( |
| 24 | VirtualizationMaintenanceService {}, |
| 25 | BinderFeatures::default(), |
| 26 | ) |
| 27 | } |
| 28 | |
| 29 | pub struct VirtualizationMaintenanceService; |
| 30 | |
| 31 | impl Interface for VirtualizationMaintenanceService {} |
| 32 | |
| 33 | #[allow(non_snake_case)] |
| 34 | impl IVirtualizationMaintenance for VirtualizationMaintenanceService { |
| 35 | fn appRemoved(&self, _user_id: i32, _app_id: i32) -> binder::Result<()> { |
| 36 | Err(anyhow!("appRemoved not supported")) |
| 37 | .or_binder_exception(ExceptionCode::UNSUPPORTED_OPERATION) |
| 38 | } |
| 39 | |
| 40 | fn userRemoved(&self, _user_id: i32) -> binder::Result<()> { |
| 41 | Err(anyhow!("userRemoved not supported")) |
| 42 | .or_binder_exception(ExceptionCode::UNSUPPORTED_OPERATION) |
| 43 | } |
| 44 | } |