Signed-off-by: zhongjianfei <zhongjianfei@huawei.com>
Change-Id: I4fe93032457e0f23b6d99be961b89467007cd61a
This commit is contained in:
openharmony_ci 2022-01-08 07:08:38 +00:00 committed by zhongjianfei
commit 44e452e71c
46 changed files with 428 additions and 215 deletions

View File

@ -1082,29 +1082,29 @@ group("unittest") {
testonly = true
deps = []
#deps += [
# ":ability_context_test",
# ":ability_impl_test",
# ":ability_lifecycle_executor_test",
# ":ability_lifecycle_test",
# ":ability_permission_test",
# ":ability_test",
# ":ability_thread_dataability_test",
# ":ability_thread_test",
# ":continuation_test",
# ":data_ability_helper_test",
# ":data_ability_impl_file_secondpart_test",
# ":data_ability_impl_file_test",
# ":data_ability_impl_test",
# ":data_ability_operation_test",
# ":data_ability_result_test",
# ":data_uri_utils_test",
# ":form_host_client_test",
# ":form_provider_client_test",
# ":pac_map_test",
# ":page_ability_impl_test",
# ":service_ability_impl_test",
# ":task_handler_client_test",
#]
deps += [
":ability_context_test",
":ability_impl_test",
":ability_lifecycle_executor_test",
":ability_lifecycle_test",
":ability_permission_test",
":ability_test",
":ability_thread_dataability_test",
":ability_thread_test",
":continuation_test",
":data_ability_helper_test",
":data_ability_impl_file_secondpart_test",
":data_ability_impl_file_test",
":data_ability_impl_test",
":data_ability_operation_test",
":data_ability_result_test",
":data_uri_utils_test",
":form_host_client_test",
":form_provider_client_test",
":pac_map_test",
":page_ability_impl_test",
":service_ability_impl_test",
":task_handler_client_test",
]
}
###############################################################################

View File

@ -22,6 +22,7 @@
#include "iremote_object.h"
#include "bundle_info.h"
#include "common_event_info.h"
#include "hap_module_info.h"
#include "ohos/aafwk/content/want.h"
#include "permission_def.h"
@ -191,7 +192,7 @@ public:
virtual bool IsSafeMode() = 0;
virtual bool CleanBundleCacheFiles(
const std::string &bundleName, const sptr<ICleanCacheCallback> &cleanCacheCallback) = 0;
virtual bool CleanBundleDataFiles(const std::string &bundleName) = 0;
virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId = 0) = 0;
virtual bool RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) = 0;
virtual bool ClearBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) = 0;
virtual bool UnregisterBundleStatusCallback() = 0;
@ -218,7 +219,15 @@ public:
virtual bool GetModuleUsageRecords(const int32_t number, std::vector<ModuleUsageRecord> &moduleUsageRecords) = 0;
virtual sptr<IBundleInstaller> GetBundleInstaller() = 0;
virtual bool NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime) = 0;
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid = 0) = 0;
virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector<int> &gids) = 0;
virtual bool QueryAbilityInfosByUri(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos) = 0;
virtual int CheckPermissionByUid(
const std::string &bundleName, const std::string &permission, const int userId) = 0;
virtual bool GetAllCommonEventInfo(const std::string &eventKey, std::vector<CommonEventInfo> &commonEventInfos) = 0;
virtual bool RemoveClonedBundle(const std::string &bundleName, const int32_t uid) = 0;
virtual bool BundleClone(const std::string &bundleName) = 0;
virtual bool CheckBundleNameInAllowList(const std::string &bundleName) = 0;
enum class Message {
GET_APPLICATION_INFO,
@ -278,4 +287,4 @@ public:
};
} // namespace AppExecFwk
} // namespace OHOS
#endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_BUNDLEMGR_INCLUDE_MOCK_BUNDLE_MGR_INTERFACE_H
#endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_BUNDLEMGR_INCLUDE_MOCK_BUNDLE_MGR_INTERFACE_H

View File

@ -186,6 +186,16 @@ public:
return 0;
}
virtual int StartUser(int userId) override
{
return 0;
}
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) override
{
return 0;
}
enum RequestCode {
E_STATE_INITIAL = 0,
E_STATE_INACTIVE,

View File

@ -166,7 +166,7 @@ bool BundleMgrProxy::CleanBundleCacheFiles(
{
return true;
}
bool BundleMgrProxy::CleanBundleDataFiles(const std::string &bundleName)
bool BundleMgrProxy::CleanBundleDataFiles(const std::string &bundleName, const int userId)
{
return true;
}
@ -256,7 +256,7 @@ sptr<IBundleInstaller> BundleMgrProxy::GetBundleInstaller()
return nullptr;
}
bool BundleMgrProxy::NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime)
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid)
{
return true;
}
@ -420,7 +420,7 @@ bool BundleMgrService::CleanBundleCacheFiles(
{
return true;
}
bool BundleMgrService::CleanBundleDataFiles(const std::string &bundleName)
bool BundleMgrService::CleanBundleDataFiles(const std::string &bundleName, const int userId)
{
return true;
}
@ -510,7 +510,7 @@ sptr<IBundleInstaller> BundleMgrService::GetBundleInstaller()
return nullptr;
}
bool BundleMgrService::NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime)
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid)
{
return true;
}

View File

