• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 "session/host/include/scb_system_session.h"
17 
18 #include <ui/rs_surface_node.h>
19 #include "window_manager_hilog.h"
20 
21 namespace OHOS::Rosen {
22 namespace {
23 constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "SCBSystemSession" };
24 } // namespace
25 
SCBSystemSession(const SessionInfo & info,const sptr<SpecificSessionCallback> & specificCallback)26 SCBSystemSession::SCBSystemSession(const SessionInfo& info, const sptr<SpecificSessionCallback>& specificCallback)
27     : SceneSession(info, specificCallback)
28 {
29     auto name = sessionInfo_.bundleName_;
30     auto pos = name.find_last_of('.');
31     name = (pos == std::string::npos) ? name : name.substr(pos + 1); // skip '.'
32     if (sessionInfo_.isSystem_) {
33         RSSurfaceNodeConfig config;
34         config.SurfaceNodeName = name;
35         surfaceNode_ = Rosen::RSSurfaceNode::Create(config, Rosen::RSSurfaceNodeType::APP_WINDOW_NODE);
36     }
37     WLOGFD("Create SCBSystemSession");
38 }
39 
~SCBSystemSession()40 SCBSystemSession::~SCBSystemSession()
41 {
42     WLOGD("~SCBSystemSession, id: %{public}d", GetPersistentId());
43 }
44 
ProcessPointDownSession(int32_t posX,int32_t posY)45 WSError SCBSystemSession::ProcessPointDownSession(int32_t posX, int32_t posY)
46 {
47     const auto& id = GetPersistentId();
48     const auto& type = GetWindowType();
49     WLOGFI("id: %{public}d, type: %{public}d", id, type);
50     PresentFocusIfPointDown();
51     return SceneSession::ProcessPointDownSession(posX, posY);
52 }
53 } // namespace OHOS::Rosen
54