系统服务接口管控

Signed-off-by: zhangxinyu <zhangxinyu74@huawei.com>
Change-Id: Ie8c90426d4895d937ee5d9c2c878e36849bff142
Signed-off-by: zhangxinyu <zhangxinyu74@huawei.com>
This commit is contained in:
zhangxinyu 2023-06-02 07:45:44 +00:00
parent 9859b256f8
commit 59a5b18175
53 changed files with 472 additions and 354 deletions

16
CODEOWNERS Normal file
View File

@ -0,0 +1,16 @@
# 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.
# any change to xxx_ipc_interface_code.h needs to be reviewed by @leonchan5
interfaces/inner_api/appexecfwk_core/include/bundle_appexecfwk_core_ipc_interface_code.h @leonchan5
services/bundlemgr/include/bundle_manager_services_ipc_interface_code.h @leonchan5

View File

@ -125,28 +125,6 @@ public:
{
return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
}
enum Message : uint32_t {
ADD_APP_INSTALL_CONTROL_RULE = 0,
DELETE_APP_INSTALL_CONTROL_RULE,
CLEAN_APP_INSTALL_CONTROL_RULE,
GET_APP_INSTALL_CONTROL_RULE,
ADD_APP_RUNNING_CONTROL_RULE,
DELETE_APP_RUNNING_CONTROL_RULE,
CLEAN_APP_RUNNING_CONTROL_RULE,
GET_APP_RUNNING_CONTROL_RULE,
GET_APP_RUNNING_CONTROL_RULE_RESULT,
SET_DISPOSED_STATUS,
DELETE_DISPOSED_STATUS,
GET_DISPOSED_STATUS,
CONFIRM_APP_JUMP_CONTROL_RULE,
ADD_APP_JUMP_CONTROL_RULE,
DELETE_APP_JUMP_CONTROL_RULE,
DELETE_APP_JUMP_CONTROL_RULE_BY_CALLER,
DELETE_APP_JUMP_CONTROL_RULE_BY_TARGET,
GET_APP_JUMP_CONTROL_RULE,
};
};
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -18,6 +18,7 @@
#include "app_control_interface.h"
#include "iremote_proxy.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -62,13 +63,13 @@ public:
private:
bool WriteParcelableVector(const std::vector<std::string> &stringVector, MessageParcel &data);
template <typename T>
ErrCode GetParcelableInfo(IAppControlMgr::Message code, MessageParcel& data, T& parcelableInfo);
ErrCode GetParcelableInfo(AppControlManagerInterfaceCode code, MessageParcel& data, T& parcelableInfo);
template<typename T>
bool WriteParcelableVector(const std::vector<T> &parcelableVector, MessageParcel &data);
bool WriteStringVector(const std::vector<std::string> &stringVector, MessageParcel &data);
int32_t GetParcelableInfos(
IAppControlMgr::Message code, MessageParcel &data, std::vector<std::string> &stringVector);
int32_t SendRequest(IAppControlMgr::Message code, MessageParcel &data, MessageParcel &reply);
AppControlManagerInterfaceCode code, MessageParcel &data, std::vector<std::string> &stringVector);
int32_t SendRequest(AppControlManagerInterfaceCode code, MessageParcel &data, MessageParcel &reply);
static inline BrokerDelegator<AppControlProxy> delegator_;
};
} // namespace AppExecFwk

View File

@ -0,0 +1,113 @@
/*
* 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_BUNDLE_APPEXECFWK_CORE_IPC_INTERFACE_CODE_H
#define OHOS_BUNDLE_APPEXECFWK_CORE_IPC_INTERFACE_CODE_H
/* SAID: 401 */
namespace OHOS {
namespace AppExecFwk {
enum class AppControlManagerInterfaceCode : uint32_t {
ADD_APP_INSTALL_CONTROL_RULE = 0,
DELETE_APP_INSTALL_CONTROL_RULE,
CLEAN_APP_INSTALL_CONTROL_RULE,
GET_APP_INSTALL_CONTROL_RULE,
ADD_APP_RUNNING_CONTROL_RULE,
DELETE_APP_RUNNING_CONTROL_RULE,
CLEAN_APP_RUNNING_CONTROL_RULE,
GET_APP_RUNNING_CONTROL_RULE,
GET_APP_RUNNING_CONTROL_RULE_RESULT,
SET_DISPOSED_STATUS,
DELETE_DISPOSED_STATUS,
GET_DISPOSED_STATUS,
CONFIRM_APP_JUMP_CONTROL_RULE,
ADD_APP_JUMP_CONTROL_RULE,
DELETE_APP_JUMP_CONTROL_RULE,
DELETE_APP_JUMP_CONTROL_RULE_BY_CALLER,
DELETE_APP_JUMP_CONTROL_RULE_BY_TARGET,
GET_APP_JUMP_CONTROL_RULE,
};
enum class BundleEventCallbackInterfaceCode : uint32_t {
ON_RECEIVE_EVENT,
};
enum class BundleInstallerInterfaceCode : uint32_t {
INSTALL = 0,
INSTALL_MULTIPLE_HAPS,
UNINSTALL,
UNINSTALL_MODULE,
UNINSTALL_BY_UNINSTALL_PARAM,
RECOVER,
INSTALL_SANDBOX_APP,
UNINSTALL_SANDBOX_APP,
CREATE_STREAM_INSTALLER,
DESTORY_STREAM_INSTALLER,
};
enum class BundleStatusCallbackInterfaceCode : uint32_t {
ON_BUNDLE_STATE_CHANGED,
};
enum class BundleStreamInstallerInterfaceCode : uint32_t {
CREATE_STREAM = 0,
STREAM_INSTALL = 1,
CREATE_SHARED_BUNDLE_STREAM = 2,
};
enum class CleanCacheCallbackInterfaceCode : uint32_t {
ON_CLEAN_CACHE_CALLBACK,
};
enum class StatusReceiverInterfaceCode : uint32_t {
ON_STATUS_NOTIFY,
ON_FINISHED,
};
enum class DefaultAppInterfaceCode : uint32_t {
IS_DEFAULT_APPLICATION = 0,
GET_DEFAULT_APPLICATION = 1,
SET_DEFAULT_APPLICATION = 2,
RESET_DEFAULT_APPLICATION = 3,
};
enum class OverlayManagerInterfaceCode : uint32_t {
GET_ALL_OVERLAY_MODULE_INFO = 0,
GET_OVERLAY_MODULE_INFO_BY_NAME = 1,
GET_OVERLAY_MODULE_INFO = 2,
GET_TARGET_OVERLAY_MODULE_INFOS = 3,
GET_OVERLAY_MODULE_INFO_BY_BUNDLE_NAME = 4,
GET_OVERLAY_BUNDLE_INFO_FOR_TARGET = 5,
GET_OVERLAY_MODULE_INFO_FOR_TARGET = 6,
SET_OVERLAY_ENABLED = 7,
SET_OVERLAY_ENABLED_FOR_SELF = 8,
};
enum class QuickFixManagerInterfaceCode : uint32_t {
DEPLOY_QUICK_FIX = 0,
SWITCH_QUICK_FIX = 1,
DELETE_QUICK_FIX = 2,
CREATE_FD = 3
};
enum class QuickFixStatusCallbackInterfaceCode : uint32_t {
ON_PATCH_DEPLOYED = 1,
ON_PATCH_SWITCHED = 2,
ON_PATCH_DELETED = 3
};
} // namespace AppExecFwk
} // namespace OHOS
#endif // OHOS_BUNDLE_APPEXECFWK_CORE_IPC_INTERFACE_CODE_H

View File

@ -26,10 +26,6 @@ public:
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.BundleEventCallback");
virtual void OnReceiveEvent(const EventFwk::CommonEventData eventData) = 0;
enum class Message {
ON_RECEIVE_EVENT,
};
};
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -120,19 +120,6 @@ public:
virtual bool DestoryBundleStreamInstaller(uint32_t streamInstallerId) = 0;
virtual ErrCode StreamInstall(const std::vector<std::string> &bundleFilePaths, const InstallParam &installParam,
const sptr<IStatusReceiver> &statusReceiver) = 0;
enum Message : uint32_t {
INSTALL = 0,
INSTALL_MULTIPLE_HAPS,
UNINSTALL,
UNINSTALL_MODULE,
UNINSTALL_BY_UNINSTALL_PARAM,
RECOVER,
INSTALL_SANDBOX_APP,
UNINSTALL_SANDBOX_APP,
CREATE_STREAM_INSTALLER,
DESTORY_STREAM_INSTALLER,
};
};
#define PARCEL_WRITE_INTERFACE_TOKEN(parcel, token) \

View File

@ -20,6 +20,7 @@
#include "bundle_installer_interface.h"
#include "status_receiver_interface.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -110,7 +111,7 @@ public:
const sptr<IStatusReceiver> &statusReceiver) override;
private:
bool SendInstallRequest(const uint32_t& code, MessageParcel& data, MessageParcel& reply,
bool SendInstallRequest(BundleInstallerInterfaceCode code, MessageParcel& data, MessageParcel& reply,
MessageOption& option);
ErrCode WriteFileToStream(sptr<IBundleStreamInstaller> &streamInstaller, const std::string &path);

View File

@ -59,10 +59,6 @@ public:
*/
virtual void OnBundleRemoved(const std::string &bundleName, const int userId) = 0;
enum class Message {
ON_BUNDLE_STATE_CHANGED,
};
std::string GetBundleName()
{
return bundleName_;

View File

@ -43,12 +43,6 @@ public:
}
virtual void SetInstallerId(uint32_t installerId) {};
virtual void UnInit() {};
enum StreamMessage : uint32_t {
CREATE_STREAM = 0,
STREAM_INSTALL = 1,
CREATE_SHARED_BUNDLE_STREAM = 2,
};
};
} // AppExecFwk
} // OHOS

View File

@ -20,6 +20,7 @@
#include "ipc_types.h"
#include "iremote_proxy.h"
#include "parcel.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -38,7 +39,7 @@ public:
private:
static inline BrokerDelegator<BundleStreamInstallerProxy> delegator_;
uint32_t installerId_ = -1;
bool SendStreamInstallRequest(const uint32_t& code, MessageParcel& data, MessageParcel& reply);
bool SendStreamInstallRequest(BundleStreamInstallerInterfaceCode code, MessageParcel& data, MessageParcel& reply);
};
} // AppExecFwk
} // OHOS

View File

@ -29,10 +29,6 @@ public:
* @param succeeded Indicates the result of the clean cache files progress.
*/
virtual void OnCleanCacheFinished(bool succeeded) = 0;
enum class Message {
ON_CLEAN_CACHE_CALLBACK,
};
};
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -39,11 +39,6 @@ public:
virtual void SetStreamInstallId(uint32_t installerId) = 0;
enum class Message {
ON_STATUS_NOTIFY,
ON_FINISHED,
};
enum {
SUCCESS = 0,
ERR_INSTALL_INTERNAL_ERROR = 9568260,

View File

@ -45,13 +45,6 @@ public:
{
return ERR_APPEXECFWK_SERVICE_INTERNAL_ERROR;
}
enum Message : uint32_t {
IS_DEFAULT_APPLICATION = 0,
GET_DEFAULT_APPLICATION = 1,
SET_DEFAULT_APPLICATION = 2,
RESET_DEFAULT_APPLICATION = 3,
};
};
}
}

View File

@ -18,6 +18,7 @@
#include "default_app_interface.h"
#include "iremote_proxy.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -33,8 +34,8 @@ public:
private:
template <typename T>
ErrCode GetParcelableInfo(IDefaultApp::Message code, MessageParcel& data, T& parcelableInfo);
bool SendRequest(IDefaultApp::Message code, MessageParcel& data, MessageParcel& reply);
ErrCode GetParcelableInfo(DefaultAppInterfaceCode code, MessageParcel& data, T& parcelableInfo);
bool SendRequest(DefaultAppInterfaceCode code, MessageParcel& data, MessageParcel& reply);
static inline BrokerDelegator<DefaultAppProxy> delegator_;
};
}

View File

@ -83,18 +83,6 @@ public:
{
return ERR_BUNDLEMANAGER_OVERLAY_INSTALLATION_FAILED_INTERNAL_ERROR;
}
enum Message : uint32_t {
GET_ALL_OVERLAY_MODULE_INFO = 0,
GET_OVERLAY_MODULE_INFO_BY_NAME = 1,
GET_OVERLAY_MODULE_INFO = 2,
GET_TARGET_OVERLAY_MODULE_INFOS = 3,
GET_OVERLAY_MODULE_INFO_BY_BUNDLE_NAME = 4,
GET_OVERLAY_BUNDLE_INFO_FOR_TARGET = 5,
GET_OVERLAY_MODULE_INFO_FOR_TARGET = 6,
SET_OVERLAY_ENABLED = 7,
SET_OVERLAY_ENABLED_FOR_SELF = 8,
};
};
} // AppExecFwk
} // OHOS

View File