@ -70,7 +70,7 @@ public:
virtual bool IsSafeMode() override;
virtual bool CleanBundleCacheFiles(
const std::string &bundleName, const sptr<ICleanCacheCallback> &cleanCacheCallback) override;
virtual bool CleanBundleDataFiles(const std::string &bundleName) override;
virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId) override;
virtual bool RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) override;
virtual bool ClearBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) override;
virtual bool UnregisterBundleStatusCallback() override;
@ -98,7 +98,7 @@ public:
const int32_t number, std::vector<ModuleUsageRecord> &moduleUsageRecords) override;
virtual sptr<IBundleInstaller> GetBundleInstaller() override;
virtual bool NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime) override;
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) override;
};
class BundleMgrStub : public IRemoteStub<IBundleMgr> {
@ -146,7 +146,7 @@ public:
virtual bool IsSafeMode() override;
virtual bool CleanBundleCacheFiles(
const std::string &bundleName, const sptr<ICleanCacheCallback> &cleanCacheCallback) override;
virtual bool CleanBundleDataFiles(const std::string &bundleName) override;
virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId) override;
virtual bool RegisterBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) override;
virtual bool ClearBundleStatusCallback(const sptr<IBundleStatusCallback> &bundleStatusCallback) override;
virtual bool UnregisterBundleStatusCallback() override;
@ -174,7 +174,37 @@ public:
const int32_t number, std::vector<ModuleUsageRecord> &moduleUsageRecords) override;
virtual sptr<IBundleInstaller> GetBundleInstaller() override;
virtual bool NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime) override;
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) override;
virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector<int> &gids) override
{
return true;
}
virtual bool QueryAbilityInfosByUri(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos) override
{
return true;
}
virtual int CheckPermissionByUid(
const std::string &bundleName, const std::string &permission, const int userId) override
{
return true;
}
virtual bool GetAllCommonEventInfo(const std::string &eventKey,
std::vector<CommonEventInfo> &commonEventInfos) override
{
return true;
}
virtual bool RemoveClonedBundle(const std::string &bundleName, const int32_t uid) override
{
return true;
}
virtual bool BundleClone(const std::string &bundleName) override
{
return true;
}
virtual bool CheckBundleNameInAllowList(const std::string &bundleName) override
{
return true;
}
};
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -152,7 +152,7 @@ public:
{
return true;
}
virtual bool CleanBundleDataFiles(const std::string &bundleName) override
virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId) override
{
return true;
}
@ -243,7 +243,7 @@ public:
~BundleMgrService() = default;
MOCK_METHOD2(GetAppIdByBundleName, std::string(const std::string &bundleName, const int userId));
MOCK_METHOD2(CheckPermission, int(const std::string &bundleName, const std::string &permission));
MOCK_METHOD1(CleanBundleDataFiles, bool(const std::string &bundleName));
MOCK_METHOD2(CleanBundleDataFiles, bool(const std::string &bundleName, const int userId));
MOCK_METHOD3(
CanRequestPermission, bool(const std::string &bundleName, const std::string &permissionName, const int userId));
MOCK_METHOD3(RequestPermissionFromUser,
@ -421,7 +421,37 @@ public:
return true;
}
virtual bool NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime) override
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) override
{
return true;
}
virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector<int> &gids) override
{
return true;
}
virtual bool QueryAbilityInfosByUri(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos) override
{
return true;
}
virtual int CheckPermissionByUid(
const std::string &bundleName, const std::string &permission, const int userId) override
{
return true;
}
virtual bool GetAllCommonEventInfo(const std::string &eventKey,
std::vector<CommonEventInfo> &commonEventInfos) override
{
return true;
}
virtual bool RemoveClonedBundle(const std::string &bundleName, const int32_t uid) override
{
return true;
}
virtual bool BundleClone(const std::string &bundleName) override
{
return true;
}
virtual bool CheckBundleNameInAllowList(const std::string &bundleName) override
{
return true;
}

View File

@ -337,11 +337,11 @@ group("unittest") {
deps = []
deps += [
## ":intent_params_test",
## ":intent_parameters_test",
## ":intent_parse_to_uri_test",
## ":intent_base_test",
## ":intent_filter_test",
":intent_base_test",
":intent_filter_test",
":intent_parameters_test",
":intent_params_test",
":intent_parse_to_uri_test",
":operation_test",
":patterns_matcher_test",
":skills_test",

View File

@ -91,6 +91,7 @@ ohos_moduletest("ability_moduletest") {
"//base/hiviewdfx/hiview/adapter/utility:hiview_adapter_utility",
"//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
"//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes",
"//foundation/aafwk/standard/interfaces/innerkits/ability_manager:ability_manager",
"//foundation/aafwk/standard/interfaces/innerkits/base:base",
"//foundation/aafwk/standard/interfaces/innerkits/want:want",
"//foundation/appexecfwk/standard/common:libappexecfwk_common",
@ -298,10 +299,10 @@ group("moduletest") {
if (is_phone_product) {
deps += [
#":ability_conetxt_test",
#":ability_moduletest",
#":data_ability_helper_module_test",
#":data_ability_operation_moduletest",
":ability_conetxt_test",
":ability_moduletest",
":data_ability_helper_module_test",
":data_ability_operation_moduletest",
]
}
}

View File

@ -109,7 +109,6 @@ public:
MOCK_METHOD1(CleanMission, int(int32_t missionId));
MOCK_METHOD0(CleanAllMissions, int());
MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId));
MOCK_METHOD1(GetSystemMemoryAttr, void(AppExecFwk::SystemMemoryAttr &memoryInfo));
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
int MoveMissionToEnd(const sptr<IRemoteObject> &token, const bool nonFirst) override;
@ -154,6 +153,16 @@ public:
return 0;
}
virtual int StartUser(int userId) override
{
return 0;
}
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) override
{
return 0;
}
AbilityLifeCycleState curstate_ = AbilityLifeCycleState::ABILITY_STATE_INITIAL;
sptr<IAbilityScheduler> abilityScheduler_; // kit interface used to schedule ability life
Want want_;

