!6936 窗口C++服务侧删除未使用的接口

Merge pull request !6936 from liusensen/master
This commit is contained in:
openharmony_ci 2024-06-19 08:55:03 +00:00 committed by Gitee
commit 952935dfe7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
16 changed files with 1 additions and 301 deletions

View File

@ -55,12 +55,6 @@ bool DoSomethingInterestingWithMyAPI(const uint8_t* data, size_t size)
SceneSessionManager::GetInstance().OnRemoteRequest(static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_UNREGISTER_WINDOW_MANAGER_AGENT), parcel, reply, option);
parcel.RewindRead(0);
SceneSessionManager::GetInstance().OnRemoteRequest(static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_REGISTER_SESSION_CHANGE_LISTENER), parcel, reply, option);
parcel.RewindRead(0);
SceneSessionManager::GetInstance().OnRemoteRequest(static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_UNREGISTER_SESSION_CHANGE_LISTENER), parcel, reply, option);
parcel.RewindRead(0);
SceneSessionManager::GetInstance().OnRemoteRequest(static_cast<uint32_t>(ISceneSessionManager::
SceneSessionManagerMessage::TRANS_ID_REGISTER_SESSION_LISTENER), parcel, reply, option);
parcel.RewindRead(0);

View File

@ -81,8 +81,6 @@ ohos_shared_library("scene_session_manager") {
"src/window_scene_config.cpp",
"src/zidl/scene_session_manager_lite_stub.cpp",
"src/zidl/scene_session_manager_stub.cpp",
"src/zidl/session_listener_proxy.cpp",
"src/zidl/session_listener_stub.cpp",
]
public_configs = [

View File

@ -199,8 +199,6 @@ public:
WSError SetSessionLabel(const sptr<IRemoteObject> &token, const std::string &label) override;
WSError SetSessionIcon(const sptr<IRemoteObject> &token, const std::shared_ptr<Media::PixelMap> &icon) override;
WSError IsValidSessionIds(const std::vector<int32_t> &sessionIds, std::vector<bool> &results) override;
WSError RegisterSessionListener(const sptr<ISessionChangeListener> sessionListener) override;
void UnregisterSessionListener() override;
void HandleTurnScreenOn(const sptr<SceneSession>& sceneSession);
void HandleKeepScreenOn(const sptr<SceneSession>& sceneSession, bool requireLock);
void InitWithRenderServiceAdded();
@ -591,7 +589,6 @@ private:
void ProcessSubSessionBackground(sptr<SceneSession>& sceneSession);
WSError ProcessDialogRequestFocusImmdediately(sptr<SceneSession>& sceneSession);
WSError ProcessModalTopmostRequestFocusImmdediately(sptr<SceneSession>& sceneSession);
sptr<ISessionChangeListener> sessionListener_;
sptr<SceneSession> FindSessionByToken(const sptr<IRemoteObject> &token);
void CheckAndNotifyWaterMarkChangedResult();

View File

@ -24,7 +24,6 @@
#include "session/container/include/zidl/window_event_channel_interface.h"
#include "session/host/include/session.h"
#include "focus_change_info.h"
#include "session_listener_interface.h"
#include "window_manager.h"
#include "zidl/window_manager_interface.h"
#include "session_info.h"
@ -58,8 +57,6 @@ public:
TRANS_ID_SET_SESSION_LABEL,
TRANS_ID_SET_SESSION_ICON,
TRANS_ID_IS_VALID_SESSION_IDS,
TRANS_ID_REGISTER_SESSION_CHANGE_LISTENER,
TRANS_ID_UNREGISTER_SESSION_CHANGE_LISTENER,
TRANS_ID_SET_GESTURE_NAVIGATION_ENABLED,
TRANS_ID_GET_WINDOW_INFO,
TRANS_ID_PENDING_SESSION_TO_FOREGROUND,
@ -113,8 +110,6 @@ public:
virtual WSError SetSessionLabel(const sptr<IRemoteObject> &token, const std::string &label) = 0;
virtual WSError SetSessionIcon(const sptr<IRemoteObject> &token, const std::shared_ptr<Media::PixelMap> &icon) = 0;
virtual WSError IsValidSessionIds(const std::vector<int32_t> &sessionIds, std::vector<bool> &results) = 0;
virtual WSError RegisterSessionListener(const sptr<ISessionChangeListener> sessionListener) = 0;
virtual void UnregisterSessionListener() = 0;
virtual WSError PendingSessionToForeground(const sptr<IRemoteObject> &token) = 0;
virtual WSError PendingSessionToBackgroundForDelegator(const sptr<IRemoteObject> &token) = 0;
virtual WSError GetFocusSessionToken(sptr<IRemoteObject> &token) = 0;

View File

@ -55,8 +55,6 @@ public:
WSError SetSessionLabel(const sptr<IRemoteObject> &token, const std::string &label) override;
WSError SetSessionIcon(const sptr<IRemoteObject> &token, const std::shared_ptr<Media::PixelMap> &icon) override;
WSError IsValidSessionIds(const std::vector<int32_t> &sessionIds, std::vector<bool> &results) override;
WSError RegisterSessionListener(const sptr<ISessionChangeListener> sessionListener) override;
void UnregisterSessionListener() override;
WMError GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos) override;
WMError GetUnreliableWindowInfo(int32_t windowId, std::vector<sptr<UnreliableWindowInfo>>& infos) override;
WSError PendingSessionToForeground(const sptr<IRemoteObject> &token) override;