@ -18,6 +18,7 @@
#include "overlay_manager_interface.h"
#include "iremote_proxy.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -56,13 +57,13 @@ public:
private:
template<typename T>
ErrCode GetParcelableInfo(IOverlayManager::Message code, MessageParcel &data, T &parcelableInfo);
ErrCode GetParcelableInfo(OverlayManagerInterfaceCode code, MessageParcel &data, T &parcelableInfo);
template<typename T>
ErrCode GetParcelableInfosWithErrCode(IOverlayManager::Message code, MessageParcel &data,
ErrCode GetParcelableInfosWithErrCode(OverlayManagerInterfaceCode code, MessageParcel &data,
std::vector<T> &parcelableInfos);
bool SendTransactCmd(IOverlayManager::Message code, MessageParcel &data, MessageParcel &reply);
bool SendTransactCmd(OverlayManagerInterfaceCode code, MessageParcel &data, MessageParcel &reply);
static inline BrokerDelegator<OverlayManagerProxy> delegator_;
};

View File

@ -56,12 +56,6 @@ public:
{
return ERR_BUNDLEMANAGER_QUICK_FIX_INTERNAL_ERROR;
}
enum Message : uint32_t {
DEPLOY_QUICK_FIX = 0,
SWITCH_QUICK_FIX = 1,
DELETE_QUICK_FIX = 2,
CREATE_FD = 3
};
};
} // AppExecFwk
} // OHOS

View File

@ -18,6 +18,7 @@
#include "quick_fix_manager_interface.h"
#include "iremote_proxy.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -40,7 +41,7 @@ public:
private:
virtual ErrCode CreateFd(const std::string &fileName, int32_t &fd, std::string &path) override;
bool SendRequest(IQuickFixManager::Message code, MessageParcel &data, MessageParcel &reply);
bool SendRequest(QuickFixManagerInterfaceCode code, MessageParcel &data, MessageParcel &reply);
static inline BrokerDelegator<QuickFixManagerProxy> delegator_;
};

View File

@ -28,12 +28,6 @@ public:
virtual void OnPatchDeployed(const std::shared_ptr<QuickFixResult> &result) = 0;
virtual void OnPatchSwitched(const std::shared_ptr<QuickFixResult> &result) = 0;
virtual void OnPatchDeleted(const std::shared_ptr<QuickFixResult> &result) = 0;
enum Message : uint32_t {
ON_PATCH_DEPLOYED = 1,
ON_PATCH_SWITCHED = 2,
ON_PATCH_DELETED = 3
};
};
} // AppExecFwk
} // OHOS

View File

@ -19,6 +19,7 @@
#include "iremote_proxy.h"
#include "quick_fix_status_callback_interface.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -32,7 +33,7 @@ public:
virtual void OnPatchDeleted(const std::shared_ptr<QuickFixResult> &result) override;
private:
bool SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply);
bool SendTransactCmd(QuickFixStatusCallbackInterfaceCode code, MessageParcel &data, MessageParcel &reply);
static inline BrokerDelegator<QuickFixStatusCallbackProxy> delegator_;
};

View File

@ -20,6 +20,7 @@
#include "appexecfwk_errors.h"
#include "bundle_memory_guard.h"
#include "ipc_types.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -46,41 +47,41 @@ int AppControlHost::OnRemoteRequest(
}
switch (code) {
case IAppControlMgr::Message::ADD_APP_INSTALL_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::ADD_APP_INSTALL_CONTROL_RULE):
return HandleAddAppInstallControlRule(data, reply);
case IAppControlMgr::Message::DELETE_APP_INSTALL_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::DELETE_APP_INSTALL_CONTROL_RULE):
return HandleDeleteAppInstallControlRule(data, reply);
case IAppControlMgr::Message::CLEAN_APP_INSTALL_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::CLEAN_APP_INSTALL_CONTROL_RULE):
return HandleCleanAppInstallControlRule(data, reply);
case IAppControlMgr::Message::GET_APP_INSTALL_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::GET_APP_INSTALL_CONTROL_RULE):
return HandleGetAppInstallControlRule(data, reply);
case IAppControlMgr::Message::ADD_APP_RUNNING_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::ADD_APP_RUNNING_CONTROL_RULE):
return HandleAddAppRunningControlRule(data, reply);
case IAppControlMgr::Message::DELETE_APP_RUNNING_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::DELETE_APP_RUNNING_CONTROL_RULE):
return HandleDeleteAppRunningControlRule(data, reply);
case IAppControlMgr::Message::CLEAN_APP_RUNNING_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::CLEAN_APP_RUNNING_CONTROL_RULE):
return HandleCleanAppRunningControlRule(data, reply);
case IAppControlMgr::Message::GET_APP_RUNNING_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::GET_APP_RUNNING_CONTROL_RULE):
return HandleGetAppRunningControlRule(data, reply);
case IAppControlMgr::Message::GET_APP_RUNNING_CONTROL_RULE_RESULT:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::GET_APP_RUNNING_CONTROL_RULE_RESULT):
return HandleGetAppRunningControlRuleResult(data, reply);
case IAppControlMgr::Message::CONFIRM_APP_JUMP_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::CONFIRM_APP_JUMP_CONTROL_RULE):
return HandleConfirmAppJumpControlRule(data, reply);
case IAppControlMgr::Message::ADD_APP_JUMP_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::ADD_APP_JUMP_CONTROL_RULE):
return HandleAddAppJumpControlRule(data, reply);
case IAppControlMgr::Message::DELETE_APP_JUMP_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::DELETE_APP_JUMP_CONTROL_RULE):
return HandleDeleteAppJumpControlRule(data, reply);
case IAppControlMgr::Message::DELETE_APP_JUMP_CONTROL_RULE_BY_CALLER:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::DELETE_APP_JUMP_CONTROL_RULE_BY_CALLER):
return HandleDeleteRuleByCallerBundleName(data, reply);
case IAppControlMgr::Message::DELETE_APP_JUMP_CONTROL_RULE_BY_TARGET:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::DELETE_APP_JUMP_CONTROL_RULE_BY_TARGET):
return HandleDeleteRuleByTargetBundleName(data, reply);
case IAppControlMgr::Message::GET_APP_JUMP_CONTROL_RULE:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::GET_APP_JUMP_CONTROL_RULE):
return HandleGetAppJumpControlRule(data, reply);
case IAppControlMgr::Message::SET_DISPOSED_STATUS:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::SET_DISPOSED_STATUS):
return HandleSetDisposedStatus(data, reply);
case IAppControlMgr::Message::GET_DISPOSED_STATUS:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::GET_DISPOSED_STATUS):
return HandleGetDisposedStatus(data, reply);
case IAppControlMgr::Message::DELETE_DISPOSED_STATUS:
case static_cast<uint32_t>(AppControlManagerInterfaceCode::DELETE_DISPOSED_STATUS):
return HandleDeleteDisposedStatus(data, reply);
default:
APP_LOGW("AppControlHost receive unknown code, code = %{public}d", code);

View File