View File

@ -171,6 +171,16 @@ public:
return 0;
}
virtual int StartUser(int userId) override
{
return 0;
}
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) override
{
return 0;
}
sptr<IAbilityScheduler> abilityScheduler_ = nullptr; // kit interface used to schedule ability life
Want want_;
bool startAbility = false;

View File

@ -54,6 +54,8 @@ napi_value WantConstantInit(napi_env env, napi_value exports)
SetNamedProperty(env, action, "ohos.want.action.dismissTimer", "ACTION_DISMISS_TIMER");
SetNamedProperty(env, action, "ohos.want.action.sendSms", "ACTION_SEND_SMS");
SetNamedProperty(env, action, "ohos.want.action.choose", "ACTION_CHOOSE");
SetNamedProperty(env, action, "ohos.want.action.imageCapture", "ACTION_IMAGE_CAPTURE");
SetNamedProperty(env, action, "ohos.want.action.videoCapture", "ACTION_VIDEO_CAPTURE");
SetNamedProperty(env, action, "ohos.want.action.select", "ACTION_SELECT");
SetNamedProperty(env, action, "ohos.want.action.sendData", "ACTION_SEND_DATA");
SetNamedProperty(env, action, "ohos.want.action.sendMultipleData", "ACTION_SEND_MULTIPLE_DATA");

View File

@ -22,7 +22,7 @@ group("unittest") {
testonly = true
deps = [
#"abilitymgr:unittest",
#"dataobsmgr:unittest",
"abilitymgr:unittest",
"dataobsmgr:unittest",
]
}

View File

@ -25,9 +25,10 @@ group("abilityms_target") {
group("unittest") {
testonly = true
deps = []
#deps = [ "test:unittest" ]
# deps = [ "test:unittest" ]
}
config("abilityms_config") {

View File

@ -32,11 +32,11 @@ public:
virtual ~ScreenshotHandler() = default;
void StartScreenshot(int32_t missionId, int32_t winId);
WMImageInfo GetImageInfo(int32_t missionId);
OHOS::WMImageInfo GetImageInfo(int32_t missionId);
void RemoveImageInfo(int32_t missionId);
private:
std::map<int32_t, WMImageInfo> screenShot_;
std::map<int32_t, OHOS::WMImageInfo> screenShot_;
sptr<IWindowManagerService> windowMS_;
};
} // namespace AAFwk

View File

@ -22,7 +22,7 @@
#include <string>
#include "nocopyable.h"
#include <condition_variable>
#include "wm_common.h"
#include "../wmclient/wm_common.h"
namespace OHOS {
namespace AAFwk {
@ -31,14 +31,14 @@ public:
ScreenShotResponse() = default;
virtual ~ScreenShotResponse() = default;
void OnWindowShot(const struct WMImageInfo &info);
WMImageInfo GetImageInfo();
void OnWindowShot(const OHOS::WMImageInfo &info);
OHOS::WMImageInfo GetImageInfo();
private:
static constexpr int TIME_OUT = 200 * 1000;
std::mutex mutex_;
std::condition_variable condition_;
std::shared_ptr<WMImageInfo> info_;
std::shared_ptr<OHOS::WMImageInfo> info_;
};
} // namespace AAFwk
} // namespace OHOS

View File

