1 // Copyright (C) 2024 Huawei Device Co., Ltd. 2 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // you may not use this file except in compliance with the License. 4 // You may obtain a copy of the License at 5 // 6 // http://www.apache.org/licenses/LICENSE-2.0 7 // 8 // Unless required by applicable law or agreed to in writing, software 9 // distributed under the License is distributed on an "AS IS" BASIS, 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 use ipc::parcel::MsgParcel; 15 use ipc::{IpcResult, IpcStatusCode}; 16 17 use crate::error::ErrorCode; 18 use crate::service::RequestServiceStub; 19 20 impl RequestServiceStub { unsubscribe_run_count(&self, reply: &mut MsgParcel) -> IpcResult<()>21 pub(crate) fn unsubscribe_run_count(&self, reply: &mut MsgParcel) -> IpcResult<()> { 22 let pid = ipc::Skeleton::calling_pid(); 23 info!("Service run_count unsubscribe pid {}", pid); 24 25 let ret = self.run_count_manager.unsubscribe_run_count(pid); 26 reply.write(&(ret as i32))?; 27 if ret != ErrorCode::ErrOk { 28 error!("End Service run_count unsubscribe, failed: {}", ret as i32); 29 return Err(IpcStatusCode::Failed); 30 } 31 Ok(()) 32 } 33 } 34