@ -60,7 +60,7 @@ ErrCode AppControlProxy::AddAppInstallControlRule(const std::vector<std::string>
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::ADD_APP_INSTALL_CONTROL_RULE, data, reply);
return SendRequest(AppControlManagerInterfaceCode::ADD_APP_INSTALL_CONTROL_RULE, data, reply);
}
ErrCode AppControlProxy::DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType,
@ -90,7 +90,7 @@ ErrCode AppControlProxy::DeleteAppInstallControlRule(const AppInstallControlRule
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::DELETE_APP_INSTALL_CONTROL_RULE, data, reply);
return SendRequest(AppControlManagerInterfaceCode::DELETE_APP_INSTALL_CONTROL_RULE, data, reply);
}
ErrCode AppControlProxy::DeleteAppInstallControlRule(
@ -112,7 +112,7 @@ ErrCode AppControlProxy::DeleteAppInstallControlRule(
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::CLEAN_APP_INSTALL_CONTROL_RULE, data, reply);
return SendRequest(AppControlManagerInterfaceCode::CLEAN_APP_INSTALL_CONTROL_RULE, data, reply);
}
ErrCode AppControlProxy::GetAppInstallControlRule(
@ -132,7 +132,7 @@ ErrCode AppControlProxy::GetAppInstallControlRule(
APP_LOGE("write userId failed.");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
return GetParcelableInfos(IAppControlMgr::Message::GET_APP_INSTALL_CONTROL_RULE, data, appIds);
return GetParcelableInfos(AppControlManagerInterfaceCode::GET_APP_INSTALL_CONTROL_RULE, data, appIds);
}
ErrCode AppControlProxy::AddAppRunningControlRule(
@ -157,7 +157,7 @@ ErrCode AppControlProxy::AddAppRunningControlRule(
return ERR_APPEXECFWK_PARCEL_ERROR;
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::ADD_APP_RUNNING_CONTROL_RULE, data, reply);
return SendRequest(AppControlManagerInterfaceCode::ADD_APP_RUNNING_CONTROL_RULE, data, reply);
}
ErrCode AppControlProxy::DeleteAppRunningControlRule(
const std::vector<AppRunningControlRule> &controlRules, int32_t userId)
@ -182,7 +182,7 @@ ErrCode AppControlProxy::DeleteAppRunningControlRule(
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::DELETE_APP_RUNNING_CONTROL_RULE, data, reply);
return SendRequest(AppControlManagerInterfaceCode::DELETE_APP_RUNNING_CONTROL_RULE, data, reply);
}
ErrCode AppControlProxy::DeleteAppRunningControlRule(int32_t userId)
@ -199,7 +199,7 @@ ErrCode AppControlProxy::DeleteAppRunningControlRule(int32_t userId)
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::CLEAN_APP_RUNNING_CONTROL_RULE, data, reply);
return SendRequest(AppControlManagerInterfaceCode::CLEAN_APP_RUNNING_CONTROL_RULE, data, reply);
}
ErrCode AppControlProxy::GetAppRunningControlRule(int32_t userId, std::vector<std::string> &appIds)
@ -214,7 +214,7 @@ ErrCode AppControlProxy::GetAppRunningControlRule(int32_t userId, std::vector<st
APP_LOGE("write userId failed.");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
return GetParcelableInfos(IAppControlMgr::Message::GET_APP_RUNNING_CONTROL_RULE, data, appIds);
return GetParcelableInfos(AppControlManagerInterfaceCode::GET_APP_RUNNING_CONTROL_RULE, data, appIds);
}
ErrCode AppControlProxy::GetAppRunningControlRule(
@ -235,7 +235,7 @@ ErrCode AppControlProxy::GetAppRunningControlRule(
return ERR_APPEXECFWK_PARCEL_ERROR;
}
return GetParcelableInfo<AppRunningControlRuleResult>(
IAppControlMgr::Message::GET_APP_RUNNING_CONTROL_RULE_RESULT, data, controlRuleResult);
AppControlManagerInterfaceCode::GET_APP_RUNNING_CONTROL_RULE_RESULT, data, controlRuleResult);
}
ErrCode AppControlProxy::ConfirmAppJumpControlRule(const std::string &callerBundleName,
@ -263,7 +263,7 @@ ErrCode AppControlProxy::ConfirmAppJumpControlRule(const std::string &callerBund
return ERR_APPEXECFWK_PARCEL_ERROR;
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::CONFIRM_APP_JUMP_CONTROL_RULE, data, reply);
return SendRequest(AppControlManagerInterfaceCode::CONFIRM_APP_JUMP_CONTROL_RULE, data, reply);
}
ErrCode AppControlProxy::AddAppJumpControlRule(const std::vector<AppJumpControlRule> &controlRules, int32_t userId)
@ -287,7 +287,7 @@ ErrCode AppControlProxy::AddAppJumpControlRule(const std::vector<AppJumpControlR
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::ADD_APP_JUMP_CONTROL_RULE, data, reply);
return SendRequest(AppControlManagerInterfaceCode::ADD_APP_JUMP_CONTROL_RULE, data, reply);
}
ErrCode AppControlProxy::DeleteAppJumpControlRule(const std::vector<AppJumpControlRule> &controlRules, int32_t userId)
@ -306,7 +306,7 @@ ErrCode AppControlProxy::DeleteAppJumpControlRule(const std::vector<AppJumpContr
return ERR_APPEXECFWK_PARCEL_ERROR;
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::DELETE_APP_JUMP_CONTROL_RULE, data, reply);
return SendRequest(AppControlManagerInterfaceCode::DELETE_APP_JUMP_CONTROL_RULE, data, reply);
}
ErrCode AppControlProxy::DeleteRuleByCallerBundleName(const std::string &callerBundleName, int32_t userId)
@ -325,7 +325,7 @@ ErrCode AppControlProxy::DeleteRuleByCallerBundleName(const std::string &callerB
return ERR_APPEXECFWK_PARCEL_ERROR;
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::DELETE_APP_JUMP_CONTROL_RULE_BY_CALLER, data, reply);
return SendRequest(AppControlManagerInterfaceCode::DELETE_APP_JUMP_CONTROL_RULE_BY_CALLER, data, reply);
}
ErrCode AppControlProxy::DeleteRuleByTargetBundleName(const std::string &targetBundleName, int32_t userId)
@ -345,7 +345,7 @@ ErrCode AppControlProxy::DeleteRuleByTargetBundleName(const std::string &targetB
}
MessageParcel reply;
return SendRequest(IAppControlMgr::Message::DELETE_APP_JUMP_CONTROL_RULE_BY_TARGET, data, reply);
return SendRequest(AppControlManagerInterfaceCode::DELETE_APP_JUMP_CONTROL_RULE_BY_TARGET, data, reply);
}
ErrCode AppControlProxy::GetAppJumpControlRule(const std::string &callerBundleName,
@ -369,7 +369,7 @@ ErrCode AppControlProxy::GetAppJumpControlRule(const std::string &callerBundleNa
return ERR_APPEXECFWK_PARCEL_ERROR;
}
return GetParcelableInfo<AppJumpControlRule>(
IAppControlMgr::Message::GET_APP_JUMP_CONTROL_RULE, data, controlRule);
AppControlManagerInterfaceCode::GET_APP_JUMP_CONTROL_RULE, data, controlRule);
}
ErrCode AppControlProxy::SetDisposedStatus(const std::string &appId, const Want &want)
@ -389,7 +389,7 @@ ErrCode AppControlProxy::SetDisposedStatus(const std::string &appId, const Want
return ERR_APPEXECFWK_PARCEL_ERROR;
}
MessageParcel reply;
ErrCode ret = SendRequest(IAppControlMgr::Message::SET_DISPOSED_STATUS, data, reply);
ErrCode ret = SendRequest(AppControlManagerInterfaceCode::SET_DISPOSED_STATUS, data, reply);
if (ret != ERR_OK) {
APP_LOGE("SendRequest failed.");
return ret;
@ -416,7 +416,7 @@ ErrCode AppControlProxy::DeleteDisposedStatus(const std::string &appId)
}
MessageParcel reply;
ErrCode ret = SendRequest(IAppControlMgr::Message::DELETE_DISPOSED_STATUS, data, reply);
ErrCode ret = SendRequest(AppControlManagerInterfaceCode::DELETE_DISPOSED_STATUS, data, reply);
if (ret != ERR_OK) {
APP_LOGE("SendRequest failed.");
return ret;
@ -441,7 +441,7 @@ ErrCode AppControlProxy::GetDisposedStatus(const std::string &appId, Want &want)
APP_LOGE("write bundleName failed.");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
ErrCode ret = GetParcelableInfo<Want>(IAppControlMgr::Message::GET_DISPOSED_STATUS, data, want);
ErrCode ret = GetParcelableInfo<Want>(AppControlManagerInterfaceCode::GET_DISPOSED_STATUS, data, want);
if (ret != ERR_OK) {
APP_LOGE("host return error : %{public}d", ret);
return ret;
@ -484,7 +484,7 @@ bool AppControlProxy::WriteParcelableVector(const std::vector<T> &parcelableVect
}
template<typename T>
ErrCode AppControlProxy::GetParcelableInfo(IAppControlMgr::Message code, MessageParcel& data, T& parcelableInfo)
ErrCode AppControlProxy::GetParcelableInfo(AppControlManagerInterfaceCode code, MessageParcel& data, T& parcelableInfo)
{
MessageParcel reply;
int32_t ret = SendRequest(code, data, reply);
@ -507,7 +507,7 @@ ErrCode AppControlProxy::GetParcelableInfo(IAppControlMgr::Message code, Message
}
int32_t AppControlProxy::GetParcelableInfos(
IAppControlMgr::Message code, MessageParcel &data, std::vector<std::string> &stringVector)
AppControlManagerInterfaceCode code, MessageParcel &data, std::vector<std::string> &stringVector)
{
MessageParcel reply;
int32_t ret = SendRequest(code, data, reply);
@ -524,7 +524,7 @@ int32_t AppControlProxy::GetParcelableInfos(
return NO_ERROR;
}
int32_t AppControlProxy::SendRequest(IAppControlMgr::Message code, MessageParcel &data, MessageParcel &reply)
int32_t AppControlProxy::SendRequest(AppControlManagerInterfaceCode code, MessageParcel &data, MessageParcel &reply)
{
MessageOption option(MessageOption::TF_SYNC);
sptr<IRemoteObject> remote = Remote();
@ -532,7 +532,7 @@ int32_t AppControlProxy::SendRequest(IAppControlMgr::Message code, MessageParcel
APP_LOGE("failed to send request %{public}d due to remote object null.", code);
return ERR_BUNDLE_MANAGER_INTERNAL_ERROR;
}
int32_t result = remote->SendRequest(code, data, reply, option);
int32_t result = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
if (result != NO_ERROR) {
APP_LOGE("receive error code %{public}d in transact %{public}d", result, code);
}

View File

@ -18,6 +18,7 @@
#include "app_log_wrapper.h"
#include "bundle_memory_guard.h"
#include "ipc_types.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -44,7 +45,7 @@ int BundleEventCallbackHost::OnRemoteRequest(
}
switch (code) {
case static_cast<uint32_t>(IBundleEventCallback::Message::ON_RECEIVE_EVENT): {
case static_cast<uint32_t>(BundleEventCallbackInterfaceCode::ON_RECEIVE_EVENT): {
std::unique_ptr<EventFwk::CommonEventData> dataPtr(data.ReadParcelable<EventFwk::CommonEventData>());
if (dataPtr == nullptr) {
APP_LOGE("get CommonEventData failed");

View File

@ -20,6 +20,7 @@
#include "app_log_wrapper.h"
#include "appexecfwk_errors.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -54,7 +55,7 @@ void BundleEventCallbackProxy::OnReceiveEvent(const EventFwk::CommonEventData ev
return;
}
int32_t ret = remote->SendRequest(
static_cast<int32_t>(IBundleEventCallback::Message::ON_RECEIVE_EVENT), data, reply, option);
static_cast<int32_t>(BundleEventCallbackInterfaceCode::ON_RECEIVE_EVENT), data, reply, option);
if (ret != ERR_OK) {
APP_LOGW("failed to SendRequest, errorCode : %{public}d", ret);
}

View File

@ -65,7 +65,7 @@ bool BundleInstallerProxy::Install(
return false;
}
return SendInstallRequest(IBundleInstaller::Message::INSTALL, data, reply, option);
return SendInstallRequest(BundleInstallerInterfaceCode::INSTALL, data, reply, option);
}
bool BundleInstallerProxy::Install(const std::vector<std::string> &bundleFilePaths, const InstallParam &installParam,
@ -93,7 +93,7 @@ bool BundleInstallerProxy::Install(const std::vector<std::string> &bundleFilePat
return false;
}
return SendInstallRequest(IBundleInstaller::Message::INSTALL_MULTIPLE_HAPS, data, reply,
return SendInstallRequest(BundleInstallerInterfaceCode::INSTALL_MULTIPLE_HAPS, data, reply,
option);
}
@ -117,7 +117,7 @@ bool BundleInstallerProxy::Recover(const std::string &bundleName,
return false;
}
return SendInstallRequest(IBundleInstaller::Message::RECOVER, data, reply,
return SendInstallRequest(BundleInstallerInterfaceCode::RECOVER, data, reply,
option);
}
@ -141,7 +141,7 @@ bool BundleInstallerProxy::Uninstall(
return false;
}
return SendInstallRequest(IBundleInstaller::Message::UNINSTALL, data, reply, option);
return SendInstallRequest(BundleInstallerInterfaceCode::UNINSTALL, data, reply, option);
}
bool BundleInstallerProxy::Uninstall(const std::string &bundleName, const std::string &modulePackage,
@ -165,7 +165,7 @@ bool BundleInstallerProxy::Uninstall(const std::string &bundleName, const std::s
return false;
}
return SendInstallRequest(IBundleInstaller::Message::UNINSTALL_MODULE, data, reply, option);
return SendInstallRequest(BundleInstallerInterfaceCode::UNINSTALL_MODULE, data, reply, option);
}
bool BundleInstallerProxy::Uninstall(const UninstallParam &uninstallParam,
@ -184,7 +184,7 @@ bool BundleInstallerProxy::Uninstall(const UninstallParam &uninstallParam,
APP_LOGE("write parcel failed");
return false;
}
return SendInstallRequest(IBundleInstaller::Message::UNINSTALL_BY_UNINSTALL_PARAM, data, reply, option);
return SendInstallRequest(BundleInstallerInterfaceCode::UNINSTALL_BY_UNINSTALL_PARAM, data, reply, option);
}
ErrCode BundleInstallerProxy::InstallSandboxApp(const std::string &bundleName, int32_t dlpType, int32_t userId,
@ -213,7 +213,7 @@ ErrCode BundleInstallerProxy::InstallSandboxApp(const std::string &bundleName, i
}
auto ret =
SendInstallRequest(IBundleInstaller::Message::INSTALL_SANDBOX_APP, data, reply, option);
SendInstallRequest(BundleInstallerInterfaceCode::INSTALL_SANDBOX_APP, data, reply, option);
if (!ret) {
APP_LOGE("install sandbox app failed due to send request fail");
return ERR_APPEXECFWK_SANDBOX_INSTALL_SEND_REQUEST_ERROR;
@ -251,7 +251,7 @@ ErrCode BundleInstallerProxy::UninstallSandboxApp(const std::string &bundleName,
}
auto ret =
SendInstallRequest(IBundleInstaller::Message::UNINSTALL_SANDBOX_APP, data, reply, option);
SendInstallRequest(BundleInstallerInterfaceCode::UNINSTALL_SANDBOX_APP, data, reply, option);
if (!ret) {
APP_LOGE("uninstall sandbox app failed due to send request fail");
return ERR_APPEXECFWK_SANDBOX_INSTALL_SEND_REQUEST_ERROR;
@ -290,7 +290,7 @@ sptr<IBundleStreamInstaller> BundleInstallerProxy::CreateStreamInstaller(const I
statusReceiver->OnFinished(ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR, "");
return nullptr;
}
bool res = SendInstallRequest(IBundleInstaller::Message::CREATE_STREAM_INSTALLER, data, reply, option);
bool res = SendInstallRequest(BundleInstallerInterfaceCode::CREATE_STREAM_INSTALLER, data, reply, option);
if (!res) {
APP_LOGE("CreateStreamInstaller failed due to send request fail");
statusReceiver->OnFinished(ERR_APPEXECFWK_INSTALL_INTERNAL_ERROR, "");
@ -326,7 +326,7 @@ bool BundleInstallerProxy::DestoryBundleStreamInstaller(uint32_t streamInstaller
PARCEL_WRITE_INTERFACE_TOKEN(data, GetDescriptor());
PARCEL_WRITE(data, Uint32, streamInstallerId);
bool res = SendInstallRequest(IBundleInstaller::Message::DESTORY_STREAM_INSTALLER, data, reply, option);
bool res = SendInstallRequest(BundleInstallerInterfaceCode::DESTORY_STREAM_INSTALLER, data, reply, option);
if (!res) {
APP_LOGE("CreateStreamInstaller failed due to send request fail");
return false;
@ -498,8 +498,8 @@ ErrCode BundleInstallerProxy::WriteSharedFileToStream(sptr<IBundleStreamInstalle
return ERR_OK;
}
bool BundleInstallerProxy::SendInstallRequest(const uint32_t& code, MessageParcel& data, MessageParcel& reply,
MessageOption& option)
bool BundleInstallerProxy::SendInstallRequest(
BundleInstallerInterfaceCode code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
{
sptr<IRemoteObject> remote = Remote();
if (remote == nullptr) {
@ -507,7 +507,7 @@ bool BundleInstallerProxy::SendInstallRequest(const uint32_t& code, MessageParce
return false;
}
int32_t ret = remote->SendRequest(code, data, reply, option);
int32_t ret = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
if (ret != NO_ERROR) {
APP_LOGE("fail to sendRequest, for transact is failed and error code is: %{public}d", ret);
return false;

View File

@ -20,6 +20,7 @@
#include "app_log_wrapper.h"
#include "bundle_memory_guard.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -46,7 +47,7 @@ int BundleStatusCallbackHost::OnRemoteRequest(
}
switch (code) {
case static_cast<uint32_t>(IBundleStatusCallback::Message::ON_BUNDLE_STATE_CHANGED): {
case static_cast<uint32_t>(BundleStatusCallbackInterfaceCode::ON_BUNDLE_STATE_CHANGED): {
uint8_t installType = data.ReadUint8();
int32_t resultCode = data.ReadInt32();
std::string resultMsg = Str16ToStr8(data.ReadString16());

View File

@ -21,6 +21,7 @@
#include "app_log_wrapper.h"
#include "appexecfwk_errors.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -209,7 +210,7 @@ void BundleStatusCallbackProxy::OnBundleStateChanged(
}
int32_t ret = remote->SendRequest(
static_cast<int32_t>(IBundleStatusCallback::Message::ON_BUNDLE_STATE_CHANGED), data, reply, option);
static_cast<int32_t>(BundleStatusCallbackInterfaceCode::ON_BUNDLE_STATE_CHANGED), data, reply, option);
if (ret != NO_ERROR) {
APP_LOGW("fail to call OnBundleStateChanged, for transact is failed, error code is: %{public}d", ret);
}

View File

@ -19,6 +19,7 @@
#include "appexecfwk_errors.h"
#include "bundle_memory_guard.h"
#include "ipc_types.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -84,16 +85,18 @@ ErrCode BundleStreamInstallerHost::HandleInstall(MessageParcel &data, MessagePar
void BundleStreamInstallerHost::init()
{
funcMap_.emplace(StreamMessage::CREATE_STREAM, [this](MessageParcel &data, MessageParcel &reply)->ErrCode {
return this->HandleCreateStream(data, reply);
});
funcMap_.emplace(StreamMessage::CREATE_SHARED_BUNDLE_STREAM,
funcMap_.emplace(static_cast<uint32_t>(BundleStreamInstallerInterfaceCode::CREATE_STREAM),
[this](MessageParcel &data, MessageParcel &reply)->ErrCode {
return this->HandleCreateStream(data, reply);
});
funcMap_.emplace(static_cast<uint32_t>(BundleStreamInstallerInterfaceCode::CREATE_SHARED_BUNDLE_STREAM),
[this](MessageParcel &data, MessageParcel &reply)->ErrCode {
return this->HandleCreateSharedBundleStream(data, reply);
});
funcMap_.emplace(StreamMessage::STREAM_INSTALL, [this](MessageParcel &data, MessageParcel &reply)->ErrCode {
return this->HandleInstall(data, reply);
});
funcMap_.emplace(static_cast<uint32_t>(BundleStreamInstallerInterfaceCode::STREAM_INSTALL),
[this](MessageParcel &data, MessageParcel &reply)->ErrCode {
return this->HandleInstall(data, reply);
});
}
} // AppExecFwk
} // OHOS

View File

@ -52,7 +52,7 @@ int BundleStreamInstallerProxy::CreateStream(const std::string &hapName)
}
MessageParcel reply;
if (!SendStreamInstallRequest(IBundleStreamInstaller::StreamMessage::CREATE_STREAM, data, reply)) {
if (!SendStreamInstallRequest(BundleStreamInstallerInterfaceCode::CREATE_STREAM, data, reply)) {
APP_LOGE("fail to SendStreamInstallRequest");
return fd;
}
@ -93,7 +93,7 @@ int BundleStreamInstallerProxy::CreateSharedBundleStream(const std::string &hspN
}
MessageParcel reply;
if (!SendStreamInstallRequest(IBundleStreamInstaller::StreamMessage::CREATE_SHARED_BUNDLE_STREAM, data, reply)) {
if (!SendStreamInstallRequest(BundleStreamInstallerInterfaceCode::CREATE_SHARED_BUNDLE_STREAM, data, reply)) {
APP_LOGE("fail to SendStreamInstallRequest");
return fd;
}
@ -121,7 +121,7 @@ bool BundleStreamInstallerProxy::Install()
}
MessageParcel reply;
bool res = SendStreamInstallRequest(IBundleStreamInstaller::StreamMessage::STREAM_INSTALL, data, reply);
bool res = SendStreamInstallRequest(BundleStreamInstallerInterfaceCode::STREAM_INSTALL, data, reply);
if (!res) {
APP_LOGE("fail to SendStreamInstallRequest");
return res;
@ -140,8 +140,8 @@ void BundleStreamInstallerProxy::SetInstallerId(uint32_t installerId)
installerId_ = installerId;
}
bool BundleStreamInstallerProxy::SendStreamInstallRequest(const uint32_t& code, MessageParcel& data,
MessageParcel& reply)
bool BundleStreamInstallerProxy::SendStreamInstallRequest(
BundleStreamInstallerInterfaceCode code, MessageParcel& data, MessageParcel& reply)
{
sptr<IRemoteObject> remote = Remote();
if (remote == nullptr) {
@ -150,7 +150,7 @@ bool BundleStreamInstallerProxy::SendStreamInstallRequest(const uint32_t& code,
}
MessageOption option(MessageOption::TF_SYNC);
int32_t ret = remote->SendRequest(code, data, reply, option);
int32_t ret = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
if (ret != NO_ERROR) {
APP_LOGE("fail to sendRequest, for transact is failed and error code is: %{public}d", ret);
return false;

View File

@ -19,6 +19,7 @@
#include "app_log_wrapper.h"
#include "bundle_memory_guard.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -45,7 +46,7 @@ int CleanCacheCallbackHost::OnRemoteRequest(
}
switch (code) {
case static_cast<uint32_t>(ICleanCacheCallback::Message::ON_CLEAN_CACHE_CALLBACK): {
case static_cast<uint32_t>(CleanCacheCallbackInterfaceCode::ON_CLEAN_CACHE_CALLBACK): {
bool succeed = data.ReadBool();
OnCleanCacheFinished(succeed);
break;

View File

@ -19,6 +19,7 @@
#include "parcel.h"
#include "app_log_wrapper.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -56,7 +57,7 @@ void CleanCacheCallbackProxy::OnCleanCacheFinished(bool succeeded)
}
int32_t ret = remote->SendRequest(
static_cast<int32_t>(ICleanCacheCallback::Message::ON_CLEAN_CACHE_CALLBACK), data, reply, option);
static_cast<int32_t>(CleanCacheCallbackInterfaceCode::ON_CLEAN_CACHE_CALLBACK), data, reply, option);
if (ret != NO_ERROR) {
APP_LOGW("fail to call OnCleanCacheFinished, for transact is failed, error code is: %{public}d", ret);
}

View File

@ -20,6 +20,7 @@
#include "app_log_wrapper.h"
#include "bundle_memory_guard.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -45,13 +46,13 @@ int StatusReceiverHost::OnRemoteRequest(uint32_t code, MessageParcel &data, Mess
}
switch (code) {
case static_cast<uint32_t>(IStatusReceiver::Message::ON_FINISHED): {
case static_cast<uint32_t>(StatusReceiverInterfaceCode::ON_FINISHED): {
int32_t resultCode = data.ReadInt32();
std::string resultMsg = Str16ToStr8(data.ReadString16());
OnFinished(resultCode, resultMsg);
break;
}
case static_cast<uint32_t>(IStatusReceiver::Message::ON_STATUS_NOTIFY): {
case static_cast<uint32_t>(StatusReceiverInterfaceCode::ON_STATUS_NOTIFY): {
int32_t progress = data.ReadInt32();
OnStatusNotify(progress);
break;

View File

@ -20,6 +20,7 @@
#include "bundle_memory_guard.h"
#include "hitrace_meter.h"
#include "ipc_types.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -46,13 +47,13 @@ int DefaultAppHost::OnRemoteRequest(
}
switch (code) {
case IDefaultApp::Message::IS_DEFAULT_APPLICATION:
case static_cast<uint32_t>(DefaultAppInterfaceCode::IS_DEFAULT_APPLICATION):
return HandleIsDefaultApplication(data, reply);
case IDefaultApp::Message::GET_DEFAULT_APPLICATION:
case static_cast<uint32_t>(DefaultAppInterfaceCode::GET_DEFAULT_APPLICATION):
return HandleGetDefaultApplication(data, reply);
case IDefaultApp::Message::SET_DEFAULT_APPLICATION:
case static_cast<uint32_t>(DefaultAppInterfaceCode::SET_DEFAULT_APPLICATION):
return HandleSetDefaultApplication(data, reply);
case IDefaultApp::Message::RESET_DEFAULT_APPLICATION:
case static_cast<uint32_t>(DefaultAppInterfaceCode::RESET_DEFAULT_APPLICATION):
return HandleResetDefaultApplication(data, reply);
default:
APP_LOGW("DefaultAppHost receive unknown code, code = %{public}d", code);

View File

@ -50,7 +50,7 @@ ErrCode DefaultAppProxy::IsDefaultApplication(const std::string& type, bool& isD
}
MessageParcel reply;
if (!SendRequest(IDefaultApp::Message::IS_DEFAULT_APPLICATION, data, reply)) {
if (!SendRequest(DefaultAppInterfaceCode::IS_DEFAULT_APPLICATION, data, reply)) {
APP_LOGE("SendRequest failed.");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
@ -84,7 +84,7 @@ ErrCode DefaultAppProxy::GetDefaultApplication(int32_t userId, const std::string
APP_LOGE("write type failed.");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
return GetParcelableInfo<BundleInfo>(IDefaultApp::Message::GET_DEFAULT_APPLICATION, data, bundleInfo);
return GetParcelableInfo<BundleInfo>(DefaultAppInterfaceCode::GET_DEFAULT_APPLICATION, data, bundleInfo);
}
ErrCode DefaultAppProxy::SetDefaultApplication(int32_t userId, const std::string& type, const Want& want)
@ -111,7 +111,7 @@ ErrCode DefaultAppProxy::SetDefaultApplication(int32_t userId, const std::string
}
MessageParcel reply;
if (!SendRequest(IDefaultApp::Message::SET_DEFAULT_APPLICATION, data, reply)) {
if (!SendRequest(DefaultAppInterfaceCode::SET_DEFAULT_APPLICATION, data, reply)) {
APP_LOGE("SendRequest failed.");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
@ -144,7 +144,7 @@ ErrCode DefaultAppProxy::ResetDefaultApplication(int32_t userId, const std::stri
}
MessageParcel reply;
if (!SendRequest(IDefaultApp::Message::RESET_DEFAULT_APPLICATION, data, reply)) {
if (!SendRequest(DefaultAppInterfaceCode::RESET_DEFAULT_APPLICATION, data, reply)) {
APP_LOGE("SendRequest failed.");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
@ -153,7 +153,7 @@ ErrCode DefaultAppProxy::ResetDefaultApplication(int32_t userId, const std::stri
}
template<typename T>
ErrCode DefaultAppProxy::GetParcelableInfo(IDefaultApp::Message code, MessageParcel& data, T& parcelableInfo)
ErrCode DefaultAppProxy::GetParcelableInfo(DefaultAppInterfaceCode code, MessageParcel& data, T& parcelableInfo)
{
MessageParcel reply;
if (!SendRequest(code, data, reply)) {
@ -176,7 +176,7 @@ ErrCode DefaultAppProxy::GetParcelableInfo(IDefaultApp::Message code, MessagePar
return ERR_OK;
}
bool DefaultAppProxy::SendRequest(IDefaultApp::Message code, MessageParcel& data, MessageParcel& reply)
bool DefaultAppProxy::SendRequest(DefaultAppInterfaceCode code, MessageParcel& data, MessageParcel& reply)
{
MessageOption option(MessageOption::TF_SYNC);
sptr<IRemoteObject> remote = Remote();
@ -184,7 +184,7 @@ bool DefaultAppProxy::SendRequest(IDefaultApp::Message code, MessageParcel& data
APP_LOGE("failed to send request %{public}d due to remote object null.", code);
return false;
}
int32_t result = remote->SendRequest(code, data, reply, option);
int32_t result = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
if (result != NO_ERROR) {
APP_LOGE("receive error code %{public}d in transact %{public}d", result, code);
return false;

View File

@ -20,6 +20,7 @@
#include "bundle_memory_guard.h"
#include "hitrace_meter.h"
#include "ipc_types.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -36,22 +37,23 @@ OverlayManagerHost::~OverlayManagerHost()
void OverlayManagerHost::init()
{
funcMap_.emplace(IOverlayManager::Message::GET_ALL_OVERLAY_MODULE_INFO,
funcMap_.emplace(static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_ALL_OVERLAY_MODULE_INFO),
&OverlayManagerHost::HandleGetAllOverlayModuleInfo);
funcMap_.emplace(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO_BY_NAME,
funcMap_.emplace(static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO_BY_NAME),
&OverlayManagerHost::HandleGetOverlayModuleInfoByName);
funcMap_.emplace(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO,
funcMap_.emplace(static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO),
&OverlayManagerHost::HandleGetOverlayModuleInfo);
funcMap_.emplace(IOverlayManager::Message::GET_TARGET_OVERLAY_MODULE_INFOS,
funcMap_.emplace(static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_TARGET_OVERLAY_MODULE_INFOS),
&OverlayManagerHost::HandleGetTargetOverlayModuleInfo);
funcMap_.emplace(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO_BY_BUNDLE_NAME,
funcMap_.emplace(static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO_BY_BUNDLE_NAME),
&OverlayManagerHost::HandleGetOverlayModuleInfoByBundleName);
funcMap_.emplace(IOverlayManager::Message::GET_OVERLAY_BUNDLE_INFO_FOR_TARGET,
funcMap_.emplace(static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_BUNDLE_INFO_FOR_TARGET),
&OverlayManagerHost::HandleGetOverlayBundleInfoForTarget);
funcMap_.emplace(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO_FOR_TARGET,
funcMap_.emplace(static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO_FOR_TARGET),
&OverlayManagerHost::HandleGetOverlayModuleInfoForTarget);
funcMap_.emplace(IOverlayManager::Message::SET_OVERLAY_ENABLED, &OverlayManagerHost::HandleSetOverlayEnabled);
funcMap_.emplace(IOverlayManager::Message::SET_OVERLAY_ENABLED_FOR_SELF,
funcMap_.emplace(static_cast<uint32_t>(OverlayManagerInterfaceCode::SET_OVERLAY_ENABLED),
&OverlayManagerHost::HandleSetOverlayEnabled);
funcMap_.emplace(static_cast<uint32_t>(OverlayManagerInterfaceCode::SET_OVERLAY_ENABLED_FOR_SELF),
&OverlayManagerHost::HandleSetOverlayEnabledForSelf);
}

View File

@ -60,7 +60,7 @@ ErrCode OverlayManagerProxy::GetAllOverlayModuleInfo(const std::string &bundleNa
}
return GetParcelableInfosWithErrCode<OverlayModuleInfo>(
IOverlayManager::Message::GET_ALL_OVERLAY_MODULE_INFO, data, overlayModuleInfo);
OverlayManagerInterfaceCode::GET_ALL_OVERLAY_MODULE_INFO, data, overlayModuleInfo);
}
ErrCode OverlayManagerProxy::GetOverlayModuleInfo(const std::string &bundleName, const std::string &moduleName,
@ -92,7 +92,7 @@ ErrCode OverlayManagerProxy::GetOverlayModuleInfo(const std::string &bundleName,
return ERR_APPEXECFWK_PARCEL_ERROR;
}
return GetParcelableInfo(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO_BY_NAME, data, overlayModuleInfo);
return GetParcelableInfo(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO_BY_NAME, data, overlayModuleInfo);
}
ErrCode OverlayManagerProxy::GetOverlayModuleInfo(const std::string &moduleName,
@ -120,7 +120,7 @@ ErrCode OverlayManagerProxy::GetOverlayModuleInfo(const std::string &moduleName,
return ERR_APPEXECFWK_PARCEL_ERROR;
}
return GetParcelableInfo(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO, data, overlayModuleInfo);
return GetParcelableInfo(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO, data, overlayModuleInfo);
}
ErrCode OverlayManagerProxy::GetTargetOverlayModuleInfo(const std::string &targetModuleName,
@ -150,7 +150,7 @@ ErrCode OverlayManagerProxy::GetTargetOverlayModuleInfo(const std::string &targe
}
return GetParcelableInfosWithErrCode<OverlayModuleInfo>(
IOverlayManager::Message::GET_TARGET_OVERLAY_MODULE_INFOS, data, overlayModuleInfos);
OverlayManagerInterfaceCode::GET_TARGET_OVERLAY_MODULE_INFOS, data, overlayModuleInfos);
}
ErrCode OverlayManagerProxy::GetOverlayModuleInfoByBundleName(const std::string &bundleName,
@ -183,7 +183,7 @@ ErrCode OverlayManagerProxy::GetOverlayModuleInfoByBundleName(const std::string
}
return GetParcelableInfosWithErrCode<OverlayModuleInfo>(
IOverlayManager::Message::GET_OVERLAY_MODULE_INFO_BY_BUNDLE_NAME, data, overlayModuleInfos);
OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO_BY_BUNDLE_NAME, data, overlayModuleInfos);
}
ErrCode OverlayManagerProxy::GetOverlayModuleInfoForTarget(const std::string &targetBundleName,
@ -217,7 +217,7 @@ ErrCode OverlayManagerProxy::GetOverlayModuleInfoForTarget(const std::string &ta
}
return GetParcelableInfosWithErrCode<OverlayModuleInfo>(
IOverlayManager::Message::GET_OVERLAY_MODULE_INFO_FOR_TARGET, data, overlayModuleInfo);
OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO_FOR_TARGET, data, overlayModuleInfo);
}
ErrCode OverlayManagerProxy::SetOverlayEnabledForSelf(const std::string &moduleName, bool isEnabled,
@ -250,7 +250,7 @@ ErrCode OverlayManagerProxy::SetOverlayEnabledForSelf(const std::string &moduleN
}
MessageParcel reply;
if (!SendTransactCmd(IOverlayManager::Message::SET_OVERLAY_ENABLED_FOR_SELF, data, reply)) {
if (!SendTransactCmd(OverlayManagerInterfaceCode::SET_OVERLAY_ENABLED_FOR_SELF, data, reply)) {
APP_LOGE("SendTransactCmd failed");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
@ -294,7 +294,7 @@ ErrCode OverlayManagerProxy::SetOverlayEnabled(const std::string &bundleName, co
}
MessageParcel reply;
if (!SendTransactCmd(IOverlayManager::Message::SET_OVERLAY_ENABLED, data, reply)) {
if (!SendTransactCmd(OverlayManagerInterfaceCode::SET_OVERLAY_ENABLED, data, reply)) {
APP_LOGE("SendTransactCmd failed");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
@ -332,11 +332,11 @@ ErrCode OverlayManagerProxy::GetOverlayBundleInfoForTarget(const std::string &ta
}
return GetParcelableInfosWithErrCode<OverlayBundleInfo>(
IOverlayManager::Message::GET_OVERLAY_BUNDLE_INFO_FOR_TARGET, data, overlayBundleInfo);
OverlayManagerInterfaceCode::GET_OVERLAY_BUNDLE_INFO_FOR_TARGET, data, overlayBundleInfo);
}
template<typename T>
ErrCode OverlayManagerProxy::GetParcelableInfo(IOverlayManager::Message code, MessageParcel &data, T &parcelableInfo)
ErrCode OverlayManagerProxy::GetParcelableInfo(OverlayManagerInterfaceCode code, MessageParcel &data, T &parcelableInfo)
{
MessageParcel reply;
if (!SendTransactCmd(code, data, reply)) {
@ -361,7 +361,7 @@ ErrCode OverlayManagerProxy::GetParcelableInfo(IOverlayManager::Message code, Me
}
template<typename T>
ErrCode OverlayManagerProxy::GetParcelableInfosWithErrCode(IOverlayManager::Message code, MessageParcel &data,
ErrCode OverlayManagerProxy::GetParcelableInfosWithErrCode(OverlayManagerInterfaceCode code, MessageParcel &data,
std::vector<T> &parcelableInfos)
{
MessageParcel reply;
@ -388,7 +388,7 @@ ErrCode OverlayManagerProxy::GetParcelableInfosWithErrCode(IOverlayManager::Mess
return res;
}
bool OverlayManagerProxy::SendTransactCmd(IOverlayManager::Message code, MessageParcel &data, MessageParcel &reply)
bool OverlayManagerProxy::SendTransactCmd(OverlayManagerInterfaceCode code, MessageParcel &data, MessageParcel &reply)
{
MessageOption option(MessageOption::TF_SYNC);
@ -397,7 +397,7 @@ bool OverlayManagerProxy::SendTransactCmd(IOverlayManager::Message code, Message
APP_LOGE("fail to send transact cmd %{public}d due to remote object", code);
return false;
}
int32_t result = remote->SendRequest(code, data, reply, option);
int32_t result = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
if (result != NO_ERROR) {
APP_LOGE("receive error transact code %{public}d in transact cmd %{public}d", result, code);
return false;

View File

@ -23,6 +23,7 @@
#include "bundle_memory_guard.h"
#include "hitrace_meter.h"
#include "ipc_types.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -49,13 +50,13 @@ int QuickFixManagerHost::OnRemoteRequest(uint32_t code, MessageParcel& data,
}
switch (code) {
case IQuickFixManager::Message::DEPLOY_QUICK_FIX:
case static_cast<uint32_t>(QuickFixManagerInterfaceCode::DEPLOY_QUICK_FIX):
return HandleDeployQuickFix(data, reply);
case IQuickFixManager::Message::SWITCH_QUICK_FIX:
case static_cast<uint32_t>(QuickFixManagerInterfaceCode::SWITCH_QUICK_FIX):
return HandleSwitchQuickFix(data, reply);
case IQuickFixManager::Message::DELETE_QUICK_FIX:
case static_cast<uint32_t>(QuickFixManagerInterfaceCode::DELETE_QUICK_FIX):
return HandleDeleteQuickFix(data, reply);
case IQuickFixManager::Message::CREATE_FD:
case static_cast<uint32_t>(QuickFixManagerInterfaceCode::CREATE_FD):
return HandleCreateFd(data, reply);
default:
APP_LOGW("QuickFixManagerHost receive unknown code, code = %{public}d", code);

View File

@ -68,7 +68,7 @@ ErrCode QuickFixManagerProxy::DeployQuickFix(const std::vector<std::string> &bun
}
MessageParcel reply;
if (!SendRequest(IQuickFixManager::Message::DEPLOY_QUICK_FIX, data, reply)) {
if (!SendRequest(QuickFixManagerInterfaceCode::DEPLOY_QUICK_FIX, data, reply)) {
APP_LOGE("SendRequest failed.");
return ERR_BUNDLEMANAGER_QUICK_FIX_SEND_REQUEST_FAILED;
}
@ -106,7 +106,7 @@ ErrCode QuickFixManagerProxy::SwitchQuickFix(const std::string &bundleName, bool
}
MessageParcel reply;
if (!SendRequest(IQuickFixManager::Message::SWITCH_QUICK_FIX, data, reply)) {
if (!SendRequest(QuickFixManagerInterfaceCode::SWITCH_QUICK_FIX, data, reply)) {
APP_LOGE("SendRequest failed.");
return ERR_BUNDLEMANAGER_QUICK_FIX_SEND_REQUEST_FAILED;
}
@ -140,7 +140,7 @@ ErrCode QuickFixManagerProxy::DeleteQuickFix(const std::string &bundleName,
}
MessageParcel reply;
if (!SendRequest(IQuickFixManager::Message::DELETE_QUICK_FIX, data, reply)) {
if (!SendRequest(QuickFixManagerInterfaceCode::DELETE_QUICK_FIX, data, reply)) {
APP_LOGE("SendRequest failed.");
return ERR_BUNDLEMANAGER_QUICK_FIX_SEND_REQUEST_FAILED;
}
@ -165,7 +165,7 @@ ErrCode QuickFixManagerProxy::CreateFd(const std::string &fileName, int32_t &fd,
return ERR_APPEXECFWK_PARCEL_ERROR;
}
MessageParcel reply;
if (!SendRequest(IQuickFixManager::Message::CREATE_FD, data, reply)) {
if (!SendRequest(QuickFixManagerInterfaceCode::CREATE_FD, data, reply)) {
APP_LOGE("send request failed.");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
@ -241,7 +241,7 @@ ErrCode QuickFixManagerProxy::CopyFiles(
return ERR_OK;
}
bool QuickFixManagerProxy::SendRequest(IQuickFixManager::Message code, MessageParcel &data, MessageParcel &reply)
bool QuickFixManagerProxy::SendRequest(QuickFixManagerInterfaceCode code, MessageParcel &data, MessageParcel &reply)
{
MessageOption option(MessageOption::TF_SYNC);
sptr<IRemoteObject> remote = Remote();
@ -249,7 +249,7 @@ bool QuickFixManagerProxy::SendRequest(IQuickFixManager::Message code, MessagePa
APP_LOGE("failed to send request %{public}d due to remote object null.", code);
return false;
}
int32_t result = remote->SendRequest(code, data, reply, option);
int32_t result = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
if (result != NO_ERROR) {
APP_LOGE("receive error code %{public}d in transact %{public}d", result, code);
return false;

View File

@ -20,6 +20,7 @@
#include "bundle_memory_guard.h"
#include "ipc_types.h"
#include "string_ex.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -36,11 +37,11 @@ QuickFixStatusCallbackHost::~QuickFixStatusCallbackHost()
void QuickFixStatusCallbackHost::Init()
{
funcMap_.emplace(IQuickFixStatusCallback::Message::ON_PATCH_DEPLOYED,
funcMap_.emplace(static_cast<uint32_t>(QuickFixStatusCallbackInterfaceCode::ON_PATCH_DEPLOYED),
&QuickFixStatusCallbackHost::HandleOnPatchDeployed);
funcMap_.emplace(IQuickFixStatusCallback::Message::ON_PATCH_SWITCHED,
funcMap_.emplace(static_cast<uint32_t>(QuickFixStatusCallbackInterfaceCode::ON_PATCH_SWITCHED),
&QuickFixStatusCallbackHost::HandleOnPatchSwitched);
funcMap_.emplace(IQuickFixStatusCallback::Message::ON_PATCH_DELETED,
funcMap_.emplace(static_cast<uint32_t>(QuickFixStatusCallbackInterfaceCode::ON_PATCH_DELETED),
&QuickFixStatusCallbackHost::HandleOnPatchDeleted);
}

View File

@ -41,7 +41,7 @@ void QuickFixStatusCallbackProxy::OnPatchDeployed(const std::shared_ptr<QuickFix
MessageParcel reply;
WRITE_PARCEL_AND_RETURN(InterfaceToken, data, QuickFixStatusCallbackProxy::GetDescriptor());
WRITE_PARCEL_AND_RETURN(Parcelable, data, result.get());
if (!SendTransactCmd(IQuickFixStatusCallback::Message::ON_PATCH_DEPLOYED, data, reply)) {
if (!SendTransactCmd(QuickFixStatusCallbackInterfaceCode::ON_PATCH_DEPLOYED, data, reply)) {
APP_LOGE("fail to OnPatchDeployed due to transact command fail");
}
}
@ -52,7 +52,7 @@ void QuickFixStatusCallbackProxy::OnPatchSwitched(const std::shared_ptr<QuickFix
MessageParcel reply;
WRITE_PARCEL_AND_RETURN(InterfaceToken, data, QuickFixStatusCallbackProxy::GetDescriptor());
WRITE_PARCEL_AND_RETURN(Parcelable, data, result.get());
if (!SendTransactCmd(IQuickFixStatusCallback::Message::ON_PATCH_SWITCHED, data, reply)) {
if (!SendTransactCmd(QuickFixStatusCallbackInterfaceCode::ON_PATCH_SWITCHED, data, reply)) {
APP_LOGE("fail to OnPatchSwitched due to transact command fail");
}
}
@ -63,12 +63,13 @@ void QuickFixStatusCallbackProxy::OnPatchDeleted(const std::shared_ptr<QuickFixR
MessageParcel reply;
WRITE_PARCEL_AND_RETURN(InterfaceToken, data, QuickFixStatusCallbackProxy::GetDescriptor());
WRITE_PARCEL_AND_RETURN(Parcelable, data, result.get());
if (!SendTransactCmd(IQuickFixStatusCallback::Message::ON_PATCH_DELETED, data, reply)) {
if (!SendTransactCmd(QuickFixStatusCallbackInterfaceCode::ON_PATCH_DELETED, data, reply)) {
APP_LOGE("fail to OnPatchDeleted due to transact command fail");
}
}
bool QuickFixStatusCallbackProxy::SendTransactCmd(uint32_t code, MessageParcel &data, MessageParcel &reply)
bool QuickFixStatusCallbackProxy::SendTransactCmd(
QuickFixStatusCallbackInterfaceCode code, MessageParcel &data, MessageParcel &reply)
{
MessageOption option(MessageOption::TF_SYNC);
@ -77,7 +78,7 @@ bool QuickFixStatusCallbackProxy::SendTransactCmd(uint32_t code, MessageParcel &
APP_LOGE("fail to send transact cmd %{public}d due to remote object", code);
return false;
}
int32_t result = remote->SendRequest(code, data, reply, option);
int32_t result = remote->SendRequest(static_cast<uint32_t>(code), data, reply, option);
if (result != NO_ERROR) {
APP_LOGE("receive error transact code %{public}d in transact cmd %{public}d", result, code);
return false;

View File

@ -0,0 +1,57 @@
/*
* 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_BUNDLE_MANAGER_SERVICE_IPC_INTERFACE_CODE_H
#define OHOS_BUNDLE_MANAGER_SERVICE_IPC_INTERFACE_CODE_H
/* SAID: 401 */
namespace OHOS {
namespace AppExecFwk {
enum class BundleManagerCallbackInterfaceCode : uint32_t {
QUERY_RPC_ID_CALLBACK = 0,
};
enum class InstalldInterfaceCode : uint32_t {
CREATE_BUNDLE_DIR = 1,
EXTRACT_MODULE_FILES,
RENAME_MODULE_DIR,
CREATE_BUNDLE_DATA_DIR,
CLEAN_BUNDLE_DATA_DIR,
REMOVE_BUNDLE_DATA_DIR,
REMOVE_MODULE_DATA_DIR,
REMOVE_DIR,
GET_BUNDLE_STATS,
SET_DIR_APL,
GET_BUNDLE_CACHE_PATH,
SCAN_DIR,
MOVE_FILE,
COPY_FILE,
MKDIR,
GET_FILE_STAT,
EXTRACT_DIFF_FILES,
APPLY_DIFF_PATCH,
IS_EXIST_DIR,
IS_DIR_EMPTY,
OBTAIN_QUICK_FIX_DIR,
COPY_FILES,
EXTRACT_FILES,
GET_NATIVE_LIBRARY_FILE_NAMES,
EXECUTE_AOT,
IS_EXIST_FILE,
};
} // namespace AppExecFwk
} // namespace OHOS
#endif // OHOS_BUNDLE_MANAGER_SERVICE_IPC_INTERFACE_CODE_H

View File

@ -33,10 +33,6 @@ public:
* @param RpcIdResult the json of InstallResult
*/
virtual int32_t OnQueryRpcIdFinished(const std::string &RpcIdResult) = 0;
enum Message : uint32_t {
QUERY_RPC_ID_CALLBACK = 0,
};
};
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -269,36 +269,6 @@ public:
{
return ERR_OK;
}
protected:
enum Message : uint32_t {
CREATE_BUNDLE_DIR = 1,
EXTRACT_MODULE_FILES,
RENAME_MODULE_DIR,
CREATE_BUNDLE_DATA_DIR,
CLEAN_BUNDLE_DATA_DIR,
REMOVE_BUNDLE_DATA_DIR,
REMOVE_MODULE_DATA_DIR,
REMOVE_DIR,
GET_BUNDLE_STATS,
SET_DIR_APL,
GET_BUNDLE_CACHE_PATH,
SCAN_DIR,
MOVE_FILE,
COPY_FILE,
MKDIR,
GET_FILE_STAT,
EXTRACT_DIFF_FILES,
APPLY_DIFF_PATCH,
IS_EXIST_DIR,
IS_DIR_EMPTY,
OBTAIN_QUICK_FIX_DIR,
COPY_FILES,
EXTRACT_FILES,
GET_NATIVE_LIBRARY_FILE_NAMES,
EXECUTE_AOT,
IS_EXIST_FILE,
};
};
#define INSTALLD_PARCEL_WRITE_INTERFACE_TOKEN(parcel, token) \

View File

@ -21,6 +21,7 @@
#include "iremote_proxy.h"
#include "appexecfwk_errors.h"
#include "ipc/installd_interface.h"
#include "bundle_manager_services_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -151,7 +152,7 @@ public:
std::vector<std::string> &fileNames) override;
private:
ErrCode TransactInstalldCmd(uint32_t code, MessageParcel &data, MessageParcel &reply,
ErrCode TransactInstalldCmd(InstalldInterfaceCode code, MessageParcel &data, MessageParcel &reply,
MessageOption &option);
static inline BrokerDelegator<InstalldProxy> delegator_;
};

View File

@ -26,6 +26,7 @@
#include "bundle_permission_mgr.h"
#include "bundle_sandbox_app_helper.h"
#include "bundle_util.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -67,34 +68,34 @@ int BundleInstallerHost::OnRemoteRequest(
}
switch (code) {
case IBundleInstaller::Message::INSTALL:
case static_cast<uint32_t>(BundleInstallerInterfaceCode::INSTALL):
HandleInstallMessage(data);
break;
case IBundleInstaller::Message::INSTALL_MULTIPLE_HAPS:
case static_cast<uint32_t>(BundleInstallerInterfaceCode::INSTALL_MULTIPLE_HAPS):
HandleInstallMultipleHapsMessage(data);
break;
case IBundleInstaller::Message::UNINSTALL:
case static_cast<uint32_t>(BundleInstallerInterfaceCode::UNINSTALL):
HandleUninstallMessage(data);
break;
case IBundleInstaller::Message::UNINSTALL_MODULE:
case static_cast<uint32_t>(BundleInstallerInterfaceCode::UNINSTALL_MODULE):
HandleUninstallModuleMessage(data);
break;
case IBundleInstaller::Message::UNINSTALL_BY_UNINSTALL_PARAM:
case static_cast<uint32_t>(BundleInstallerInterfaceCode::UNINSTALL_BY_UNINSTALL_PARAM):
HandleUninstallByUninstallParam(data);
break;
case IBundleInstaller::Message::RECOVER:
case static_cast<uint32_t>(BundleInstallerInterfaceCode::RECOVER):
HandleRecoverMessage(data);
break;
case IBundleInstaller::Message::INSTALL_SANDBOX_APP:
case static_cast<uint32_t>(BundleInstallerInterfaceCode::INSTALL_SANDBOX_APP):
HandleInstallSandboxApp(data, reply);
break;
case IBundleInstaller::Message::UNINSTALL_SANDBOX_APP:
case static_cast<uint32_t>(BundleInstallerInterfaceCode::UNINSTALL_SANDBOX_APP):
HandleUninstallSandboxApp(data, reply);
break;
case IBundleInstaller::Message::CREATE_STREAM_INSTALLER:
case static_cast<uint32_t>(BundleInstallerInterfaceCode::CREATE_STREAM_INSTALLER):
HandleCreateStreamInstaller(data, reply);
break;
case IBundleInstaller::Message::DESTORY_STREAM_INSTALLER:
case static_cast<uint32_t>(BundleInstallerInterfaceCode::DESTORY_STREAM_INSTALLER):
HandleDestoryBundleStreamInstaller(data, reply);
break;
default:

View File

@ -19,6 +19,7 @@
#include "bundle_memory_guard.h"
#include "message_parcel.h"
#include "string_ex.h"
#include "bundle_manager_services_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -39,7 +40,7 @@ int32_t BundleManagerCallbackStub::OnRemoteRequest(
return OBJECT_NULL;
}
switch (code) {
case static_cast<uint32_t>(IBundleManagerCallback::Message::QUERY_RPC_ID_CALLBACK):
case static_cast<uint32_t>(BundleManagerCallbackInterfaceCode::QUERY_RPC_ID_CALLBACK):
return HandleQueryRpcIdCallBack(data, reply);
default:
APP_LOGW("BundleManagerCallbackStub receives unknown code, code = %{public}d", code);

View File

@ -21,6 +21,7 @@
#include "bundle_memory_guard.h"
#include "parcel_macro.h"
#include "string_ex.h"
#include "bundle_manager_services_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -37,32 +38,49 @@ InstalldHost::~InstalldHost()
void InstalldHost::init()
{
funcMap_.emplace(IInstalld::Message::CREATE_BUNDLE_DIR, &InstalldHost::HandleCreateBundleDir);
funcMap_.emplace(IInstalld::Message::EXTRACT_MODULE_FILES, &InstalldHost::HandleExtractModuleFiles);
funcMap_.emplace(IInstalld::Message::RENAME_MODULE_DIR, &InstalldHost::HandleRenameModuleDir);
funcMap_.emplace(IInstalld::Message::CREATE_BUNDLE_DATA_DIR, &InstalldHost::HandleCreateBundleDataDir);
funcMap_.emplace(IInstalld::Message::REMOVE_BUNDLE_DATA_DIR, &InstalldHost::HandleRemoveBundleDataDir);
funcMap_.emplace(IInstalld::Message::REMOVE_MODULE_DATA_DIR, &InstalldHost::HandleRemoveModuleDataDir);
funcMap_.emplace(IInstalld::Message::CLEAN_BUNDLE_DATA_DIR, &InstalldHost::HandleCleanBundleDataDir);
funcMap_.emplace(IInstalld::Message::SET_DIR_APL, &InstalldHost::HandleSetDirApl);
funcMap_.emplace(IInstalld::Message::REMOVE_DIR, &InstalldHost::HandleRemoveDir);
funcMap_.emplace(IInstalld::Message::GET_BUNDLE_STATS, &InstalldHost::HandleGetBundleStats);
funcMap_.emplace(IInstalld::Message::GET_BUNDLE_CACHE_PATH, &InstalldHost::HandleGetBundleCachePath);
funcMap_.emplace(IInstalld::Message::SCAN_DIR, &InstalldHost::HandleScanDir);
funcMap_.emplace(IInstalld::Message::MOVE_FILE, &InstalldHost::HandleMoveFile);
funcMap_.emplace(IInstalld::Message::COPY_FILE, &InstalldHost::HandleCopyFile);
funcMap_.emplace(IInstalld::Message::MKDIR, &InstalldHost::HandleMkdir);
funcMap_.emplace(IInstalld::Message::GET_FILE_STAT, &InstalldHost::HandleGetFileStat);
funcMap_.emplace(IInstalld::Message::EXTRACT_DIFF_FILES, &InstalldHost::HandleExtractDiffFiles);
funcMap_.emplace(IInstalld::Message::APPLY_DIFF_PATCH, &InstalldHost::HandleApplyDiffPatch);
funcMap_.emplace(IInstalld::Message::IS_EXIST_DIR, &InstalldHost::HandleIsExistDir);
funcMap_.emplace(IInstalld::Message::IS_DIR_EMPTY, &InstalldHost::HandleIsDirEmpty);
funcMap_.emplace(IInstalld::Message::OBTAIN_QUICK_FIX_DIR, &InstalldHost::HandObtainQuickFixFileDir);
funcMap_.emplace(IInstalld::Message::COPY_FILES, &InstalldHost::HandCopyFiles);
funcMap_.emplace(IInstalld::Message::EXTRACT_FILES, &InstalldHost::HandleExtractFiles);
funcMap_.emplace(IInstalld::Message::GET_NATIVE_LIBRARY_FILE_NAMES, &InstalldHost::HandGetNativeLibraryFileNames);
funcMap_.emplace(IInstalld::Message::EXECUTE_AOT, &InstalldHost::HandleExecuteAOT);
funcMap_.emplace(IInstalld::Message::IS_EXIST_FILE, &InstalldHost::HandleIsExistFile);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::CREATE_BUNDLE_DIR),
&InstalldHost::HandleCreateBundleDir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::EXTRACT_MODULE_FILES),
&InstalldHost::HandleExtractModuleFiles);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::RENAME_MODULE_DIR),
&InstalldHost::HandleRenameModuleDir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::CREATE_BUNDLE_DATA_DIR),
&InstalldHost::HandleCreateBundleDataDir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::REMOVE_BUNDLE_DATA_DIR),
&InstalldHost::HandleRemoveBundleDataDir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::REMOVE_MODULE_DATA_DIR),
&InstalldHost::HandleRemoveModuleDataDir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::CLEAN_BUNDLE_DATA_DIR),
&InstalldHost::HandleCleanBundleDataDir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::SET_DIR_APL), &InstalldHost::HandleSetDirApl);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::REMOVE_DIR), &InstalldHost::HandleRemoveDir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::GET_BUNDLE_STATS),
&InstalldHost::HandleGetBundleStats);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::GET_BUNDLE_CACHE_PATH),
&InstalldHost::HandleGetBundleCachePath);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::SCAN_DIR), &InstalldHost::HandleScanDir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::MOVE_FILE), &InstalldHost::HandleMoveFile);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::COPY_FILE), &InstalldHost::HandleCopyFile);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::MKDIR), &InstalldHost::HandleMkdir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::GET_FILE_STAT), &InstalldHost::HandleGetFileStat);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::EXTRACT_DIFF_FILES),
&InstalldHost::HandleExtractDiffFiles);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::APPLY_DIFF_PATCH),
&InstalldHost::HandleApplyDiffPatch);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::IS_EXIST_DIR), &InstalldHost::HandleIsExistDir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::IS_DIR_EMPTY), &InstalldHost::HandleIsDirEmpty);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::OBTAIN_QUICK_FIX_DIR),
&InstalldHost::HandObtainQuickFixFileDir);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::COPY_FILES),
&InstalldHost::HandCopyFiles);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::EXTRACT_FILES),
&InstalldHost::HandleExtractFiles);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::GET_NATIVE_LIBRARY_FILE_NAMES),
&InstalldHost::HandGetNativeLibraryFileNames);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::EXECUTE_AOT),
&InstalldHost::HandleExecuteAOT);
funcMap_.emplace(static_cast<uint32_t>(InstalldInterfaceCode::IS_EXIST_FILE),
&InstalldHost::HandleIsExistFile);
}
int InstalldHost::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)

View File

@ -46,7 +46,7 @@ ErrCode InstalldProxy::CreateBundleDir(const std::string &bundleDir)
MessageParcel reply;
MessageOption option;
return TransactInstalldCmd(IInstalld::Message::CREATE_BUNDLE_DIR, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::CREATE_BUNDLE_DIR, data, reply, option);
}
ErrCode InstalldProxy::ExtractModuleFiles(const std::string &srcModulePath, const std::string &targetPath,
@ -61,7 +61,7 @@ ErrCode InstalldProxy::ExtractModuleFiles(const std::string &srcModulePath, cons
MessageParcel reply;
MessageOption option;
return TransactInstalldCmd(IInstalld::Message::EXTRACT_MODULE_FILES, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::EXTRACT_MODULE_FILES, data, reply, option);
}
ErrCode InstalldProxy::ExtractFiles(const ExtractParam &extractParam)
@ -75,7 +75,7 @@ ErrCode InstalldProxy::ExtractFiles(const ExtractParam &extractParam)
MessageParcel reply;
MessageOption option;
return TransactInstalldCmd(IInstalld::Message::EXTRACT_FILES, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::EXTRACT_FILES, data, reply, option);
}
ErrCode InstalldProxy::ExecuteAOT(const AOTArgs &aotArgs)
@ -89,7 +89,7 @@ ErrCode InstalldProxy::ExecuteAOT(const AOTArgs &aotArgs)
MessageParcel reply;
MessageOption option;
return TransactInstalldCmd(IInstalld::Message::EXECUTE_AOT, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::EXECUTE_AOT, data, reply, option);
}
ErrCode InstalldProxy::RenameModuleDir(const std::string &oldPath, const std::string &newPath)
@ -101,7 +101,7 @@ ErrCode InstalldProxy::RenameModuleDir(const std::string &oldPath, const std::st
MessageParcel reply;
MessageOption option;
return TransactInstalldCmd(IInstalld::Message::RENAME_MODULE_DIR, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::RENAME_MODULE_DIR, data, reply, option);
}
ErrCode InstalldProxy::CreateBundleDataDir(const CreateDirParam &createDirParam)
@ -115,7 +115,7 @@ ErrCode InstalldProxy::CreateBundleDataDir(const CreateDirParam &createDirParam)
MessageParcel reply;
MessageOption option;
return TransactInstalldCmd(IInstalld::Message::CREATE_BUNDLE_DATA_DIR, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::CREATE_BUNDLE_DATA_DIR, data, reply, option);
}
ErrCode InstalldProxy::RemoveBundleDataDir(const std::string &bundleName, const int userid)
@ -127,7 +127,7 @@ ErrCode InstalldProxy::RemoveBundleDataDir(const std::string &bundleName, const
MessageParcel reply;
MessageOption option;
return TransactInstalldCmd(IInstalld::Message::REMOVE_BUNDLE_DATA_DIR, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::REMOVE_BUNDLE_DATA_DIR, data, reply, option);
}
ErrCode InstalldProxy::RemoveModuleDataDir(const std::string &ModuleName, const int userid)
@ -139,7 +139,7 @@ ErrCode InstalldProxy::RemoveModuleDataDir(const std::string &ModuleName, const
MessageParcel reply;
MessageOption option;
return TransactInstalldCmd(IInstalld::Message::REMOVE_MODULE_DATA_DIR, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::REMOVE_MODULE_DATA_DIR, data, reply, option);
}
ErrCode InstalldProxy::RemoveDir(const std::string &dir)
@ -150,7 +150,7 @@ ErrCode InstalldProxy::RemoveDir(const std::string &dir)
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
return TransactInstalldCmd(IInstalld::Message::REMOVE_DIR, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::REMOVE_DIR, data, reply, option);
}
ErrCode InstalldProxy::CleanBundleDataDir(const std::string &bundleDir)
@ -161,7 +161,7 @@ ErrCode InstalldProxy::CleanBundleDataDir(const std::string &bundleDir)
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC, WAIT_TIME);
return TransactInstalldCmd(IInstalld::Message::CLEAN_BUNDLE_DATA_DIR, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::CLEAN_BUNDLE_DATA_DIR, data, reply, option);
}
ErrCode InstalldProxy::GetBundleStats(
@ -173,7 +173,7 @@ ErrCode InstalldProxy::GetBundleStats(
INSTALLD_PARCEL_WRITE(data, Int32, userId);
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
auto ret = TransactInstalldCmd(IInstalld::Message::GET_BUNDLE_STATS, data, reply, option);
auto ret = TransactInstalldCmd(InstalldInterfaceCode::GET_BUNDLE_STATS, data, reply, option);
if (ret == ERR_OK) {
if (reply.ReadInt64Vector(&bundleStats)) {
return ERR_OK;
@ -197,7 +197,7 @@ ErrCode InstalldProxy::SetDirApl(const std::string &dir, const std::string &bund
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
return TransactInstalldCmd(IInstalld::Message::SET_DIR_APL, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::SET_DIR_APL, data, reply, option);
}
ErrCode InstalldProxy::GetBundleCachePath(const std::string &dir, std::vector<std::string> &cachePath)
@ -207,7 +207,7 @@ ErrCode InstalldProxy::GetBundleCachePath(const std::string &dir, std::vector<st
INSTALLD_PARCEL_WRITE(data, String16, Str8ToStr16(dir));
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
auto ret = TransactInstalldCmd(IInstalld::Message::GET_BUNDLE_CACHE_PATH, data, reply, option);
auto ret = TransactInstalldCmd(InstalldInterfaceCode::GET_BUNDLE_CACHE_PATH, data, reply, option);
if (ret == ERR_OK) {
if (reply.ReadStringVector(&cachePath)) {
return ERR_OK;
@ -229,7 +229,7 @@ ErrCode InstalldProxy::ScanDir(
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
auto ret = TransactInstalldCmd(IInstalld::Message::SCAN_DIR, data, reply, option);
auto ret = TransactInstalldCmd(InstalldInterfaceCode::SCAN_DIR, data, reply, option);
if (ret != ERR_OK) {
return ret;
}
@ -250,7 +250,7 @@ ErrCode InstalldProxy::MoveFile(const std::string &oldPath, const std::string &n
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
return TransactInstalldCmd(IInstalld::Message::MOVE_FILE, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::MOVE_FILE, data, reply, option);
}
ErrCode InstalldProxy::CopyFile(const std::string &oldPath, const std::string &newPath)
@ -262,7 +262,7 @@ ErrCode InstalldProxy::CopyFile(const std::string &oldPath, const std::string &n
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
return TransactInstalldCmd(IInstalld::Message::COPY_FILE, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::COPY_FILE, data, reply, option);
}
ErrCode InstalldProxy::Mkdir(
@ -277,7 +277,7 @@ ErrCode InstalldProxy::Mkdir(
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
return TransactInstalldCmd(IInstalld::Message::MKDIR, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::MKDIR, data, reply, option);
}
ErrCode InstalldProxy::GetFileStat(const std::string &file, FileStat &fileStat)
@ -288,7 +288,7 @@ ErrCode InstalldProxy::GetFileStat(const std::string &file, FileStat &fileStat)
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
auto ret = TransactInstalldCmd(IInstalld::Message::GET_FILE_STAT, data, reply, option);
auto ret = TransactInstalldCmd(InstalldInterfaceCode::GET_FILE_STAT, data, reply, option);
if (ret != ERR_OK) {
APP_LOGE("TransactInstalldCmd failed");
return ret;
@ -315,7 +315,7 @@ ErrCode InstalldProxy::ExtractDiffFiles(const std::string &filePath, const std::
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
return TransactInstalldCmd(IInstalld::Message::EXTRACT_DIFF_FILES, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::EXTRACT_DIFF_FILES, data, reply, option);
}
ErrCode InstalldProxy::ApplyDiffPatch(const std::string &oldSoPath, const std::string &diffFilePath,
@ -329,7 +329,7 @@ ErrCode InstalldProxy::ApplyDiffPatch(const std::string &oldSoPath, const std::s
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
return TransactInstalldCmd(IInstalld::Message::APPLY_DIFF_PATCH, data, reply, option);
return TransactInstalldCmd(InstalldInterfaceCode::APPLY_DIFF_PATCH, data, reply, option);
}
ErrCode InstalldProxy::IsExistDir(const std::string &dir, bool &isExist)
@ -340,7 +340,7 @@ ErrCode InstalldProxy::IsExistDir(const std::string &dir, bool &isExist)
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
auto ret = TransactInstalldCmd(IInstalld::Message::IS_EXIST_DIR, data, reply, option);
auto ret = TransactInstalldCmd(InstalldInterfaceCode::IS_EXIST_DIR, data, reply, option);
if (ret != ERR_OK) {
APP_LOGE("TransactInstalldCmd failed");
return ret;
@ -357,7 +357,7 @@ ErrCode InstalldProxy::IsExistFile(const std::string &path, bool &isExist)
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
auto ret = TransactInstalldCmd(IInstalld::Message::IS_EXIST_FILE, data, reply, option);
auto ret = TransactInstalldCmd(InstalldInterfaceCode::IS_EXIST_FILE, data, reply, option);
if (ret != ERR_OK) {
APP_LOGE("TransactInstalldCmd failed");
return ret;
@ -374,7 +374,7 @@ ErrCode InstalldProxy::IsDirEmpty(const std::string &dir, bool &isDirEmpty)
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
auto ret = TransactInstalldCmd(IInstalld::Message::IS_DIR_EMPTY, data, reply, option);
auto ret = TransactInstalldCmd(InstalldInterfaceCode::IS_DIR_EMPTY, data, reply, option);
if (ret != ERR_OK) {
APP_LOGE("TransactInstalldCmd failed");
return ret;
@ -391,7 +391,7 @@ ErrCode InstalldProxy::ObtainQuickFixFileDir(const std::string &dir, std::vector
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
auto ret = TransactInstalldCmd(IInstalld::Message::OBTAIN_QUICK_FIX_DIR, data, reply, option);
auto ret = TransactInstalldCmd(InstalldInterfaceCode::OBTAIN_QUICK_FIX_DIR, data, reply, option);
if (ret != ERR_OK) {
APP_LOGE("TransactInstalldCmd failed");
return ret;
@ -411,7 +411,7 @@ ErrCode InstalldProxy::CopyFiles(const std::string &sourceDir, const std::string
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
auto ret = TransactInstalldCmd(IInstalld::Message::COPY_FILES, data, reply, option);
auto ret = TransactInstalldCmd(InstalldInterfaceCode::COPY_FILES, data, reply, option);
if (ret != ERR_OK) {
APP_LOGE("TransactInstalldCmd failed");
return ret;
@ -429,7 +429,7 @@ ErrCode InstalldProxy::GetNativeLibraryFileNames(const std::string &filePath, co
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
auto ret = TransactInstalldCmd(IInstalld::Message::GET_NATIVE_LIBRARY_FILE_NAMES, data, reply, option);
auto ret = TransactInstalldCmd(InstalldInterfaceCode::GET_NATIVE_LIBRARY_FILE_NAMES, data, reply, option);
if (ret != ERR_OK) {
APP_LOGE("TransactInstalldCmd failed");
return ret;
@ -441,7 +441,7 @@ ErrCode InstalldProxy::GetNativeLibraryFileNames(const std::string &filePath, co
return ERR_OK;
}
ErrCode InstalldProxy::TransactInstalldCmd(uint32_t code, MessageParcel &data, MessageParcel &reply,
ErrCode InstalldProxy::TransactInstalldCmd(InstalldInterfaceCode code, MessageParcel &data, MessageParcel &reply,
MessageOption &option)
{
sptr<IRemoteObject> remote = Remote();
@ -450,7 +450,7 @@ ErrCode InstalldProxy::TransactInstalldCmd(uint32_t code, MessageParcel &data, M
return ERR_APPEXECFWK_INSTALL_INSTALLD_SERVICE_ERROR;
}
if (remote->SendRequest(code, data, reply, option) != OHOS::NO_ERROR) {
if (remote->SendRequest(static_cast<uint32_t>(code), data, reply, option) != OHOS::NO_ERROR) {
APP_LOGE("fail to send %{public}u request to service due to transact error", code);
return ERR_APPEXECFWK_INSTALL_INSTALLD_SERVICE_ERROR;
}

View File

@ -24,6 +24,7 @@
#include "app_log_wrapper.h"
#include "appexecfwk_errors.h"
#include "bundle_mgr_service.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
namespace OHOS {
namespace AppExecFwk {
@ -562,7 +563,8 @@ void StatusReceiverProxy::OnStatusNotify(const int32_t progress)
}
int32_t ret =
remote->SendRequest(static_cast<int32_t>(IStatusReceiver::Message::ON_STATUS_NOTIFY), data, reply, option);
remote->SendRequest(
static_cast<int32_t>(StatusReceiverInterfaceCode::ON_STATUS_NOTIFY), data, reply, option);
if (ret != NO_ERROR) {
APP_LOGE("fail to call OnStatusNotify, for transact is failed, error code is: %{public}d", ret);
}
@ -597,7 +599,8 @@ void StatusReceiverProxy::OnFinished(const int32_t resultCode, const std::string
return;
}
int32_t ret = remote->SendRequest(static_cast<int32_t>(IStatusReceiver::Message::ON_FINISHED), data, reply, option);
int32_t ret = remote->SendRequest(
static_cast<int32_t>(StatusReceiverInterfaceCode::ON_FINISHED), data, reply, option);
if (ret != NO_ERROR) {
APP_LOGE("fail to call OnFinished, for transact is failed, error code is: %{public}d", ret);
}

View File

@ -26,6 +26,7 @@
#include "mock_bundle_manager_callback_stub.h"
#include "bundle_distributed_manager.h"
#include "bundle_manager_callback_proxy.h"
#include "bundle_manager_services_ipc_interface_code.h"
#define private public
using namespace testing::ext;
@ -400,7 +401,7 @@ HWTEST_F(BmsBundleKitServiceBaseTest, BundleManagerCallbackProxy_0200, Function
HWTEST_F(BmsBundleKitServiceBaseTest, BundleManagerCallbackStub_0100, Function | MediumTest | Level1)
{
MockBundleManagerCallbackStub stub;
uint32_t code = IBundleManagerCallback::Message::QUERY_RPC_ID_CALLBACK;
uint32_t code = static_cast<uint32_t>(BundleManagerCallbackInterfaceCode::QUERY_RPC_ID_CALLBACK);
MessageParcel data;
MessageParcel reply;
MessageOption option;

View File

@ -19,6 +19,7 @@
#define private public
#include "overlay_manager_proxy.h"
#include "overlay_manager_host.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
#undef private
#include "bundle_overlay_manager_host_impl.h"
@ -442,8 +443,8 @@ HWTEST_F(BmsBundleOverlayIpcTest, OverlayIpcTest_1100, Function | SmallTest | Le
MessageParcel reply;
MessageOption option;
data.WriteInterfaceToken(OverlayManagerHost::GetDescriptor());
auto ret = overlayHost->OnRemoteRequest(IOverlayManager::Message::GET_ALL_OVERLAY_MODULE_INFO, data, reply,
option);
auto ret = overlayHost->OnRemoteRequest(
static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_ALL_OVERLAY_MODULE_INFO), data, reply, option);
EXPECT_EQ(ret, ERR_OK);
ret = reply.ReadInt32();
@ -471,7 +472,8 @@ HWTEST_F(BmsBundleOverlayIpcTest, OverlayIpcTest_1200, Function | SmallTest | Le
MessageParcel reply;
MessageOption option;
data.WriteInterfaceToken(OverlayManagerHost::GetDescriptor());
auto ret = overlayHost->OnRemoteRequest(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO, data, reply, option);
auto ret = overlayHost->OnRemoteRequest(
static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO), data, reply, option);
EXPECT_EQ(ret, ERR_OK);
ret = reply.ReadInt32();
@ -497,8 +499,8 @@ HWTEST_F(BmsBundleOverlayIpcTest, OverlayIpcTest_1300, Function | SmallTest | Le
MessageParcel reply;
MessageOption option;
data.WriteInterfaceToken(OverlayManagerHost::GetDescriptor());
auto ret = overlayHost->OnRemoteRequest(IOverlayManager::Message::GET_OVERLAY_BUNDLE_INFO_FOR_TARGET, data, reply,
option);
auto ret = overlayHost->OnRemoteRequest(
static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_BUNDLE_INFO_FOR_TARGET), data, reply, option);
EXPECT_EQ(ret, ERR_OK);
ret = reply.ReadInt32();
@ -526,8 +528,8 @@ HWTEST_F(BmsBundleOverlayIpcTest, OverlayIpcTest_1400, Function | SmallTest | Le
MessageParcel reply;
MessageOption option;
data.WriteInterfaceToken(OverlayManagerHost::GetDescriptor());
auto ret = overlayHost->OnRemoteRequest(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO_FOR_TARGET, data, reply,
option);
auto ret = overlayHost->OnRemoteRequest(
static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO_FOR_TARGET), data, reply, option);
EXPECT_EQ(ret, ERR_OK);
ret = reply.ReadInt32();
@ -556,8 +558,8 @@ HWTEST_F(BmsBundleOverlayIpcTest, OverlayIpcTest_1500, Function | SmallTest | Le
MessageParcel reply;
MessageOption option;
data.WriteInterfaceToken(TEST_HOST_DESCRIPTOR);
auto ret = overlayHost->OnRemoteRequest(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO_FOR_TARGET, data, reply,
option);
auto ret = overlayHost->OnRemoteRequest(
static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO_FOR_TARGET), data, reply, option);
EXPECT_EQ(ret, OBJECT_NULL);
}
@ -670,7 +672,8 @@ HWTEST_F(BmsBundleOverlayIpcTest, OverlayIpcTest_2200, Function | SmallTest | Le
MessageParcel reply;
MessageOption option;
data.WriteInterfaceToken(OverlayManagerHost::GetDescriptor());
auto ret = overlayHost->OnRemoteRequest(IOverlayManager::Message::SET_OVERLAY_ENABLED, data, reply, option);
auto ret = overlayHost->OnRemoteRequest(
static_cast<uint32_t>(OverlayManagerInterfaceCode::SET_OVERLAY_ENABLED), data, reply, option);
EXPECT_EQ(ret, ERR_OK);
ret = reply.ReadInt32();
EXPECT_EQ(ret, ERR_OK);
@ -799,8 +802,8 @@ HWTEST_F(BmsBundleOverlayIpcTest, OverlayIpcTest_3000, Function | SmallTest | Le
MessageParcel reply;
MessageOption option;
data.WriteInterfaceToken(OverlayManagerHost::GetDescriptor());
auto ret = overlayHost->OnRemoteRequest(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO_BY_NAME, data, reply,
option);
auto ret = overlayHost->OnRemoteRequest(
static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO_BY_NAME), data, reply, option);
EXPECT_EQ(ret, ERR_OK);
ret = reply.ReadInt32();
@ -826,8 +829,8 @@ HWTEST_F(BmsBundleOverlayIpcTest, OverlayIpcTest_3100, Function | SmallTest | Le
MessageParcel reply;
MessageOption option;
data.WriteInterfaceToken(OverlayManagerHost::GetDescriptor());
auto ret = overlayHost->OnRemoteRequest(IOverlayManager::Message::GET_TARGET_OVERLAY_MODULE_INFOS, data, reply,
option);
auto ret = overlayHost->OnRemoteRequest(
static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_TARGET_OVERLAY_MODULE_INFOS), data, reply, option);
EXPECT_EQ(ret, ERR_OK);
ret = reply.ReadInt32();
@ -855,8 +858,9 @@ HWTEST_F(BmsBundleOverlayIpcTest, OverlayIpcTest_3200, Function | SmallTest | Le
MessageParcel reply;
MessageOption option;
data.WriteInterfaceToken(OverlayManagerHost::GetDescriptor());
auto ret = overlayHost->OnRemoteRequest(IOverlayManager::Message::GET_OVERLAY_MODULE_INFO_BY_BUNDLE_NAME, data,
reply, option);
auto ret = overlayHost->OnRemoteRequest(
static_cast<uint32_t>(OverlayManagerInterfaceCode::GET_OVERLAY_MODULE_INFO_BY_BUNDLE_NAME),
data, reply, option);
EXPECT_EQ(ret, ERR_OK);
ret = reply.ReadInt32();
@ -884,8 +888,8 @@ HWTEST_F(BmsBundleOverlayIpcTest, OverlayIpcTest_3300, Function | SmallTest | Le
MessageParcel reply;
MessageOption option;
data.WriteInterfaceToken(OverlayManagerHost::GetDescriptor());
auto ret = overlayHost->OnRemoteRequest(IOverlayManager::Message::SET_OVERLAY_ENABLED_FOR_SELF, data, reply,
option);
auto ret = overlayHost->OnRemoteRequest(
static_cast<uint32_t>(OverlayManagerInterfaceCode::SET_OVERLAY_ENABLED_FOR_SELF), data, reply, option);
EXPECT_EQ(ret, ERR_OK);
ret = reply.ReadInt32();
EXPECT_EQ(ret, ERR_OK);

View File

@ -19,6 +19,7 @@
#define private public
#include "clean_cache_callback_host.h"
#include "bundle_user_mgr_host.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
#undef private
using namespace testing::ext;
@ -55,7 +56,7 @@ void BmsCleanCacheCallbackHostTest::TearDown() {}
*/
HWTEST_F(BmsCleanCacheCallbackHostTest, CleanCacheCallbackHost_001, TestSize.Level1)
{
uint32_t code = static_cast<uint32_t>(ICleanCacheCallback::Message::ON_CLEAN_CACHE_CALLBACK);
uint32_t code = static_cast<uint32_t>(CleanCacheCallbackInterfaceCode::ON_CLEAN_CACHE_CALLBACK);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -73,7 +74,7 @@ HWTEST_F(BmsCleanCacheCallbackHostTest, CleanCacheCallbackHost_001, TestSize.Lev
*/
HWTEST_F(BmsCleanCacheCallbackHostTest, CleanCacheCallbackHost_002, TestSize.Level1)
{
uint32_t code = static_cast<uint32_t>(ICleanCacheCallback::Message::ON_CLEAN_CACHE_CALLBACK);
uint32_t code = static_cast<uint32_t>(CleanCacheCallbackInterfaceCode::ON_CLEAN_CACHE_CALLBACK);
MessageParcel data;
sptr<MockCleanCacheCallbackHost> cleanCacheCallbackHost = new (std::nothrow) MockCleanCacheCallbackHost();
data.WriteInterfaceToken(CleanCacheCallbackHost::GetDescriptor());
@ -93,7 +94,7 @@ HWTEST_F(BmsCleanCacheCallbackHostTest, CleanCacheCallbackHost_002, TestSize.Lev
*/
HWTEST_F(BmsCleanCacheCallbackHostTest, CleanCacheCallbackHost_003, TestSize.Level1)
{
uint32_t code = static_cast<uint32_t>(ICleanCacheCallback::Message::ON_CLEAN_CACHE_CALLBACK) + 1;
uint32_t code = static_cast<uint32_t>(CleanCacheCallbackInterfaceCode::ON_CLEAN_CACHE_CALLBACK) + 1;
MessageParcel data;
sptr<MockCleanCacheCallbackHost> cleanCacheCallbackHost = new (std::nothrow) MockCleanCacheCallbackHost();
data.WriteInterfaceToken(CleanCacheCallbackHost::GetDescriptor());

View File

@ -19,6 +19,7 @@
#define private public
#include "bundle_stream_installer_host.h"
#include "bundle_user_mgr_host.h"
#include "bundle_appexecfwk_core_ipc_interface_code.h"
#undef private
using namespace testing::ext;
@ -91,7 +92,7 @@ HWTEST_F(BmsStreamInstallerHostTest, StreamInstallerHost_001, TestSize.Level1)
*/
HWTEST_F(BmsStreamInstallerHostTest, StreamInstallerHost_002, TestSize.Level1)
{
uint32_t code = BundleStreamInstallerHost::StreamMessage::STREAM_INSTALL;
uint32_t code = static_cast<uint32_t>(BundleStreamInstallerInterfaceCode::STREAM_INSTALL);
MessageParcel data;
MessageParcel reply;
MessageOption option;
@ -109,7 +110,7 @@ HWTEST_F(BmsStreamInstallerHostTest, StreamInstallerHost_002, TestSize.Level1)
*/
HWTEST_F(BmsStreamInstallerHostTest, StreamInstallerHost_003, TestSize.Level1)
{
uint32_t code = BundleStreamInstallerHost::StreamMessage::STREAM_INSTALL;
uint32_t code = static_cast<uint32_t>(BundleStreamInstallerInterfaceCode::STREAM_INSTALL);
MessageParcel data;
data.WriteInterfaceToken(BundleStreamInstallerHost::GetDescriptor());
MessageParcel reply;
@ -132,7 +133,7 @@ HWTEST_F(BmsStreamInstallerHostTest, StreamInstallerHost_003, TestSize.Level1)
*/
HWTEST_F(BmsStreamInstallerHostTest, StreamInstallerHost_004, TestSize.Level1)
{
uint32_t code = BundleStreamInstallerHost::StreamMessage::STREAM_INSTALL;
uint32_t code = static_cast<uint32_t>(BundleStreamInstallerInterfaceCode::STREAM_INSTALL);
MessageParcel data;
data.WriteInterfaceToken(BundleStreamInstallerHost::GetDescriptor());
MessageParcel reply;
@ -155,7 +156,7 @@ HWTEST_F(BmsStreamInstallerHostTest, StreamInstallerHost_004, TestSize.Level1)
*/
HWTEST_F(BmsStreamInstallerHostTest, StreamInstallerHost_005, TestSize.Level1)
{
uint32_t code = BundleStreamInstallerHost::StreamMessage::CREATE_STREAM;
uint32_t code = static_cast<uint32_t>(BundleStreamInstallerInterfaceCode::CREATE_STREAM);
MessageParcel data;
data.WriteInterfaceToken(BundleStreamInstallerHost::GetDescriptor());
MessageParcel reply;