@ -48,7 +48,7 @@ void ScreenshotHandler::StartScreenshot(int32_t missionId, int32_t winId)
}
auto then = [response](const auto &wmsinfo) {
WMImageInfo wminfo = {
OHOS::WMImageInfo wminfo = {
.wret = wmsinfo.wret,
.width = wmsinfo.width,
.height = wmsinfo.height,
@ -75,10 +75,10 @@ void ScreenshotHandler::StartScreenshot(int32_t missionId, int32_t winId)
screenShot_.emplace(missionId, imageInfo);
}
WMImageInfo ScreenshotHandler::GetImageInfo(int32_t missionId)
OHOS::WMImageInfo ScreenshotHandler::GetImageInfo(int32_t missionId)
{
HILOG_DEBUG("%{public}s begin", __func__);
WMImageInfo imageInfo;
OHOS::WMImageInfo imageInfo;
auto iter = screenShot_.find(missionId);
if (iter != screenShot_.end()) {
imageInfo = iter->second;

View File

@ -23,11 +23,11 @@
namespace OHOS {
namespace AAFwk {
void ScreenShotResponse::OnWindowShot(const struct WMImageInfo &info)
void ScreenShotResponse::OnWindowShot(const OHOS::WMImageInfo &info)
{
HILOG_INFO("On screen shot call back.");
std::unique_lock<std::mutex> lock(mutex_);
info_ = std::make_shared<WMImageInfo>();
info_ = std::make_shared<OHOS::WMImageInfo>();
if (!info_) {
return;
}
@ -39,18 +39,18 @@ void ScreenShotResponse::OnWindowShot(const struct WMImageInfo &info)
condition_.notify_all();
}
WMImageInfo ScreenShotResponse::GetImageInfo()
OHOS::WMImageInfo ScreenShotResponse::GetImageInfo()
{
std::unique_lock<std::mutex> lock(mutex_);
if (info_ == nullptr) {
if (condition_.wait_for(lock, std::chrono::milliseconds(TIME_OUT)) == std::cv_status::timeout) {
return WMImageInfo();
return OHOS::WMImageInfo();
}
}
WMImageInfo info = *info_;
OHOS::WMImageInfo info = *info_;
info_.reset();
return info;
}
} // namespace AAFwk
} // namespace OHOS
} // namespace OHOS

View File

@ -147,47 +147,47 @@ group("unittest") {
testonly = true
deps = [
# "unittest/phone/ability_connect_callback_proxy_test:unittest",
# "unittest/phone/ability_connect_callback_stub_test:unittest",
# "unittest/phone/ability_connect_manage_test:unittest",
# "unittest/phone/ability_dump_test:unittest",
# "unittest/phone/ability_manager_proxy_test:unittest",
# "unittest/phone/ability_manager_service_test:unittest",
# "unittest/phone/ability_manager_stub_test:unittest",
# "unittest/phone/ability_record_test:unittest",
# "unittest/phone/ability_scheduler_proxy_test:unittest",
# "unittest/phone/ability_scheduler_stub_test:unittest",
# "unittest/phone/ability_service_start_test:unittest",
# "unittest/phone/ability_stack_manager_test:unittest",
# "unittest/phone/ability_token_proxy_test:unittest",
# "unittest/phone/ability_token_stub_test:unittest",
# "unittest/phone/ability_with_applications_test:unittest",
# "unittest/phone/abilityms_appms_test:unittest",
# "unittest/phone/app_scheduler_test:unittest",
# "unittest/phone/configuration_test:unittest",
# "unittest/phone/connection_record_test:unittest",
# "unittest/phone/data_ability_manager_test:unittest",
# "unittest/phone/data_ability_record_test:unittest",
# "unittest/phone/info_test:unittest",
# "unittest/phone/kernal_system_app_manager_test:unittest",
# "unittest/phone/lifecycle_deal_test:unittest",
# "unittest/phone/lifecycle_test:unittest",
# "unittest/phone/lock_screen_white_list_test:unittest",
# "unittest/phone/mission_record_test:unittest",
# "unittest/phone/mission_stack_test:unittest",
# "unittest/phone/pending_want_key_test:unittest",
# "unittest/phone/pending_want_manager_test:unittest",
# "unittest/phone/pending_want_record_test:unittest",
# "unittest/phone/resume_mission_container_test:unittest",
# "unittest/phone/screenshot_handler_test:unittest",
# "unittest/phone/sender_info_test:unittest",
# "unittest/phone/terminate_ability_test:unittest",
# "unittest/phone/want_receiver_proxy_test:unittest",
# "unittest/phone/want_receiver_stub_test:unittest",
# "unittest/phone/want_sender_info_test:unittest",
# "unittest/phone/want_sender_proxy_test:unittest",
# "unittest/phone/want_sender_stub_test:unittest",
# "unittest/phone/wants_info_test:unittest",
# "unittest/phone/window_info_test:unittest",
"unittest/phone/ability_connect_callback_proxy_test:unittest",
"unittest/phone/ability_connect_callback_stub_test:unittest",
"unittest/phone/ability_connect_manage_test:unittest",
"unittest/phone/ability_dump_test:unittest",
"unittest/phone/ability_manager_proxy_test:unittest",
"unittest/phone/ability_manager_service_test:unittest",
"unittest/phone/ability_manager_stub_test:unittest",
"unittest/phone/ability_record_test:unittest",
"unittest/phone/ability_scheduler_proxy_test:unittest",
"unittest/phone/ability_scheduler_stub_test:unittest",
"unittest/phone/ability_service_start_test:unittest",
"unittest/phone/ability_stack_manager_test:unittest",
"unittest/phone/ability_token_proxy_test:unittest",
"unittest/phone/ability_token_stub_test:unittest",
"unittest/phone/ability_with_applications_test:unittest",
"unittest/phone/abilityms_appms_test:unittest",
"unittest/phone/app_scheduler_test:unittest",
"unittest/phone/configuration_test:unittest",
"unittest/phone/connection_record_test:unittest",
"unittest/phone/data_ability_manager_test:unittest",
"unittest/phone/data_ability_record_test:unittest",
"unittest/phone/info_test:unittest",
"unittest/phone/kernal_system_app_manager_test:unittest",
"unittest/phone/lifecycle_deal_test:unittest",
"unittest/phone/lifecycle_test:unittest",
"unittest/phone/lock_screen_white_list_test:unittest",
"unittest/phone/mission_record_test:unittest",
"unittest/phone/mission_stack_test:unittest",
"unittest/phone/pending_want_key_test:unittest",
"unittest/phone/pending_want_manager_test:unittest",
"unittest/phone/pending_want_record_test:unittest",
"unittest/phone/resume_mission_container_test:unittest",
"unittest/phone/screenshot_handler_test:unittest",
"unittest/phone/sender_info_test:unittest",
"unittest/phone/terminate_ability_test:unittest",
"unittest/phone/want_receiver_proxy_test:unittest",
"unittest/phone/want_receiver_stub_test:unittest",
"unittest/phone/want_sender_info_test:unittest",
"unittest/phone/want_sender_proxy_test:unittest",
"unittest/phone/want_sender_stub_test:unittest",
"unittest/phone/wants_info_test:unittest",
"unittest/phone/window_info_test:unittest",
]
}

View File

@ -28,6 +28,7 @@
#include "bundle_installer_interface.h"
#include "bundle_status_callback_interface.h"
#include "clean_cache_callback_interface.h"
#include "common_event_info.h"
#include "on_permission_changed_callback_interface.h"
#include "ohos/aafwk/content/want.h"
@ -270,7 +271,7 @@ public:
* @param bundleName Indicates the bundle name of the application whose data is to be cleared.
* @return Returns true if the data cleared successfully; returns false otherwise.
*/
virtual bool CleanBundleDataFiles(const std::string &bundleName) = 0;
virtual bool CleanBundleDataFiles(const std::string &bundleName, const int userId = 0) = 0;
/**
* @brief Register the specific bundle status callback.
* @param bundleStatusCallback Indicates the callback to be invoked for returning the bundle status changed result.
@ -431,7 +432,15 @@ public:
* @return Returns true if this function is successfully called; returns false otherwise.
*/
virtual bool NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime) = 0;
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid = 0) = 0;
virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector<int> &gids) = 0;
virtual bool QueryAbilityInfosByUri(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos) = 0;
virtual int CheckPermissionByUid(
const std::string &bundleName, const std::string &permission, const int userId) = 0;
virtual bool GetAllCommonEventInfo(const std::string &eventKey, std::vector<CommonEventInfo> &commonEventInfos) = 0;
virtual bool RemoveClonedBundle(const std::string &bundleName, const int32_t uid) = 0;
virtual bool BundleClone(const std::string &bundleName) = 0;
virtual bool CheckBundleNameInAllowList(const std::string &bundleName) = 0;
enum class Message {
GET_APPLICATION_INFO,

View File

@ -143,7 +143,7 @@ public:
const std::string &bundleName, const BundleFlag flag, BundleInfo &bundleInfo, int32_t userId) override;
virtual bool NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime) override;
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) override;
virtual bool CheckIsSystemAppByUid(const int uid) override;
MOCK_METHOD3(GetApplicationInfos,
bool(const ApplicationFlag flag, const int userId, std::vector<ApplicationInfo> &appInfos));
@ -170,7 +170,7 @@ public:
MOCK_METHOD0(IsSafeMode, bool());
MOCK_METHOD2(CleanBundleCacheFiles,
bool(const std::string &bundleName, const sptr<ICleanCacheCallback> &cleanCacheCallback));
MOCK_METHOD1(CleanBundleDataFiles, bool(const std::string &bundleName));
MOCK_METHOD2(CleanBundleDataFiles, bool(const std::string &bundleName, const int userId));
MOCK_METHOD3(RequestPermissionFromUser,
bool(const std::string &bundleName, const std::string &permission, const int userId));
MOCK_METHOD1(RegisterBundleStatusCallback, bool(const sptr<IBundleStatusCallback> &bundleStatusCallback));
@ -227,7 +227,7 @@ public:
bool CheckWantEntity(const AAFwk::Want &, AbilityInfo &);
virtual bool NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime) override;
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) override;
MOCK_METHOD2(QueryWantAbility, int(const AAFwk::Want &want, std::vector<AbilityInfo> &abilityInfos));
MOCK_METHOD3(GetApplicationInfos,
bool(const ApplicationFlag flag, const int userId, std::vector<ApplicationInfo> &appInfos));
@ -253,7 +253,7 @@ public:
MOCK_METHOD0(IsSafeMode, bool());
MOCK_METHOD2(CleanBundleCacheFiles,
bool(const std::string &bundleName, const sptr<ICleanCacheCallback> &cleanCacheCallback));
MOCK_METHOD1(CleanBundleDataFiles, bool(const std::string &bundleName));
MOCK_METHOD2(CleanBundleDataFiles, bool(const std::string &bundleName, const int userId));
MOCK_METHOD3(RequestPermissionFromUser,
bool(const std::string &bundleName, const std::string &permission, const int userId));
MOCK_METHOD1(RegisterBundleStatusCallback, bool(const sptr<IBundleStatusCallback> &bundleStatusCallback));
@ -285,6 +285,36 @@ public:
MOCK_METHOD4(
DumpInfos, bool(const DumpFlag flag, const std::string &bundleName, int32_t userId, std::string &result));
MOCK_METHOD1(IsApplicationEnabled, bool(const std::string &bundleName));
virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector<int> &gids) override
{
return true;
}
virtual bool QueryAbilityInfosByUri(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos) override
{
return true;
}
virtual int CheckPermissionByUid(
const std::string &bundleName, const std::string &permission, const int userId) override
{
return true;
}
virtual bool GetAllCommonEventInfo(const std::string &eventKey,
std::vector<CommonEventInfo> &commonEventInfos) override
{
return true;
}
virtual bool RemoveClonedBundle(const std::string &bundleName, const int32_t uid) override
{
return true;
}
virtual bool BundleClone(const std::string &bundleName) override
{
return true;
}
virtual bool CheckBundleNameInAllowList(const std::string &bundleName) override
{
return true;
}
public:
using QueryAbilityInfoFunType =