View File

@ -49,8 +49,6 @@ private:
int HandleSetSessionLabel(MessageParcel &data, MessageParcel &reply);
int HandleSetSessionIcon(MessageParcel &data, MessageParcel &reply);
int HandleIsValidSessionIds(MessageParcel &data, MessageParcel &reply);
int HandleRegisterSessionChangeListener(MessageParcel &data, MessageParcel &reply);
int HandleUnRegisterSessionChangeListener(MessageParcel &data, MessageParcel &reply);
int HandlePendingSessionToForeground(MessageParcel &data, MessageParcel &reply);
int HandlePendingSessionToBackgroundForDelegator(MessageParcel &data, MessageParcel &reply);
int HandleGetFocusSessionToken(MessageParcel &data, MessageParcel &reply);

View File

@ -1,34 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_INTERFACE_H
#define OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_INTERFACE_H
#include <pixel_map.h>
namespace OHOS::Media {
class PixelMap;
} // namespace OHOS::Media
namespace OHOS::Rosen {
class ISessionChangeListener : public IRemoteBroker {
public:
DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISessionChangeListener");
virtual void OnSessionLabelChange(int32_t persistentId, const std::string &label) = 0;
virtual void OnSessionIconChange(int32_t persistentId, const std::shared_ptr<Media::PixelMap> &icon) = 0;
};
} // namespace OHOS::Rosen
#endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_INTERFACE_H

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_PROXY_H
#define OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_PROXY_H
#include "iremote_proxy.h"
#include "session_listener_interface.h"
namespace OHOS::Rosen {
class SessionListenerProxy : public IRemoteProxy<ISessionChangeListener> {
public:
explicit SessionListenerProxy(const sptr<IRemoteObject>& impl)
: IRemoteProxy<ISessionChangeListener>(impl) {};
~SessionListenerProxy() {};
virtual void OnSessionLabelChange(int32_t persistentId, const std::string &label) override;
virtual void OnSessionIconChange(int32_t persistentId, const std::shared_ptr<Media::PixelMap> &icon) override;
};
} // namespace OHOS::Rosen
#endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_PROXY_H

View File

@ -1,29 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_STUB_H
#define OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_STUB_H
#include "iremote_stub.h"
#include "session_listener_interface.h"
namespace OHOS::Rosen {
class SessionListenerStub : public IRemoteStub<ISessionChangeListener> {
public:
SessionListenerStub() = default;
virtual ~SessionListenerStub() = default;
};
} // namespace OHOS::Rosen
#endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_STUB_H

View File

