• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
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 
16 #include "notify_service_impl.h"
17 #include "peruser_session.h"
18 #include "user_session_manager.h"
19 #include "os_account_adapter.h"
20 #include "ipc_skeleton.h"
21 
22 namespace OHOS {
23 namespace MiscServices {
24 
NotifyOnInputStopFinished()25 ErrCode OnInputStopNotifyServiceImpl::NotifyOnInputStopFinished()
26 {
27     IMSA_HILOGI("NotifyOnInputStopFinished is start!");
28     if (pid_ != IPCSkeleton::GetCallingPid()) {
29         IMSA_HILOGI("pid is invalid!");
30         return ErrorCode::ERROR_STATUS_PERMISSION_DENIED;
31     }
32     auto userId = OsAccountAdapter::GetOsAccountLocalIdFromUid(IPCSkeleton::GetCallingUid());
33     if (userId == OsAccountAdapter::INVALID_USER_ID) {
34         return ErrorCode::ERROR_EX_ILLEGAL_STATE;
35     }
36     auto session = UserSessionManager::GetInstance().GetUserSession(userId);
37     if (session == nullptr) {
38         IMSA_HILOGE("%{public}d session is nullptr!", userId);
39         return ErrorCode::ERROR_IMSA_USER_SESSION_NOT_FOUND;
40     }
41     session->NotifyOnInputStopFinished();
42     IMSA_HILOGI("OnInputStop is finished");
43     return ERR_OK;
44 }
45 } // namespace MiscServices
46 } // namespace OHOS