View File

@ -69,7 +69,7 @@ bool BundleMgrProxy::GetApplicationInfo(
}
bool BundleMgrProxy::NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime)
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid)
{
GTEST_LOG_(INFO) << "BundleMgrProxy::NotifyAbilityLifeStatus()";
return true;
@ -202,7 +202,7 @@ int BundleMgrService::GetUidByBundleName(const std::string &bundleName, const in
}
bool BundleMgrService::NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime)
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid)
{
GTEST_LOG_(INFO) << "BundleMgrService::NotifyAbilityLifeStatus()";
return true;

View File

@ -299,6 +299,16 @@ public:
return 0;
}
virtual int StartUser(int userId) override
{
return 0;
}
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) override
{
return 0;
}
MOCK_METHOD2(TerminateAbilityByCaller, int(const sptr<IRemoteObject> &callerToken, int requestCode));
MOCK_METHOD3(StartAbility, int(const Want &want, const sptr<IRemoteObject> &callerToken, int requestCode));
MOCK_METHOD2(

View File

@ -297,6 +297,60 @@ public:
{
return 0;
}
virtual int StartContinuation(const Want &want, const sptr<IRemoteObject> &abilityToken) override
{
return 0;
}
virtual int NotifyContinuationResult(const sptr<IRemoteObject> &abilityToken, const int32_t result) override
{
return 0;
}
virtual int LockMissionForCleanup(int32_t missionId) override
{
return 0;
}
virtual int UnlockMissionForCleanup(int32_t missionId) override
{
return 0;
}
virtual int RegisterMissionListener(const sptr<IMissionListener> &listener) override
{
return 0;
}
virtual int UnRegisterMissionListener(const sptr<IMissionListener> &listener) override
{
return 0;
}
virtual int CleanMission(int32_t missionId) override
{
return 0;
}
virtual int CleanAllMissions() override
{
return 0;
}
virtual int MoveMissionToFront(int32_t missionId) override
{
return 0;
}
virtual int GetMissionInfos(const std::string& deviceId, int32_t numMax,
std::vector<MissionInfo> &missionInfos) override
{
return 0;
}
virtual int GetMissionInfo(const std::string& deviceId, int32_t missionId,
MissionInfo &missionInfo) override
{
return 0;
}
virtual int StartUser(int userId) override
{
return 0;
}
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) override
{
return 0;
}
};
} // namespace AAFwk
} // namespace OHOS