@ -1729,7 +1729,7 @@ WSError SceneSessionManager::RequestSceneSessionActivationInner(
isNewActive, scnSession->GetSessionState());
if (isNewActive || scnSession->GetSessionState() == SessionState::STATE_DISCONNECT ||
scnSession->GetSessionState() == SessionState::STATE_END) {
TLOGI(WmsLogTag::WMS_MAIN, "Call StartUIAbility: %{public}d system: %{public}u", persistentId,
TLOGI(WmsLogTag::WMS_MAIN, "Begin StartUIAbility: %{public}d system: %{public}u", persistentId,
static_cast<uint32_t>(scnSession->GetSessionInfo().isSystem_));
errCode = AAFwk::AbilityManagerClient::GetInstance()->StartUIAbilityBySCB(scnSessionInfo, isColdStart);
} else {
@ -5393,10 +5393,6 @@ WSError SceneSessionManager::SetSessionLabel(const sptr<IRemoteObject> &token, c
return WSError::WS_ERROR_SET_SESSION_LABEL_FAILED;
}
sceneSession->SetSessionLabel(label);
if (sessionListener_ != nullptr) {
WLOGFI("OnSessionLabelChange id: %{public}d", sceneSession->GetPersistentId());
sessionListener_->OnSessionLabelChange(sceneSession->GetPersistentId(), label);
}
WLOGFI("NotifySessionLabelUpdated, id: %{public}d, system: %{public}d", sceneSession->GetPersistentId(),
sceneSession->GetSessionInfo().isSystem_);
if (listenerController_ != nullptr && !sceneSession->GetSessionInfo().isSystem_) {
@ -5424,10 +5420,6 @@ WSError SceneSessionManager::SetSessionIcon(const sptr<IRemoteObject> &token,
return WSError::WS_ERROR_SET_SESSION_LABEL_FAILED;
}
sceneSession->SetSessionIcon(icon);
if (sessionListener_ != nullptr) {
WLOGFI("OnSessionIconChange id: %{public}d", sceneSession->GetPersistentId());
sessionListener_->OnSessionIconChange(sceneSession->GetPersistentId(), icon);
}
WLOGFI("NotifySessionIconChanged, id: %{public}d, system: %{public}d", sceneSession->GetPersistentId(),
sceneSession->GetSessionInfo().isSystem_);
if (listenerController_ != nullptr &&
@ -5988,35 +5980,6 @@ sptr<AAFwk::IAbilityManagerCollaborator> SceneSessionManager::GetCollaboratorByT
return collaborator;
}
WSError SceneSessionManager::RegisterSessionListener(const sptr<ISessionChangeListener> sessionListener)
{
WLOGFI("Enter");
if (sessionListener == nullptr) {
return WSError::WS_ERROR_INVALID_SESSION_LISTENER;
}
if (!SessionPermission::VerifySessionPermission()) {
WLOGFE("The caller has not permission granted");
return WSError::WS_ERROR_INVALID_PERMISSION;
}
auto task = [this, sessionListener]() {
sessionListener_ = sessionListener;
return WSError::WS_OK;
};
return taskScheduler_->PostSyncTask(task, "RegisterSessionListener");
}
void SceneSessionManager::UnregisterSessionListener()
{
if (!SessionPermission::VerifySessionPermission()) {
WLOGFE("The caller has not permission granted");
return;
}
auto task = [this]() {
sessionListener_ = nullptr;
};
taskScheduler_->PostAsyncTask(task, "UnregisterSessionListener");
}
WSError SceneSessionManager::RequestSceneSessionByCall(const sptr<SceneSession>& sceneSession)
{
wptr<SceneSession> weakSceneSession(sceneSession);

View File

@ -641,55 +641,6 @@ WSError SceneSessionManagerProxy::IsValidSessionIds(
return static_cast<WSError>(reply.ReadInt32());
}
WSError SceneSessionManagerProxy::RegisterSessionListener(const sptr<ISessionChangeListener> sessionListener)
{
WLOGFI("run SceneSessionManagerProxy::RegisterSessionListener");
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (sessionListener == nullptr) {
WLOGFE("sessionListener is null");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInterfaceToken(GetDescriptor())) {
WLOGFE("Write interfaceToken failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteRemoteObject(sessionListener->AsObject())) {
WLOGFE("Write sessionListener failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (Remote()->SendRequest(
static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_REGISTER_SESSION_CHANGE_LISTENER), data, reply,
option) != ERR_NONE) {
WLOGFE("SendRequest failed");
return WSError::WS_ERROR_IPC_FAILED;
}
return static_cast<WSError>(reply.ReadInt32());
}
void SceneSessionManagerProxy::UnregisterSessionListener()
{
WLOGFI("run SceneSessionManagerProxy::UnregisterSessionListener");
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (!data.WriteInterfaceToken(GetDescriptor())) {
WLOGFE("UnregisterSessionListener WriteInterfaceToken failed");
return;
}
if (Remote()->SendRequest(
static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_UNREGISTER_SESSION_CHANGE_LISTENER), data, reply,
option) != ERR_NONE) {
WLOGFE("SendRequest failed");
return;
}
}
WMError SceneSessionManagerProxy::GetAccessibilityWindowInfo(std::vector<sptr<AccessibilityWindowInfo>>& infos)
{
MessageOption option;

View File

@ -55,10 +55,6 @@ const std::map<uint32_t, SceneSessionManagerStubFunc> SceneSessionManagerStub::s
&SceneSessionManagerStub::HandleSetSessionIcon),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_IS_VALID_SESSION_IDS),
&SceneSessionManagerStub::HandleIsValidSessionIds),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_REGISTER_SESSION_CHANGE_LISTENER),
&SceneSessionManagerStub::HandleRegisterSessionChangeListener),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_UNREGISTER_SESSION_CHANGE_LISTENER),
&SceneSessionManagerStub::HandleUnRegisterSessionChangeListener),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_PENDING_SESSION_TO_FOREGROUND),
&SceneSessionManagerStub::HandlePendingSessionToForeground),
std::make_pair(static_cast<uint32_t>(
@ -384,26 +380,6 @@ int SceneSessionManagerStub::HandleIsValidSessionIds(MessageParcel &data, Messag
return ERR_NONE;
}
int SceneSessionManagerStub::HandleRegisterSessionChangeListener(MessageParcel &data, MessageParcel &reply)
{
WLOGFI("run HandleRegisterSessionChangeListener!");
sptr<ISessionChangeListener> listener = iface_cast<ISessionChangeListener>(data.ReadRemoteObject());
if (listener == nullptr) {
reply.WriteInt32(static_cast<int32_t>(WSError::WS_ERROR_INVALID_SESSION_LISTENER));
return ERR_NONE;
}
WSError errCode = RegisterSessionListener(listener);
reply.WriteInt32(static_cast<int32_t>(errCode));
return ERR_NONE;
}
int SceneSessionManagerStub::HandleUnRegisterSessionChangeListener(MessageParcel &data, MessageParcel &reply)
{
WLOGFI("run HandleUnRegisterSessionChangeListener!");
UnregisterSessionListener();
return ERR_NONE;
}
int SceneSessionManagerStub::HandlePendingSessionToForeground(MessageParcel &data, MessageParcel &reply)
{
WLOGFI("run HandlePendingSessionToForeground!");

View File

@ -1,23 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "session_listener_proxy.h"
namespace OHOS::Rosen {
void SessionListenerProxy::OnSessionLabelChange(int32_t persistentId, const std::string &label) {}
void SessionListenerProxy::OnSessionIconChange(int32_t persistentId, const std::shared_ptr<Media::PixelMap> &icon) {}
} // namespace OHOS::Rosen

View File

@ -1,19 +0,0 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "session_listener_stub.h"
namespace OHOS::Rosen {
} // namespace OHOS::Rosen

View File

@ -416,24 +416,6 @@ HWTEST_F(SceneSessionManagerStubTest, HandleIsValidSessionIds, Function | SmallT
EXPECT_EQ(res, ERR_NONE);
}
/**
* @tc.name: HandleUnRegisterSessionChangeListener
* @tc.desc: test HandleUnRegisterSessionChangeListener
* @tc.type: FUNC
*/
HWTEST_F(SceneSessionManagerStubTest, HandleUnRegisterSessionChangeListener, Function | SmallTest | Level2)
{
if (stub_ == nullptr) {
return;
}
MessageParcel data;
MessageParcel reply;
int res = stub_->HandleUnRegisterSessionChangeListener(data, reply);
EXPECT_EQ(res, ERR_NONE);
}
/**
* @tc.name: HandlePendingSessionToForeground
* @tc.desc: test HandlePendingSessionToForeground

View File

@ -315,20 +315,6 @@ HWTEST_F(SceneSessionManagerTest, RegisterSessionListener01, Function | SmallTes
EXPECT_EQ(result, WSError::WS_ERROR_INVALID_PERMISSION);
}
/**
* @tc.name: RegisterSessionListener02
* @tc.desc: SceneSesionManager register session listener
* @tc.type: FUNC
*/
HWTEST_F(SceneSessionManagerTest, RegisterSessionListener02, Function | SmallTest | Level3)
{
OHOS::MessageParcel data;
sptr<ISessionChangeListener> sessionListener = nullptr;
WSError result01 = ssm_->RegisterSessionListener(sessionListener);
EXPECT_EQ(result01, WSError::WS_ERROR_INVALID_SESSION_LISTENER);
ssm_->UnregisterSessionListener();
}
/**
* @tc.name: ClearDisplayStatusBarTemporarilyFlags
* @tc.desc: check ClearDisplayStatusBarTemporarilyFlags