View File

@ -98,6 +98,14 @@ public:
MOCK_METHOD1(TerminateAbilityTest, void(int id));
MOCK_METHOD1(MoveMissionToEnd, int(int id));
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
virtual int StartUser(int userId) override
{
return 0;
}
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) override
{
return 0;
}
};
} // namespace AAFwk
} // namespace OHOS

View File

@ -39,6 +39,7 @@ ohos_unittest("app_scheduler_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${innerkits_path}/ability_manager:ability_manager",
"${innerkits_path}/want:want",
"${services_path}/abilitymgr/test:abilityms_test_source",
"${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock",

View File

@ -46,6 +46,7 @@ ohos_unittest("data_ability_manager_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${innerkits_path}/ability_manager:ability_manager",
"${innerkits_path}/want:want",
"${services_path}/abilitymgr/test:abilityms_test_source",
"${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock",

View File

@ -40,6 +40,7 @@ ohos_unittest("lock_screen_white_list_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${innerkits_path}/ability_manager:ability_manager",
"${innerkits_path}/want:want",
"${services_path}/abilitymgr/test:abilityms_test_source",
"${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock",

View File

@ -40,6 +40,7 @@ ohos_unittest("ability_screenshot_handler_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${innerkits_path}/ability_manager:ability_manager",
"${innerkits_path}/want:want",
"${services_path}/abilitymgr/test:abilityms_test_source",
"${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock",

View File

@ -76,14 +76,14 @@ void ScreenShotHandlerTest::TearDown()
*/
HWTEST_F(ScreenShotHandlerTest, ability_screenshot_response_001, TestSize.Level1)
{
WMImageInfo info;
OHOS::WMImageInfo info;
info.width = 1;
info.size = 5;
info.height = 2;
info.format = 3;
info.data = nullptr;
screenShotResponse_->OnWindowShot(info);
WMImageInfo infos = screenShotResponse_->GetImageInfo();
OHOS::WMImageInfo infos = screenShotResponse_->GetImageInfo();
EXPECT_EQ(infos.width, static_cast<uint32_t>(1));
EXPECT_EQ(infos.size, static_cast<uint32_t>(5));
EXPECT_EQ(infos.height, static_cast<uint32_t>(2));
@ -102,7 +102,7 @@ HWTEST_F(ScreenShotHandlerTest, ability_screenshot_response_001, TestSize.Level1
HWTEST_F(ScreenShotHandlerTest, ability_screenshot_handler_001, TestSize.Level1)
{
int missionId = 0;
WMImageInfo info;
OHOS::WMImageInfo info;
info.width = 1;
info.size = 5;
info.height = 2;
@ -130,7 +130,7 @@ HWTEST_F(ScreenShotHandlerTest, ability_screenshot_handler_001, TestSize.Level1)
HWTEST_F(ScreenShotHandlerTest, ability_screenshot_handler_002, TestSize.Level1)
{
int missionId = 0;
WMImageInfo info;
OHOS::WMImageInfo info;
info.width = 1;
info.size = 5;
info.height = 2;

View File

@ -31,15 +31,15 @@ group("moduletest") {
testonly = true
deps = [
#"moduletest/ability_mgr_service_test:moduletest",
#"moduletest/ability_record_test:moduletest",
#"moduletest/ability_stack_test:moduletest",
#"moduletest/dump_module_test:moduletest",
#"moduletest/ipc_ability_connect_test:moduletest",
#"moduletest/ipc_ability_mgr_test:moduletest",
#"moduletest/ipc_ability_scheduler_test:moduletest",
#"moduletest/module_test_dump_util:module_test_dump_util",
#"moduletest/panding_want_manager_test:moduletest",
#"//third_party/jsoncpp:jsoncpp",
"moduletest/ability_mgr_service_test:moduletest",
"moduletest/ability_record_test:moduletest",
"moduletest/ability_stack_test:moduletest",
"moduletest/dump_module_test:moduletest",
"moduletest/ipc_ability_connect_test:moduletest",
"moduletest/ipc_ability_mgr_test:moduletest",
"moduletest/ipc_ability_scheduler_test:moduletest",
"moduletest/module_test_dump_util:module_test_dump_util",
"moduletest/panding_want_manager_test:moduletest",
"//third_party/jsoncpp:jsoncpp",
]
}

View File

@ -104,7 +104,17 @@ public:
MOCK_METHOD1(ClearUpApplicationData, int(const std::string &));
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
virtual int StartUser(int userId) override
{
return 0;
}
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) override
{
return 0;
}
void Wait()
{
sem_.Wait();

View File

@ -231,7 +231,7 @@ public:
MOCK_METHOD0(IsSafeMode, bool());
MOCK_METHOD2(CleanBundleCacheFiles,
bool(const std::string &bundleName, const sptr<ICleanCacheCallback> &cleanCacheCallback));
MOCK_METHOD1(CleanBundleDataFiles, bool(const std::string &bundleName));
MOCK_METHOD2(CleanBundleDataFiles, bool(const std::string &bundleName, const int userId));
MOCK_METHOD1(RegisterBundleStatusCallback, bool(const sptr<IBundleStatusCallback> &bundleStatusCallback));
MOCK_METHOD1(ClearBundleStatusCallback, bool(const sptr<IBundleStatusCallback> &bundleStatusCallback));
MOCK_METHOD0(UnregisterBundleStatusCallback, bool());
@ -295,7 +295,7 @@ public:
MOCK_METHOD0(IsSafeMode, bool());
MOCK_METHOD2(CleanBundleCacheFiles,
bool(const std::string &bundleName, const sptr<ICleanCacheCallback> &cleanCacheCallback));
MOCK_METHOD1(CleanBundleDataFiles, bool(const std::string &bundleName));
MOCK_METHOD2(CleanBundleDataFiles, bool(const std::string &bundleName, const int userId));
MOCK_METHOD1(RegisterBundleStatusCallback, bool(const sptr<IBundleStatusCallback> &bundleStatusCallback));
MOCK_METHOD1(ClearBundleStatusCallback, bool(const sptr<IBundleStatusCallback> &bundleStatusCallback));
MOCK_METHOD0(UnregisterBundleStatusCallback, bool());
@ -341,8 +341,39 @@ public:
bool GetApplicationInfo(
const std::string &appName, const ApplicationFlag flag, const int userId, ApplicationInfo &appInfo) override;
bool NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime) override;
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid) override;
virtual bool CheckIsSystemAppByUid(const int uid) override;
virtual bool GetBundleGidsByUid(const std::string &bundleName, const int &uid, std::vector<int> &gids) override
{
return true;
}
virtual bool QueryAbilityInfosByUri(const std::string &abilityUri, std::vector<AbilityInfo> &abilityInfos) override
{
return true;
}
virtual int CheckPermissionByUid(
const std::string &bundleName, const std::string &permission, const int userId) override
{
return true;
}
virtual bool GetAllCommonEventInfo(const std::string &eventKey,
std::vector<CommonEventInfo> &commonEventInfos) override
{
return true;
}
virtual bool RemoveClonedBundle(const std::string &bundleName, const int32_t uid) override
{
return true;
}
virtual bool BundleClone(const std::string &bundleName) override
{
return true;
}
virtual bool CheckBundleNameInAllowList(const std::string &bundleName) override
{
return true;
}
BundleMgrService()
{
abilityInfoMap_.emplace(COM_IX_HIWORLD, HiWordInfo);

View File

@ -50,6 +50,14 @@ public:
MOCK_METHOD3(ScaleTo, sptr<PromiseWMError>(int32_t wid, uint32_t width, uint32_t height));
MOCK_METHOD2(SetWindowType, sptr<PromiseWMError>(int32_t wid, WindowType type));
MOCK_METHOD2(SetWindowMode, sptr<PromiseWMError>(int32_t wid, WindowMode mode));
virtual sptr<PromiseWMError> CreateVirtualDisplay(int32_t x, int32_t y, int32_t width, int32_t height) override
{
return nullptr;
}
virtual sptr<PromiseWMError> DestroyVirtualDisplay(uint32_t did) override
{
return nullptr;
}
};
} // namespace OHOS

View File

@ -164,7 +164,7 @@ bool BundleMgrService::CheckWantEntity(const AAFwk::Want &want, AbilityInfo &abi
}
bool BundleMgrService::NotifyAbilityLifeStatus(
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime)
const std::string &bundleName, const std::string &abilityName, const int64_t launchTime, const int uid)
{
return true;
}

View File

@ -116,7 +116,6 @@ ohos_moduletest("ability_mgr_module_test") {
group("moduletest") {
testonly = true
deps = []
#deps = [ ":ability_mgr_module_test" ]
deps = [ ":ability_mgr_module_test" ]
}

View File

@ -1917,7 +1917,7 @@ HWTEST_F(AbilityMgrModuleTest, UpdateConfiguration_029, TestSize.Level1)
HWTEST_F(AbilityMgrModuleTest, UpdateConfiguration_030, TestSize.Level1)
{
EXPECT_TRUE(abilityMgrServ_);
std::string abilityName = "luncher";
std::string abilityName = "hiworld";
std::string bundleName = "com.ix.hiworld";
SetActive();
@ -1961,60 +1961,6 @@ HWTEST_F(AbilityMgrModuleTest, UpdateConfiguration_030, TestSize.Level1)
EXPECT_EQ(size, num);
}
/*
* Feature: AbilityManagerService
* Function: UpdateConfiguration
* SubFunction: NA
* FunctionPoints: NA
* EnvConditions: NA
* CaseDescription: luncher ability
*/
HWTEST_F(AbilityMgrModuleTest, UpdateConfiguration_030, TestSize.Level1)
{
EXPECT_TRUE(abilityMgrServ_);
std::string abilityName = "hiworld";
std::string bundleName = "com.ix.hiworld";
SetActive();
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _)).Times(1);
EXPECT_CALL(*mockAppMgrClient_, UpdateAbilityState(_, _)).Times(2).WillOnce(Return(AppMgrResultCode::RESULT_OK));
Want want = CreateWant(abilityName, bundleName);
auto startRef = abilityMgrServ_->StartAbility(want);
EXPECT_EQ(startRef, 0);
std::shared_ptr<AbilityRecord> abilityRecord = abilityMgrServ_->GetStackManager()->GetCurrentTopAbility();
EXPECT_TRUE(abilityRecord);
int displeyId = 1001;
std::string key = GlobalConfigurationKey::SYSTEM_LANGUAGE;
std::string val = "意大利文";
auto Compare = [displeyId, key, val](const AppExecFwk::Configuration &config) {
auto item = config.GetItem(displeyId, key);
EXPECT_EQ(item, val);
};
sptr<MockAbilityScheduler> scheduler(new MockAbilityScheduler());
EXPECT_CALL(*scheduler, ScheduleUpdateConfiguration(_)).Times(1).WillOnce(Invoke(Compare));
abilityMgrServ_->AttachAbilityThread(scheduler, abilityRecord->GetToken());
int size = DelayedSingleton<ConfigurationDistributor>::GetInstance()->observerList_.size();
EXPECT_TRUE(size > 0);
AppExecFwk::Configuration newConfig;
newConfig.AddItem(displeyId, key, val);
auto updateRef = abilityMgrServ_->UpdateConfiguration(newConfig);
EXPECT_EQ(updateRef, 0);
PacMap saveData;
abilityMgrServ_->AbilityTransitionDone(abilityRecord->GetToken(), 0, saveData);
int num = size - 1;
size = DelayedSingleton<ConfigurationDistributor>::GetInstance()->observerList_.size();
EXPECT_EQ(size, num);
}
/*
* Function: UninstallApp
* SubFunction: NA

View File

@ -118,7 +118,6 @@ ohos_moduletest("AbilityRecordModuleTest") {
group("moduletest") {
testonly = true
deps = []
#deps = [ ":AbilityRecordModuleTest" ]
deps = [ ":AbilityRecordModuleTest" ]
}

View File

@ -116,7 +116,6 @@ ohos_moduletest("ability_stack_module_test") {
group("moduletest") {
testonly = true
deps = []
#deps = [ ":ability_stack_module_test" ]
deps = [ ":ability_stack_module_test" ]
}

View File

@ -42,6 +42,7 @@ ohos_moduletest("dump_module_test") {
cflags += [ "-DBINDER_IPC_32BIT" ]
}
deps = [
"${innerkits_path}/ability_manager:ability_manager",
"${innerkits_path}/want:want",
"${services_path}/abilitymgr/test:abilityms_test_source",
"${services_path}/abilitymgr/test/mock/appmgr_test_service:appmgr_test_service",
@ -68,7 +69,6 @@ ohos_moduletest("dump_module_test") {
group("moduletest") {
testonly = true
deps = []
#deps = [ ":dump_module_test" ]
deps = [ ":dump_module_test" ]
}

View File

@ -45,7 +45,6 @@ ohos_moduletest("IpcAbilityConnectModuleTest") {
group("moduletest") {
testonly = true
deps = []
#deps = [ ":IpcAbilityConnectModuleTest" ]
deps = [ ":IpcAbilityConnectModuleTest" ]
}

View File

@ -50,7 +50,6 @@ ohos_moduletest("IpcAbilityMgrServiceModuleTest") {
group("moduletest") {
testonly = true
deps = []
#deps = [ ":IpcAbilityMgrServiceModuleTest" ]
deps = [ ":IpcAbilityMgrServiceModuleTest" ]
}

View File

@ -69,7 +69,6 @@ ohos_moduletest("IpcAbilitySchedulerModuleTest") {
group("moduletest") {
testonly = true
deps = []
#deps = [ ":IpcAbilitySchedulerModuleTest" ]
deps = [ ":IpcAbilitySchedulerModuleTest" ]
}

View File

@ -73,6 +73,7 @@ ohos_moduletest("PandingWantMgrTest") {
"dsoftbus_standard:softbus_client",
"hiviewdfx_hilog_native:libhilog",
"ipc:ipc_core",
"multimedia_image_standard:image_native",
"native_appdatamgr:native_appdatafwk",
"native_appdatamgr:native_dataability",
"native_appdatamgr:native_rdb",
@ -81,7 +82,6 @@ ohos_moduletest("PandingWantMgrTest") {
group("moduletest") {
testonly = true
deps = []
#deps = [ ":PandingWantMgrTest" ]
deps = [ ":PandingWantMgrTest" ]
}

View File

@ -15,21 +15,18 @@ import("//build/test.gni")
group("systemtest") {
testonly = true
deps = []
#deps = [ "systemtest/aa:systemtest" ]
deps = [ "systemtest/aa:systemtest" ]
}
group("moduletest") {
testonly = true
deps = []
#deps = [ "moduletest/aa:moduletest" ]
deps = [ "moduletest/aa:moduletest" ]
}
group("unittest") {
testonly = true
deps = []
#deps = [ "unittest/aa:unittest" ]
deps = [ "unittest/aa:unittest" ]
}

View File

@ -130,6 +130,16 @@ public:
MOCK_METHOD1(ClearUpApplicationData, int(const std::string &));
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
virtual int StartUser(int userId) override
{
return 0;
}
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) override
{
return 0;
}
public:
std::string powerState_;
};

View File

@ -108,8 +108,8 @@ group("moduletest") {
testonly = true
deps = [
#":aa_command_dump_module_test",
#":aa_command_start_module_test",
#":aa_command_stop_service_module_test",
":aa_command_dump_module_test",
":aa_command_start_module_test",
":aa_command_stop_service_module_test",
]
}