mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-27 09:21:28 +00:00
Restore the overwritten code
Signed-off-by: xuchenghua09 <xuchenghua09@huawei.com>
This commit is contained in:
parent
e86fe4dff8
commit
404732afed
@ -208,6 +208,11 @@ void Ability::OnStart(const Want &want)
|
||||
if (abilityWindow_ != nullptr) {
|
||||
APP_LOGI("%{public}s begin abilityWindow_->OnPostAbilityStart.", __func__);
|
||||
abilityWindow_->OnPostAbilityStart();
|
||||
if (abilityWindow_->GetWindow()) {
|
||||
auto windowId = abilityWindow_->GetWindow()->GetWindowId();
|
||||
APP_LOGI("Ability::OnStart: add window info = %{public}d", windowId);
|
||||
OHOS::AAFwk::AbilityManagerClient::GetInstance()->AddWindowInfo(AbilityContext::GetToken(), windowId);
|
||||
}
|
||||
APP_LOGI("%{public}s end abilityWindow_->OnPostAbilityStart.", __func__);
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ ErrCode AbilityManagerClient::GetRecentMissions(
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot)
|
||||
ErrCode AbilityManagerClient::GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap)
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -131,6 +131,8 @@ public:
|
||||
MOCK_METHOD0(CleanAllMissions, int());
|
||||
MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId));
|
||||
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
|
||||
int RemoveMission(int id) override;
|
||||
|
||||
int RemoveStack(int id) override;
|
||||
@ -152,7 +154,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot)
|
||||
int GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "ohos/aafwk/base/zchar_wrapper.h"
|
||||
#include "parcel_macro.h"
|
||||
#include "string_ex.h"
|
||||
#include "want_params_wrapper.h"
|
||||
|
||||
using namespace OHOS::AppExecFwk;
|
||||
using OHOS::AppExecFwk::ElementName;
|
||||
@ -1935,5 +1936,98 @@ void Want::DumpInfo(int level) const
|
||||
APP_LOGI("==================Want::DumpInfo level: %{public}d end=============", level);
|
||||
}
|
||||
|
||||
nlohmann::json Want::ToJson() const
|
||||
{
|
||||
WantParamWrapper wrapper(parameters_);
|
||||
std::string parametersString = wrapper.ToString();
|
||||
|
||||
nlohmann::json entitiesJson;
|
||||
std::vector<std::string> entities = GetEntities();
|
||||
for (auto entity : entities) {
|
||||
entitiesJson.emplace_back(entity);
|
||||
}
|
||||
|
||||
nlohmann::json wantJson = nlohmann::json{
|
||||
{"deviceId", operation_.GetDeviceId()},
|
||||
{"bundleName", operation_.GetBundleName()},
|
||||
{"abilityName", operation_.GetAbilityName()},
|
||||
{"uri", GetUriString()},
|
||||
{"type", GetType()},
|
||||
{"flags", GetFlags()},
|
||||
{"action", GetAction()},
|
||||
{"parameters", parametersString},
|
||||
{"entities", entitiesJson},
|
||||
};
|
||||
|
||||
return wantJson;
|
||||
}
|
||||
|
||||
bool Want::ReadFromJson(nlohmann::json &wantJson)
|
||||
{
|
||||
const auto &jsonObjectEnd = wantJson.end();
|
||||
if ((wantJson.find("deviceId") == jsonObjectEnd)
|
||||
|| (wantJson.find("bundleName") == jsonObjectEnd)
|
||||
|| (wantJson.find("abilityName") == jsonObjectEnd)
|
||||
|| (wantJson.find("uri") == jsonObjectEnd)
|
||||
|| (wantJson.find("type") == jsonObjectEnd)
|
||||
|| (wantJson.find("flags") == jsonObjectEnd)
|
||||
|| (wantJson.find("action") == jsonObjectEnd)
|
||||
|| (wantJson.find("parameters") == jsonObjectEnd)
|
||||
|| (wantJson.find("entities") == jsonObjectEnd)) {
|
||||
APP_LOGE("Incomplete wantJson");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string deviceId = wantJson.at("deviceId").get<std::string>();
|
||||
std::string bundleName = wantJson.at("bundleName").get<std::string>();
|
||||
std::string abilityName = wantJson.at("abilityName").get<std::string>();
|
||||
SetElementName(deviceId, bundleName, abilityName);
|
||||
|
||||
std::string uri = wantJson.at("uri").get<std::string>();
|
||||
SetUri(uri);
|
||||
|
||||
std::string type = wantJson.at("type").get<std::string>();
|
||||
SetType(type);
|
||||
|
||||
unsigned int flags = wantJson.at("flags").get<unsigned int>();
|
||||
SetFlags(flags);
|
||||
|
||||
std::string action = wantJson.at("action").get<std::string>();
|
||||
SetAction(action);
|
||||
|
||||
std::string parametersString = wantJson.at("parameters").get<std::string>();
|
||||
WantParams parameters = WantParamWrapper::ParseWantParams(parametersString);
|
||||
SetParams(parameters);
|
||||
|
||||
std::vector<std::string> entities;
|
||||
wantJson.at("entities").get_to<std::vector<std::string>>(entities);
|
||||
for (size_t i = 0; i < entities.size(); i++) {
|
||||
AddEntity(entities[i]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string Want::ToString() const
|
||||
{
|
||||
return ToJson().dump();
|
||||
}
|
||||
|
||||
Want *Want::FromString(std::string &string)
|
||||
{
|
||||
if (string.empty()) {
|
||||
APP_LOGE("Invalid string.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nlohmann::json wantJson = nlohmann::json::parse(string);
|
||||
|
||||
Want *want = new (std::nothrow) Want();
|
||||
if (want != nullptr && !want->ReadFromJson(wantJson)) {
|
||||
delete want;
|
||||
want = nullptr;
|
||||
}
|
||||
return want;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
@ -102,6 +102,7 @@ bool WantParamWrapper::ValidateStr(const std::string &str)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
sptr<IWantParams> WantParamWrapper::Parse(const std::string &str)
|
||||
{
|
||||
WantParams wantPaqrams;
|
||||
@ -152,5 +153,56 @@ sptr<IWantParams> WantParamWrapper::Parse(const std::string &str)
|
||||
sptr<IWantParams> iwantParams = new WantParamWrapper(wantPaqrams);
|
||||
return iwantParams;
|
||||
}
|
||||
|
||||
WantParams WantParamWrapper::ParseWantParams(const std::string &str)
|
||||
{
|
||||
WantParams wantPaqrams;
|
||||
std::string key = "";
|
||||
int typeId = 0;
|
||||
if (!ValidateStr(str)) {
|
||||
return wantPaqrams;
|
||||
}
|
||||
for (unsigned int strnum = 0; strnum < str.size(); strnum++) {
|
||||
if (str[strnum] == '{' && key != "" && typeId == WantParams::VALUE_TYPE_WANTPARAMS) {
|
||||
unsigned int num;
|
||||
int count = 0;
|
||||
for (num = strnum; num < str.size(); num++) {
|
||||
if (str[num] == '{') {
|
||||
count++;
|
||||
} else if (str[num] == '}') {
|
||||
count--;
|
||||
}
|
||||
if (count == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
wantPaqrams.SetParam(key, WantParamWrapper::Parse(str.substr(strnum, num - strnum)));
|
||||
key = "";
|
||||
typeId = 0;
|
||||
strnum = num + 1;
|
||||
} else if (str[strnum] == '"') {
|
||||
if (key == "") {
|
||||
strnum++;
|
||||
key = str.substr(strnum, str.find('"', strnum) - strnum);
|
||||
strnum = str.find('"', strnum);
|
||||
} else if (typeId == 0) {
|
||||
strnum++;
|
||||
typeId = atoi(str.substr(strnum, str.find('"', strnum) - strnum).c_str());
|
||||
if (errno == ERANGE) {
|
||||
return wantPaqrams;
|
||||
}
|
||||
strnum = str.find('"', strnum);
|
||||
} else {
|
||||
strnum++;
|
||||
wantPaqrams.SetParam(key,
|
||||
WantParams::GetInterfaceByType(typeId, str.substr(strnum, str.find('"', strnum) - strnum)));
|
||||
strnum = str.find('"', strnum);
|
||||
typeId = 0;
|
||||
key = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
return wantPaqrams;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
@ -56,6 +56,8 @@ public:
|
||||
|
||||
static sptr<IWantParams> Parse(const std::string &str);
|
||||
|
||||
static WantParams ParseWantParams(const std::string &str);
|
||||
|
||||
static constexpr char SIGNATURE = 'W';
|
||||
|
||||
private:
|
||||
|
@ -567,6 +567,12 @@ HWTEST_F(WantBaseTest, AaFwk_Want_Parcelable_0500, Function | MediumTest | Level
|
||||
|
||||
void WantBaseTest::CompareWant(const std::shared_ptr<Want> &want1, const std::shared_ptr<Want> &want2) const
|
||||
{
|
||||
Operation opt1 = want1->GetOperation();
|
||||
Operation opt2 = want2->GetOperation();
|
||||
EXPECT_EQ(opt1.GetDeviceId(), opt2.GetDeviceId());
|
||||
EXPECT_EQ(opt1.GetBundleName(), opt2.GetBundleName());
|
||||
EXPECT_EQ(opt1.GetAbilityName(), opt2.GetAbilityName());
|
||||
|
||||
EXPECT_EQ(want1->GetAction(), want2->GetAction());
|
||||
EXPECT_EQ(want1->GetFlags(), want2->GetFlags());
|
||||
EXPECT_EQ(want1->GetType(), want2->GetType());
|
||||
@ -3819,5 +3825,56 @@ HWTEST_F(WantBaseTest, AaFwk_Want_HasParameter_0200, Function | MediumTest | Lev
|
||||
std::shared_ptr<Want> p2(newWant);
|
||||
CompareWant(p1, p2);
|
||||
}
|
||||
/**
|
||||
* @tc.number: AaFwk_Want_ToString_0100
|
||||
* @tc.name: ToString and FromString
|
||||
* @tc.desc: Verify FromString()
|
||||
*/
|
||||
HWTEST_F(WantBaseTest, AaFwk_Want_ToString_0100, Function | MediumTest | Level1)
|
||||
{
|
||||
std::string deviceId = "deviceId";
|
||||
std::string bundleName = "bundleName";
|
||||
std::string abilityName ="abilityName";
|
||||
std::string uri = "url";
|
||||
std::string type = "type";
|
||||
unsigned int flags = 1;
|
||||
std::string action = "action";
|
||||
WantParams parameters;
|
||||
std::vector<std::string> entities = {"entity.system.entity1", "entity.system.entity2"};
|
||||
|
||||
std::string keyBool = "key_bool";
|
||||
bool valueBool = true;
|
||||
parameters.SetParam(keyBool, Boolean::Box(valueBool));
|
||||
|
||||
std::string keyStr = "key_string";
|
||||
std::string valueString = "123";
|
||||
parameters.SetParam(keyStr, String::Box(valueString));
|
||||
|
||||
std::string keyInt = "key_int";
|
||||
int valueInt = 111;
|
||||
parameters.SetParam(keyStr, Integer::Box(valueInt));
|
||||
|
||||
std::shared_ptr<Want> want1 = std::make_shared<Want>();
|
||||
if (want1 == nullptr) {
|
||||
return;
|
||||
}
|
||||
want1->SetElementName(deviceId, bundleName, abilityName);
|
||||
want1->SetUri(uri);
|
||||
want1->SetType(type);
|
||||
want1->SetFlags(flags);
|
||||
want1->SetAction(action);
|
||||
for (auto entity : entities) {
|
||||
want1->AddEntity(entity);
|
||||
}
|
||||
|
||||
std::string jsonString = want1->ToString();
|
||||
Want *newWant = Want::FromString(jsonString);
|
||||
if (newWant == nullptr) {
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<Want> want2(newWant);
|
||||
|
||||
CompareWant(want1, want2);
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
@ -70,9 +70,9 @@ ohos_moduletest("ability_moduletest") {
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_option.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_record_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_snapshot.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_snapshot_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_stack_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/sender_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/shared_memory.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/stack_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/stack_setting.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/want_sender_info.cpp",
|
||||
@ -195,8 +195,6 @@ ohos_moduletest("data_ability_operation_moduletest") {
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/ability_scheduler_proxy.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/ability_scheduler_stub.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/caller_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/image_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/launch_param.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/lifecycle_state_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_description_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_info.cpp",
|
||||
@ -204,7 +202,6 @@ ohos_moduletest("data_ability_operation_moduletest") {
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_listener_stub.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_record_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_snapshot.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_snapshot_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_stack_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/sender_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/stack_info.cpp",
|
||||
|
@ -176,7 +176,7 @@ int MockAbilityManagerService::GetRecentMissions(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int MockAbilityManagerService::GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot)
|
||||
int MockAbilityManagerService::GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -109,6 +109,8 @@ 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;
|
||||
bool IsFirstInMission(const sptr<IRemoteObject> &token) override;
|
||||
@ -117,7 +119,7 @@ public:
|
||||
int GetRecentMissions(
|
||||
const int32_t numMax, const int32_t flags, std::vector<AbilityMissionInfo> &recentList) override;
|
||||
|
||||
int GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot) override;
|
||||
int GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap) override;
|
||||
|
||||
int RemoveMission(int id) override;
|
||||
|
||||
|
@ -105,6 +105,8 @@ public:
|
||||
MOCK_METHOD0(CleanAllMissions, int());
|
||||
MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId));
|
||||
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
|
||||
int MoveMissionToEnd(const sptr<IRemoteObject> &token, const bool nonFirst) override;
|
||||
bool IsFirstInMission(const sptr<IRemoteObject> &token) override;
|
||||
int CompelVerifyPermission(const std::string &permission, int pid, int uid, std::string &message) override;
|
||||
@ -154,7 +156,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot)
|
||||
int GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ config("ability_manager_public_config") {
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/bundlemgr",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/appmgr",
|
||||
"//foundation/appexecfwk/standard/kits/appkit/native/app/include",
|
||||
"//foundation/multimedia/image_standard/interfaces/innerkits/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_rdb/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_appdatafwk/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_dataability/include",
|
||||
@ -60,9 +61,10 @@ ohos_shared_library("ability_manager") {
|
||||
"${services_path}/abilitymgr/src/mission_listener_stub.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_option.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_record_info.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_snapshot_info.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_snapshot.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_stack_info.cpp",
|
||||
"${services_path}/abilitymgr/src/sender_info.cpp",
|
||||
"${services_path}/abilitymgr/src/shared_memory.cpp",
|
||||
"${services_path}/abilitymgr/src/stack_info.cpp",
|
||||
"${services_path}/abilitymgr/src/stack_setting.cpp",
|
||||
"${services_path}/abilitymgr/src/start_options.cpp",
|
||||
@ -92,6 +94,7 @@ ohos_shared_library("ability_manager") {
|
||||
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_rdb:native_rdb",
|
||||
"//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
|
||||
"//foundation/multimedia/image_standard/interfaces/innerkits:image_native",
|
||||
"//third_party/jsoncpp:jsoncpp",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
|
@ -34,6 +34,9 @@ ability_manager_headers = {
|
||||
"mission_option.h",
|
||||
"stack_setting.h",
|
||||
"start_options.h",
|
||||
"global_configuration.h",
|
||||
"pixel_map.h",
|
||||
"shared_memory.h",
|
||||
]
|
||||
header_base = "interfaces/innerkits/ability_manager/include"
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ public:
|
||||
* @param missionId the id of the mission to retrieve the sAutoapshots
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot);
|
||||
ErrCode GetMissionSnapshot(const int32_t missionId, MissionSnapshot &missionSnapshot);
|
||||
|
||||
/**
|
||||
* Ask that the mission associated with a given mission ID be moved to the
|
||||
@ -391,6 +391,8 @@ public:
|
||||
|
||||
ErrCode GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want);
|
||||
|
||||
ErrCode GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info);
|
||||
|
||||
/**
|
||||
* Moving mission to the specified stack by mission option(Enter floating window mode).
|
||||
* @param missionOption, target mission option
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "ability_scheduler_interface.h"
|
||||
#include "ability_start_setting.h"
|
||||
#include "foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/appmgr/configuration.h"
|
||||
#include "mission_snapshot_info.h"
|
||||
#include "mission_snapshot.h"
|
||||
#include "ability_mission_info.h"
|
||||
#include "mission_option.h"
|
||||
#include "stack_info.h"
|
||||
@ -276,7 +276,7 @@ public:
|
||||
* @param missionId the id of the mission to retrieve the sAutoapshots
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot) = 0;
|
||||
virtual int GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap) = 0;
|
||||
|
||||
/**
|
||||
* Ask that the mission associated with a given mission ID be moved to the
|
||||
@ -488,6 +488,7 @@ public:
|
||||
|
||||
virtual int GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want) = 0;
|
||||
|
||||
virtual int GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info) = 0;
|
||||
/**
|
||||
* set lock screen white list
|
||||
*
|
||||
@ -710,11 +711,14 @@ public:
|
||||
|
||||
GET_PENDING_REQUEST_WANT,
|
||||
|
||||
GET_PENDING_WANT_SENDER_INFO,
|
||||
SET_SHOW_ON_LOCK_SCREEN,
|
||||
|
||||
// ipc id for starting ability by settings(1018)
|
||||
START_ABILITY_FOR_SETTINGS,
|
||||
|
||||
GET_ABILITY_MISSION_SNAPSHOT,
|
||||
|
||||
GET_SYSTEM_MEMORY_ATTR,
|
||||
|
||||
CLEAR_UP_APPLICATION_DATA,
|
||||
|
@ -22,6 +22,9 @@ namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace GlobalConfigurationKey {
|
||||
/* For the time being, there is no uniform standard */
|
||||
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!@*/
|
||||
/* Must be synchronized with the keystore(SystemConfigurationKeyStore)in the configuration */
|
||||
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
|
||||
static const std::string SYSTEM_LANGUAGE {"ohos.system.language"};
|
||||
static const std::string SYSTEM_ORIENTATION {"ohos.system.orientation"};
|
||||
} // namespace GlobalConfigurationKey
|
||||
|
@ -18,53 +18,20 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ability_record_info.h"
|
||||
#include "mission_description_info.h"
|
||||
#include "parcel.h"
|
||||
#include "want.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @struct ImageInfo
|
||||
* Defines image header information.
|
||||
*/
|
||||
struct ImageHeader : public Parcelable {
|
||||
/**
|
||||
* Color format, which is used to match image type. This variable is important.
|
||||
*/
|
||||
uint32_t colorMode = 8;
|
||||
|
||||
uint32_t reserved = 24;
|
||||
|
||||
uint16_t width;
|
||||
|
||||
uint16_t height;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
static ImageHeader *Unmarshalling(Parcel &parcel);
|
||||
};
|
||||
|
||||
/**
|
||||
* @struct ImageInfo
|
||||
* Defines image information.
|
||||
* ImageInfo is used to save informations about sanpshot.
|
||||
*/
|
||||
struct ImageInfo : public Parcelable {
|
||||
ImageHeader header;
|
||||
|
||||
/**
|
||||
* Size of the image data (in bytes)
|
||||
*/
|
||||
uint32_t dataSize;
|
||||
|
||||
uint8_t *data;
|
||||
|
||||
uint32_t userDataSize;
|
||||
/**
|
||||
* User-defined data
|
||||
*/
|
||||
void *userData;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t format;
|
||||
uint32_t size;
|
||||
int32_t shmKey;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
|
@ -1,41 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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_AAFWK_INTERFACES_INNERKITS_MISSION_SNAPSHOT_H
|
||||
#define OHOS_AAFWK_INTERFACES_INNERKITS_MISSION_SNAPSHOT_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "element_name.h"
|
||||
#include "parcel.h"
|
||||
#include "pixel_map.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @struct MissionSnapshotInfo
|
||||
* MissionSnapshotInfo is used to save informations about mission sanpshot.
|
||||
*/
|
||||
struct MissionSnapshot : public Parcelable {
|
||||
AppExecFwk::ElementName ability;
|
||||
Media::PixelMap snapshot;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
static MissionSnapshot *Unmarshalling(Parcel &parcel);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_AAFWK_INTERFACES_INNERKITS_MISSION_SNAPSHOT_H
|
||||
/*
|
||||
* Copyright (c) 2021 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_AAFWK_INTERFACES_INNERKITS_MISSION_SNAPSHOT_H
|
||||
#define OHOS_AAFWK_INTERFACES_INNERKITS_MISSION_SNAPSHOT_H
|
||||
|
||||
#include <string>
|
||||
#include "image_info.h"
|
||||
#include "parcel.h"
|
||||
#include "element_name.h"
|
||||
#include "foundation/multimedia/image_standard/interfaces/innerkits/include/pixel_map.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @struct MissionPixelMap
|
||||
* MissionPixelMap is used to save informations about mission sanpshot.
|
||||
*/
|
||||
struct MissionPixelMap : public Parcelable {
|
||||
AppExecFwk::ElementName topAbility;
|
||||
AAFwk::ImageInfo imageInfo;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
static MissionPixelMap *Unmarshalling(Parcel &parcel);
|
||||
};
|
||||
|
||||
struct MissionSnapshot {
|
||||
AppExecFwk::ElementName topAbility;
|
||||
std::shared_ptr<Media::PixelMap> snapshot;
|
||||
};
|
||||
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_AAFWK_INTERFACES_INNERKITS_MISSION_SNAPSHOT_H
|
||||
|
32
interfaces/innerkits/ability_manager/include/shared_memory.h
Normal file
32
interfaces/innerkits/ability_manager/include/shared_memory.h
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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_AAFWK_INTERFACES_SHARED_MEMORY_H
|
||||
#define OHOS_AAFWK_INTERFACES_SHARED_MEMORY_H
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
class SharedMemory {
|
||||
public:
|
||||
SharedMemory() = default;
|
||||
~SharedMemory() = default;
|
||||
|
||||
static void ReleaseShmId(const int shmId);
|
||||
static void* PopSharedMemory(int shmKey, int size);
|
||||
static int PushSharedMemory(const void *data, const int size);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_AAFWK_INTERFACES_SHARED_MEMORY_H
|
@ -38,6 +38,7 @@ config("want_public_config") {
|
||||
"//foundation/aafwk/standard/interfaces/innerkits/want/include/ohos/aafwk/content",
|
||||
"//foundation/aafwk/standard/frameworks/kits/content/cpp/src",
|
||||
"//third_party/jsoncpp/include",
|
||||
"//third_party/json/include",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "element_name.h"
|
||||
#include "operation.h"
|
||||
#include "parcel.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using Operation = OHOS::AAFwk::Operation;
|
||||
|
||||
@ -757,6 +758,9 @@ public:
|
||||
|
||||
void DumpInfo(int level) const;
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
static Want *FromString(std::string &string);
|
||||
public:
|
||||
// action definition
|
||||
static const std::string ACTION_PLAY;
|
||||
@ -808,6 +812,9 @@ private:
|
||||
static bool CheckAndSetParameters(Want &want, const std::string &key, std::string &prop, const std::string &value);
|
||||
Uri GetLowerCaseScheme(const Uri &uri);
|
||||
void ToUriStringInner(std::string &uriString) const;
|
||||
nlohmann::json ToJson() const;
|
||||
bool ReadFromJson(nlohmann::json &wantJson);
|
||||
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
292
interfaces/kits/js/@ohos.ability.formmanager.d.ts
vendored
292
interfaces/kits/js/@ohos.ability.formmanager.d.ts
vendored
@ -1,292 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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.
|
||||
*/
|
||||
import { AsyncCallback } from './.basic';
|
||||
import { Want } from './ability/want';
|
||||
import { FormInfo } from './ability/forminfo';
|
||||
|
||||
/**
|
||||
* Provides utilities for system application components to access ability form
|
||||
* on the OHOS OS.
|
||||
* @name formManager
|
||||
* @since 7
|
||||
* @sysCap AAFwk
|
||||
* @devices phone, tablet
|
||||
* @permission N/A
|
||||
*/
|
||||
declare namespace formManager {
|
||||
/**
|
||||
* user need to force refresh form.
|
||||
*
|
||||
* <p>You can use this method to ask for newly form from service.</p>
|
||||
*
|
||||
* @param formId the specify form id.
|
||||
* @since 7
|
||||
*/
|
||||
function requestForm(formId: number, callback: AsyncCallback<void>): void;
|
||||
function requestForm(formId: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* delete forms.
|
||||
*
|
||||
* <p>You can use this method to delete ability form.</p>
|
||||
*
|
||||
* @param formId Indicates the form to be deleted.
|
||||
* @since 7
|
||||
*/
|
||||
function deleteForm(formId: number, callback: AsyncCallback<void>): void;
|
||||
function deleteForm(formId: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* release form.
|
||||
*
|
||||
* <p>You can use this method to release ability form, it does not delete form cache in
|
||||
* form manager.</p>
|
||||
*
|
||||
* @param formId Indicates the form to be released.
|
||||
* @param isReleaseCache Indicates whether to delete cache in service.
|
||||
* @since 7
|
||||
*/
|
||||
function releaseForm(formId: number, isReleaseCache: boolean, callback: AsyncCallback<void>): void;
|
||||
function releaseForm(formId: number, isReleaseCache: boolean): Promise<void>;
|
||||
|
||||
/**
|
||||
* Sends a notification to the form framework to make the specified forms visible.
|
||||
*
|
||||
* @param formIds Indicates the IDs of the forms to be made visible.
|
||||
* @since 7
|
||||
*/
|
||||
function notifyVisibleForms(formIds: Array<number>, callback: AsyncCallback<void>): void;
|
||||
function notifyVisibleForms(formIds: Array<number>): Promise<void>;
|
||||
|
||||
/**
|
||||
* Sends a notification to the form framework to make the specified forms invisible.
|
||||
*
|
||||
* @param formIds Indicates the IDs of the forms to be made invisible.
|
||||
* @since 7
|
||||
*/
|
||||
function notifyInvisibleForms(formIds: Array<number>, callback: AsyncCallback<void>): void;
|
||||
function notifyInvisibleForms(formIds: Array<number>): Promise<void>;
|
||||
|
||||
/**
|
||||
* set form refresh state to true.
|
||||
*
|
||||
* <p>You can use this method to set form refresh state to true, the form can receive new
|
||||
* update from service.</p>
|
||||
*
|
||||
* @param formIds the specify form id.
|
||||
* @since 7
|
||||
*/
|
||||
function enableFormsUpdate(formIds: Array<number>, callback: AsyncCallback<void>): void;
|
||||
function enableFormsUpdate(formIds: Array<number>): Promise<void>;
|
||||
|
||||
/**
|
||||
* set form refresh state to false.
|
||||
*
|
||||
* <p>You can use this method to set form refresh state to false, the form do not receive
|
||||
* new update from service.</p>
|
||||
*
|
||||
* @param formIds the specify form id.
|
||||
* @since 7
|
||||
*/
|
||||
function disableFormsUpdate(formIds: Array<number>, callback: AsyncCallback<void>): void;
|
||||
function disableFormsUpdate(formIds: Array<number>): Promise<void>;
|
||||
|
||||
/**
|
||||
* Check form manager service ready.
|
||||
*
|
||||
* <p>You can use this method to check if form manager service is ready.</p>
|
||||
*
|
||||
* @return Returns {@code true} form manager service ready; returns {@code false} otherwise.
|
||||
* @since 7
|
||||
*/
|
||||
function checkFMSReady(callback: AsyncCallback<boolean>): void;
|
||||
function checkFMSReady(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Cast temp form to narmal form.
|
||||
*
|
||||
* <p>You can use this method to cast a temp form to normal form.</p>
|
||||
*
|
||||
* @param formId the specify form id to be casted.
|
||||
* @since 7
|
||||
*/
|
||||
function castTempForm(formId: number, callback: AsyncCallback<void>): void;
|
||||
function castTempForm(formId: number): Promise<void>;
|
||||
|
||||
/**
|
||||
* Checks for and deletes invalid forms of the application in the Form Manager Service based on the list of valid
|
||||
* form IDs passed.
|
||||
*
|
||||
* <p>If an empty list is passed to this method, the Form Manager Service will delete all forms of the
|
||||
* application.</p>
|
||||
*
|
||||
* @param persistedIds Indicates the list of valid forms with persisted IDs.
|
||||
* @since 7
|
||||
*/
|
||||
function checkAndDeleteInvalidForms(persistedIds: Array<number>, callback: AsyncCallback<void>): void;
|
||||
function checkAndDeleteInvalidForms(persistedIds: Array<number>): Promise<void>;
|
||||
|
||||
/**
|
||||
* Updates the content of a specified JS form.
|
||||
*
|
||||
* <p>This method is called by a form provider to update JS form data as needed.
|
||||
*
|
||||
* @param formId Indicates the ID of the JS form to update.
|
||||
* @param formBindingData Indicates the object used to update the JS form displayed
|
||||
* on the client.
|
||||
* @return Returns {@code true} if the update is successful; returns {@code false} otherwise.
|
||||
* @throws FormException Throws this exception if the form fails to be obtained due to any of the following reasons:
|
||||
* <ul>
|
||||
* <li>The passed {@code formID} or {@code component} is invalid. The value of {@code formID} must be larger than 0,
|
||||
* and {@code component} must not be null.</li>
|
||||
* <li>An error occurred when connecting to the Form Manager Service.</li>
|
||||
* <li>The specified form ID does not exist. </li>
|
||||
* <li>The form has been obtained by another application and cannot be updated by the current application.</li>
|
||||
* <li>The form is being restored.</li>
|
||||
* </ul>
|
||||
* @since 7
|
||||
*/
|
||||
function updateForm(formid: number, data: FormBindingData, callback: AsyncCallback<boolean>): void;
|
||||
function updateForm(formid: number, data: FormBindingData): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Set next refresh time since now.
|
||||
*
|
||||
* <p>This method is called by a form provider to set refresh time.
|
||||
*
|
||||
* @param formId Indicates the ID of the form to set refreshTime.
|
||||
* @param bundleName Indicates the bundleName of current form.
|
||||
* @param nextTime Indicates the next time gap now in seconds, can not be litter than 5 mins.
|
||||
* @return Returns {@code true} if seting succeed; returns {@code false} otherwise.
|
||||
* @throws FormException Throws this exception if the form fails to be obtained due to any of the following reasons:
|
||||
* <ul>
|
||||
* <li>The passed {@code formId} or {@code nextTime} is invalid. The value of {@code formId} must be larger
|
||||
* than 0, and {@code nextTime} must at least be 120 (5min).</li>
|
||||
* <li>An error occurred when connecting to the Form Manager Service.</li>
|
||||
* <li>The specified form ID does not exist. </li>
|
||||
* <li>The form has been obtained by another application and cannot be updated by the current application.</li>
|
||||
* <li>The form is being restored.</li>
|
||||
* </ul>
|
||||
* @since 7
|
||||
*/
|
||||
function setFormNextRefreshTime(formid: number, nextTime: number, callback: AsyncCallback<boolean>): boolean;
|
||||
function setFormNextRefreshTime(formid: number, nextTime: number): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* get all forms info.
|
||||
*
|
||||
* <p>You can use this method to get all forms info.</p>
|
||||
*
|
||||
* @return Returns the forms' information of all forms provided
|
||||
* @since 7
|
||||
*/
|
||||
function getAllFormsInfo(callback: AsyncCallback<Array<FormInfo>>): void;
|
||||
function getAllFormsInfo(): Promise<Array<FormInfo>>;
|
||||
|
||||
/**
|
||||
* get forms info by application name.
|
||||
*
|
||||
* <p>You can use this method to get all forms info of the specify application name.</p>
|
||||
*
|
||||
* @param bundleName application name.
|
||||
* @return Returns the forms' information of the specify application name.
|
||||
* @since 7
|
||||
*/
|
||||
function getFormsInfoByApp(bundleName: string, callback: AsyncCallback<FormInfo>): void;
|
||||
function getFormsInfoByApp(bundleName: string): Promise<FormInfo>;
|
||||
|
||||
/**
|
||||
* get forms info by application name and module name.
|
||||
*
|
||||
* <p>You can use this method to get all forms info of the specify application name and module name.</p>
|
||||
*
|
||||
* @param bundleName application name.
|
||||
* @param moduleName module name of hap
|
||||
* @return Returns the forms' information of the specify application name and module name
|
||||
* @since 7
|
||||
*/
|
||||
function getFormsInfoByModule(bundleName: string, moduleName: string, callback: AsyncCallback<FormInfo>): void;
|
||||
function getFormsInfoByModule(bundleName: string, moduleName: string): Promise<FormInfo>;
|
||||
|
||||
on(type: "formUninstalled", formID: number, callback: AsyncCallback<void>): void;
|
||||
off(type: "formUninstalled", formID: number, callback?: AsyncCallback<void>): void;
|
||||
|
||||
on(type: "getAnimation", callback: AsyncCallback<AnimatorOption>): void;
|
||||
off(type: "getAnimation", callback?: AsyncCallback<AnimatorOption>): void;
|
||||
|
||||
export enum FromParam {
|
||||
/**
|
||||
* Indicates the key specifying the ID of the form to be obtained, which is represented as
|
||||
* {@code intent.setParam(PARAM_FORM_IDENTITY_KEY, 1L)}.
|
||||
*/
|
||||
IDENTITY_KEY = "ohos.extra.param.key.form_identity",
|
||||
/**
|
||||
* Indicates the form dimension, now value support 1,2,3,4.
|
||||
*/
|
||||
DIMENSION_KEY = "ohos.extra.param.key.form_dimension",
|
||||
/**
|
||||
* Indicates the form name.
|
||||
*/
|
||||
NAME_KEY = "ohos.extra.param.key.form_name",
|
||||
/**
|
||||
* Indicates the module name of the form.
|
||||
*/
|
||||
NAME_KEY = "ohos.extra.param.key.module_name",
|
||||
/**
|
||||
* Indicates the form view width.
|
||||
*/
|
||||
WIDTH_KEY = "ohos.extra.param.key.form_width",
|
||||
/**
|
||||
* Indicates the form view height.
|
||||
*/
|
||||
HEIGHT_KEY = "ohos.extra.param.key.form_height",
|
||||
/**
|
||||
* Indicates the temporary flag of form to be obtained
|
||||
*/
|
||||
TEMPORARY_KEY = "ohos.extra.param.key.form_temporary"
|
||||
}
|
||||
|
||||
export enum FormError {
|
||||
ERR_CODE_COMMON = 1,
|
||||
ERR_PERMISSION_DENY = 2,
|
||||
ERR_GET_INFO_FAILED = 4,
|
||||
ERR_GET_BUNDLE_FAILED = 5,
|
||||
ERR_GET_LAYOUT_FAILED = 6,
|
||||
ERR_ADD_INVALID_PARAM = 7,
|
||||
ERR_CFG_NOT_MATCH_ID = 8,
|
||||
ERR_NOT_EXIST_ID = 9,
|
||||
ERR_BIND_PROVIDER_FAILED = 10,
|
||||
ERR_MAX_SYSTEM_FORMS = 11,
|
||||
ERR_MAX_INSTANCES_PER_FORM = 12,
|
||||
ERR_OPERATION_FORM_NOT_SELF = 13,
|
||||
ERR_PROVIDER_DEL_FAIL = 14,
|
||||
ERR_MAX_FORMS_PER_CLIENT = 15,
|
||||
ERR_MAX_SYSTEM_TEMP_FORMS = 16,
|
||||
ERR_FORM_NO_SUCH_MODULE = 17,
|
||||
ERR_FORM_NO_SUCH_ABILITY = 18,
|
||||
ERR_FORM_NO_SUCH_DIMENSION = 19,
|
||||
ERR_FORM_FA_NOT_INSTALLED = 20,
|
||||
|
||||
// error code in sdk
|
||||
ERR_GET_FMS_RPC = 30,
|
||||
ERR_FORM_DUPLICATE_ADDED = 31,
|
||||
ERR_SEND_FMS_MSG = 32,
|
||||
ERR_GET_BMS_RPC = 33,
|
||||
ERR_SEND_BMS_MSG = 34,
|
||||
ERR_START_ABILITY = 35,
|
||||
ERR_IN_RECOVER = 36
|
||||
}
|
||||
}
|
||||
export default formManager;
|
@ -18,6 +18,7 @@ ohos_shared_library("abilitymanager") {
|
||||
"//foundation/ace/napi/interfaces/kits",
|
||||
"//third_party/node/src",
|
||||
"//foundation/aafwk/standard/services/common/include",
|
||||
"//foundation/multimedia/image_standard/interfaces/kits/js/common/include/",
|
||||
"//utils/system/safwk/native/include",
|
||||
"./",
|
||||
]
|
||||
@ -26,6 +27,7 @@ ohos_shared_library("abilitymanager") {
|
||||
"napi_ability_manager.cpp",
|
||||
"native_module.cpp",
|
||||
]
|
||||
ldflags = [ "-Wl,-rpath=/system/lib/module/multimedia/" ]
|
||||
|
||||
deps = [
|
||||
"//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
|
||||
|
@ -293,6 +293,39 @@ int32_t RemoveMissionsForResult(const std::vector<int32_t> &missionIds)
|
||||
return error;
|
||||
}
|
||||
|
||||
void GetMissionSnapshotInfoForResult(napi_env env, MissionSnapshot &recentMissionInfos, napi_value result)
|
||||
{
|
||||
HILOG_INFO("%{public}s,%{public}d", __PRETTY_FUNCTION__, __LINE__);
|
||||
napi_value objTopAbilityInfo;
|
||||
NAPI_CALL_RETURN_VOID(env, napi_create_object(env, &objTopAbilityInfo));
|
||||
napi_value deviceId;
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_create_string_utf8(env, recentMissionInfos.topAbility.GetDeviceID().c_str(), NAPI_AUTO_LENGTH, &deviceId));
|
||||
HILOG_INFO("deviceId = [%{public}s]", recentMissionInfos.topAbility.GetDeviceID().c_str());
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, objTopAbilityInfo, "deviceId", deviceId));
|
||||
napi_value bundleName;
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_create_string_utf8(
|
||||
env, recentMissionInfos.topAbility.GetBundleName().c_str(), NAPI_AUTO_LENGTH, &bundleName));
|
||||
HILOG_INFO("bundleName = [%{public}s]", recentMissionInfos.topAbility.GetBundleName().c_str());
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, objTopAbilityInfo, "bundleName", bundleName));
|
||||
napi_value abilityName;
|
||||
NAPI_CALL_RETURN_VOID(env,
|
||||
napi_create_string_utf8(
|
||||
env, recentMissionInfos.topAbility.GetAbilityName().c_str(), NAPI_AUTO_LENGTH, &abilityName));
|
||||
HILOG_INFO("abilityName = [%{public}s]", recentMissionInfos.topAbility.GetAbilityName().c_str());
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, objTopAbilityInfo, "abilityName", abilityName));
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "topAbility", objTopAbilityInfo));
|
||||
|
||||
if (recentMissionInfos.snapshot) {
|
||||
napi_value iconResult = nullptr;
|
||||
iconResult = Media::PixelMapNapi::CreatePixelMap(env, recentMissionInfos.snapshot);
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "snapshot", iconResult));
|
||||
}else{
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, result, "snapshot", NapiGetNull(env)));
|
||||
}
|
||||
}
|
||||
|
||||
auto NAPI_QueryRecentAbilityMissionInfosAsyncExecuteCallback = [](napi_env env, void *data) {
|
||||
HILOG_INFO("queryRecentAbilityMissionInfos called(CallBack Mode)...");
|
||||
AsyncMissionInfosCallbackInfo *async_callback_info = (AsyncMissionInfosCallbackInfo *)data;
|
||||
@ -1814,6 +1847,130 @@ napi_value NAPI_ClearUpApplicationData(napi_env env, napi_callback_info info)
|
||||
return ((callBackMode) ? (nullptr) : (ret));
|
||||
}
|
||||
|
||||
auto NAPI_GetAbilityMissionSnapshotAsyncExecute = [](napi_env env, void *data) {
|
||||
HILOG_INFO("GetAbilityMissionSnapshotWrap called...");
|
||||
AsyncGetMissionSnapshot *async_callback_info = (AsyncGetMissionSnapshot *)data;
|
||||
AAFwk::AbilityManagerClient::GetInstance()->GetMissionSnapshot(async_callback_info->missionId,
|
||||
async_callback_info->missionSnapshot);
|
||||
};
|
||||
|
||||
auto NAPI_GetAbilityMissionSnapshotAsyncCompleteCallback = [](napi_env env, napi_status status, void *data) {
|
||||
HILOG_INFO("GetAbilityMissionSnapshotWrap compeleted(CallBack Mode)...");
|
||||
AsyncGetMissionSnapshot *async_callback_info = (AsyncGetMissionSnapshot *)data;
|
||||
napi_value result[2] = {0};
|
||||
napi_value callback;
|
||||
napi_value undefined;
|
||||
napi_value callResult = 0;
|
||||
|
||||
result[0] = GetCallbackErrorValue(async_callback_info->env, NapiAbilityMgr::BUSINESS_ERROR_CODE_OK);
|
||||
napi_create_object(async_callback_info->env, &result[1]);
|
||||
GetMissionSnapshotInfoForResult(
|
||||
async_callback_info->env, async_callback_info->missionSnapshot, result[1]);
|
||||
napi_get_undefined(env, &undefined);
|
||||
|
||||
napi_get_reference_value(env, async_callback_info->callback[0], &callback);
|
||||
napi_call_function(env, undefined, callback, 2, &result[0], &callResult);
|
||||
if (async_callback_info->callback[0] != nullptr) {
|
||||
napi_delete_reference(env, async_callback_info->callback[0]);
|
||||
}
|
||||
napi_delete_async_work(env, async_callback_info->asyncWork);
|
||||
delete async_callback_info;
|
||||
};
|
||||
|
||||
auto NAPI_GetAbilityMissionSnapshotPromiseCompleteCallback = [](napi_env env, napi_status status, void *data) {
|
||||
HILOG_INFO("GetAbilityMissionSnapshotWrap compeleted(Promise Mode)...");
|
||||
AsyncGetMissionSnapshot *async_callback_info = (AsyncGetMissionSnapshot *)data;
|
||||
napi_value result;
|
||||
napi_create_object(async_callback_info->env, &result);
|
||||
GetMissionSnapshotInfoForResult(async_callback_info->env, async_callback_info->missionSnapshot, result);
|
||||
napi_resolve_deferred(async_callback_info->env, async_callback_info->deferred, result);
|
||||
napi_delete_async_work(env, async_callback_info->asyncWork);
|
||||
delete async_callback_info;
|
||||
};
|
||||
|
||||
napi_value NAPI_GetAbilityMissionSnapshotWrap(
|
||||
napi_env env, napi_callback_info info, bool callBackMode, AsyncGetMissionSnapshot *async_callback_info)
|
||||
{
|
||||
HILOG_INFO("NAPI_GetAbilityMissionSnapshotWrap called...");
|
||||
if (callBackMode) {
|
||||
napi_value resourceName;
|
||||
napi_create_string_latin1(env, "NAPI_GetAbilityMissionSnapshotWrap", NAPI_AUTO_LENGTH, &resourceName);
|
||||
|
||||
napi_create_async_work(env,
|
||||
nullptr,
|
||||
resourceName,
|
||||
NAPI_GetAbilityMissionSnapshotAsyncExecute,
|
||||
NAPI_GetAbilityMissionSnapshotAsyncCompleteCallback,
|
||||
(void *)async_callback_info,
|
||||
&async_callback_info->asyncWork);
|
||||
|
||||
NAPI_CALL(env, napi_queue_async_work(env, async_callback_info->asyncWork));
|
||||
// create reutrn
|
||||
napi_value ret = 0;
|
||||
NAPI_CALL(env, napi_create_int32(env, 0, &ret));
|
||||
return ret;
|
||||
} else {
|
||||
napi_value resourceName;
|
||||
napi_create_string_latin1(env, "NAPI_GetAbilityMissionSnapshotWrap", NAPI_AUTO_LENGTH, &resourceName);
|
||||
|
||||
napi_deferred deferred;
|
||||
napi_value promise;
|
||||
NAPI_CALL(env, napi_create_promise(env, &deferred, &promise));
|
||||
async_callback_info->deferred = deferred;
|
||||
|
||||
napi_create_async_work(env,
|
||||
nullptr,
|
||||
resourceName,
|
||||
NAPI_GetAbilityMissionSnapshotAsyncExecute,
|
||||
NAPI_GetAbilityMissionSnapshotPromiseCompleteCallback,
|
||||
(void *)async_callback_info,
|
||||
&async_callback_info->asyncWork);
|
||||
napi_queue_async_work(env, async_callback_info->asyncWork);
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
napi_value NAPI_GetAbilityMissionSnapshot(napi_env env, napi_callback_info info)
|
||||
{
|
||||
size_t argc = 2;
|
||||
napi_value argv[argc];
|
||||
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL));
|
||||
HILOG_INFO("argc = [%{public}d]", argc);
|
||||
|
||||
napi_valuetype valuetype0;
|
||||
NAPI_CALL(env, napi_typeof(env, argv[0], &valuetype0));
|
||||
NAPI_ASSERT(env, valuetype0 == napi_number, "Wrong argument type. Numbers expected.");
|
||||
int32_t missionId;
|
||||
NAPI_CALL(env, napi_get_value_int32(env, argv[0], &missionId));
|
||||
|
||||
bool callBackMode = false;
|
||||
if (argc >= 2) {
|
||||
napi_valuetype valuetype;
|
||||
NAPI_CALL(env, napi_typeof(env, argv[1], &valuetype));
|
||||
NAPI_ASSERT(env, valuetype == napi_function, "Wrong argument type. Function expected.");
|
||||
callBackMode = true;
|
||||
}
|
||||
|
||||
AsyncGetMissionSnapshot *async_callback_info =
|
||||
new (std::nothrow) AsyncGetMissionSnapshot{.env = env, .asyncWork = nullptr, .deferred = nullptr};
|
||||
if (async_callback_info == nullptr) {
|
||||
return NapiGetNull(env);
|
||||
}
|
||||
|
||||
async_callback_info->missionId = missionId;
|
||||
if (callBackMode) {
|
||||
napi_create_reference(env, argv[1], 1, &async_callback_info->callback[0]);
|
||||
}
|
||||
|
||||
napi_value ret = NAPI_GetAbilityMissionSnapshotWrap(env, info, callBackMode, async_callback_info);
|
||||
if (ret == nullptr) {
|
||||
delete async_callback_info;
|
||||
async_callback_info = nullptr;
|
||||
}
|
||||
|
||||
return ((callBackMode) ? (NapiGetNull(env)) : (ret));
|
||||
}
|
||||
|
||||
void CreateWeightReasonCodeObject(napi_env env, napi_value value)
|
||||
{
|
||||
napi_value nUnknow = nullptr;
|
||||
@ -1868,6 +2025,13 @@ napi_value GetCallbackErrorValue(napi_env env, int errCode)
|
||||
return result;
|
||||
}
|
||||
|
||||
napi_value NapiGetNull(napi_env env)
|
||||
{
|
||||
napi_value result = 0;
|
||||
napi_get_null(env, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
static napi_value SystemMemoryAttrConvertJSObject(napi_env env, const SystemMemoryAttr &memoryInfo)
|
||||
{
|
||||
napi_value retJsObject = nullptr;
|
||||
|
@ -21,11 +21,16 @@
|
||||
#include "ability_mission_info.h"
|
||||
#include "napi/native_common.h"
|
||||
#include "napi/native_node_api.h"
|
||||
#include "pixel_map_napi.h"
|
||||
#include "ability_manager_client.h"
|
||||
#include "running_process_info.h"
|
||||
#include "system_memory_attr.h"
|
||||
#include "ability_mission_info.h"
|
||||
#include "mission_snapshot.h"
|
||||
|
||||
using RunningProcessInfo = OHOS::AppExecFwk::RunningProcessInfo;
|
||||
using AbilityMissionInfo = OHOS::AAFwk::AbilityMissionInfo;
|
||||
using MissionSnapshot = OHOS::AAFwk::MissionSnapshot;
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
@ -121,6 +126,15 @@ struct AsyncPreviousMissionInfosCallbackInfo {
|
||||
std::vector<AbilityMissionInfo> previousMissionInfo;
|
||||
};
|
||||
|
||||
struct AsyncGetMissionSnapshot {
|
||||
napi_env env;
|
||||
napi_async_work asyncWork;
|
||||
napi_deferred deferred;
|
||||
napi_ref callback[2] = {0};
|
||||
int32_t missionId = -1;
|
||||
MissionSnapshot missionSnapshot;
|
||||
};
|
||||
|
||||
struct SystemMemroyInfoCB {
|
||||
std::shared_ptr<SystemMemoryAttr> info = nullptr;
|
||||
napi_async_work asyncWork = nullptr;
|
||||
@ -140,8 +154,10 @@ napi_value NAPI_ClearMissions(napi_env env, napi_callback_info info);
|
||||
napi_value NAPI_MoveMissionToTop(napi_env env, napi_callback_info info);
|
||||
napi_value NAPI_KillProcessesByBundleName(napi_env env, napi_callback_info info);
|
||||
napi_value NAPI_ClearUpApplicationData(napi_env env, napi_callback_info info);
|
||||
napi_value NAPI_GetAbilityMissionSnapshot(napi_env env, napi_callback_info info);
|
||||
void CreateWeightReasonCodeObject(napi_env env, napi_value value);
|
||||
napi_value GetCallbackErrorValue(napi_env env, int errCode);
|
||||
napi_value NapiGetNull(napi_env env);
|
||||
napi_value NAPI_GetSystemMemoryAttr(napi_env env, napi_callback_info);
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
@ -52,6 +52,7 @@ static napi_value Init(napi_env env, napi_value exports)
|
||||
DECLARE_NAPI_FUNCTION("moveMissionToTop", NAPI_MoveMissionToTop),
|
||||
DECLARE_NAPI_FUNCTION("killProcessesByBundleName", NAPI_KillProcessesByBundleName),
|
||||
DECLARE_NAPI_FUNCTION("clearUpApplicationData", NAPI_ClearUpApplicationData),
|
||||
DECLARE_NAPI_FUNCTION("getAbilityMissionSnapshot", NAPI_GetAbilityMissionSnapshot),
|
||||
DECLARE_NAPI_PROPERTY("WeightReasonCode", nWeightReasonCode),
|
||||
DECLARE_NAPI_FUNCTION("getSystemMemoryAttr", NAPI_GetSystemMemoryAttr),
|
||||
};
|
||||
|
@ -48,10 +48,13 @@ config("abilityms_config") {
|
||||
"//prebuilts/jdk/jdk8/linux-x86/include/linux",
|
||||
"//third_party/json/include",
|
||||
"//foundation/aafwk/standard/frameworks/kits/ability/native/include",
|
||||
"//foundation/graphic/standard/interfaces/innerkits",
|
||||
"//foundation/multimedia/image_standard/interfaces/innerkits/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_rdb/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_appdatafwk/include",
|
||||
"//foundation/distributeddatamgr/appdatamgr/interfaces/innerkits/native_dataability/include",
|
||||
"//foundation/aafwk/standard/interfaces/innerkits/dataobs_manager/include",
|
||||
"//foundation/graphic/standard/interfaces/innerkits/wmservice",
|
||||
"//base/global/i18n_standard/frameworks/intl/include",
|
||||
"//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include",
|
||||
"//base/hiviewdfx/hiview/adapter/utility/include",
|
||||
@ -67,7 +70,6 @@ ohos_shared_library("abilityms") {
|
||||
sources += [ "${services_path}/abilitymgr/src/sa_mgr_client.cpp" ]
|
||||
|
||||
configs = [ ":abilityms_config" ]
|
||||
|
||||
deps = [
|
||||
"${innerkits_path}/base:base",
|
||||
"${innerkits_path}/want:want",
|
||||
@ -98,7 +100,10 @@ ohos_shared_library("abilityms") {
|
||||
"ipc:ipc_core",
|
||||
]
|
||||
|
||||
public_deps = [ "//foundation/distributedschedule/dmsfwk/services/dtbschedmgr:distributedschedsvr" ]
|
||||
public_deps = [
|
||||
"//foundation/distributedschedule/dmsfwk/services/dtbschedmgr:distributedschedsvr",
|
||||
"//foundation/graphic/standard:libwmservice",
|
||||
]
|
||||
|
||||
subsystem_name = "aafwk"
|
||||
part_name = "aafwk_standard"
|
||||
|
@ -31,6 +31,7 @@ abilityms_files = [
|
||||
"${services_path}/abilitymgr/src/data_ability_manager.cpp",
|
||||
"${services_path}/abilitymgr/src/data_ability_record.cpp",
|
||||
"${services_path}/abilitymgr/src/launch_param.cpp",
|
||||
"${services_path}/abilitymgr/src/image_info.cpp",
|
||||
"${services_path}/abilitymgr/src/lifecycle_deal.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_record.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_stack.cpp",
|
||||
@ -42,9 +43,7 @@ abilityms_files = [
|
||||
"${services_path}/abilitymgr/src/ability_record_info.cpp",
|
||||
"${services_path}/abilitymgr/src/ability_mission_info.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_description_info.cpp",
|
||||
"${services_path}/abilitymgr/src/image_info.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_snapshot_info.cpp",
|
||||
"${services_path}/abilitymgr/src/kernal_ability_manager.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_snapshot.cpp",
|
||||
"${services_path}/abilitymgr/src/kernal_system_app_manager.cpp",
|
||||
"${services_path}/abilitymgr/src/caller_info.cpp",
|
||||
"${services_path}/abilitymgr/src/sender_info.cpp",
|
||||
@ -63,7 +62,10 @@ abilityms_files = [
|
||||
"${services_path}/abilitymgr/src/ability_start_setting.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_option.cpp",
|
||||
"${services_path}/abilitymgr/src/stack_setting.cpp",
|
||||
"${services_path}/abilitymgr/src/shared_memory.cpp",
|
||||
"${services_path}/abilitymgr/src/resume_mission_container.cpp",
|
||||
"${services_path}/abilitymgr/src/screenshot_handler.cpp",
|
||||
"${services_path}/abilitymgr/src/screenshot_response.cpp",
|
||||
"${services_path}/abilitymgr/src/ams_configuration_parameter.cpp",
|
||||
|
||||
"${services_path}/abilitymgr/src/mission_index_info.cpp",
|
||||
@ -81,7 +83,7 @@ abilityms_files = [
|
||||
"${services_path}/abilitymgr/src/mission_listener_stub.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_list_manager.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_list.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_snapshot.cpp",
|
||||
"${services_path}/abilitymgr/src/task_data_persistence_mgr.cpp",
|
||||
"${services_path}/abilitymgr/src/start_options.cpp",
|
||||
"${services_path}/abilitymgr/src/kernal_ability_manager.cpp",
|
||||
]
|
||||
|
@ -257,7 +257,7 @@ public:
|
||||
* @param missionId the id of the mission to retrieve the sAutoapshots
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot) override;
|
||||
virtual int GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap) override;
|
||||
|
||||
/**
|
||||
* Ask that the mission associated with a given mission ID be moved to the
|
||||
@ -471,6 +471,7 @@ public:
|
||||
|
||||
virtual int GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want) override;
|
||||
|
||||
virtual int GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info) override;
|
||||
/**
|
||||
* set lock screen white list
|
||||
*
|
||||
|
@ -326,7 +326,7 @@ public:
|
||||
* @param missionId the id of the mission to retrieve the sAutoapshots
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot) override;
|
||||
virtual int GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap) override;
|
||||
|
||||
/**
|
||||
* Ask that the mission associated with a given mission ID be moved to the
|
||||
@ -553,6 +553,8 @@ public:
|
||||
|
||||
virtual int GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want) override;
|
||||
|
||||
virtual int GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info) override;
|
||||
|
||||
/**
|
||||
* set lock screen white list
|
||||
*
|
||||
|
@ -100,6 +100,7 @@ private:
|
||||
int UnregisterCancelListenerInner(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
int GetPendingRequestWantInner(MessageParcel &data, MessageParcel &reply);
|
||||
int GetWantSenderInfoInner(MessageParcel &data, MessageParcel &reply);
|
||||
int SetShowOnLockScreenInner(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
int GetSystemMemoryAttrInner(MessageParcel &data, MessageParcel &reply);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "ability_record.h"
|
||||
#include "application_info.h"
|
||||
#include "mission_record.h"
|
||||
#include "mission_snapshot.h"
|
||||
#include "mission_stack.h"
|
||||
#include "mission_index_info.h"
|
||||
#include "mission_option.h"
|
||||
@ -37,6 +38,7 @@
|
||||
#include "stack_info.h"
|
||||
#include "power_storage.h"
|
||||
#include "want.h"
|
||||
#include "screenshot_handler.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
@ -431,12 +433,8 @@ public:
|
||||
|
||||
void RestartAbility(const std::shared_ptr<AbilityRecord> abilityRecord);
|
||||
|
||||
/**
|
||||
* set lock screen white list
|
||||
*
|
||||
* @param isAllow whether to allow startup on lock screen.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int GetMissionSnapshot(int32_t missionId, MissionPixelMap &missionPixelMap);
|
||||
|
||||
int SetShowOnLockScreen(const std::string &bundleName, bool isAllow);
|
||||
void UpdateLockScreenState(bool isLockScreen);
|
||||
private:
|
||||
@ -791,6 +789,7 @@ private:
|
||||
std::map<int, std::weak_ptr<AbilityRecord>> focusAbilityRecordMap_; // abilities has been focused ,
|
||||
// key : display id, value: focused ability
|
||||
std::shared_ptr<ResumeMissionContainer> resumeMissionContainer_;
|
||||
std::shared_ptr<ScreenshotHandler> screenshotHandler_;
|
||||
static int64_t splitScreenStackId;
|
||||
const static std::map<SystemWindowMode, std::string> windowModeToStrMap_;
|
||||
std::shared_ptr<LockScreenEventSubscriber> subscriber_ = nullptr;
|
||||
|
@ -146,6 +146,7 @@ public:
|
||||
void RegisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &recevier);
|
||||
void UnregisterCancelListener(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &recevier);
|
||||
int32_t GetPendingRequestWant(const sptr<IWantSender> &target, std::shared_ptr<Want> &want);
|
||||
int32_t GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info);
|
||||
|
||||
void CancelWantSenderLocked(PendingWantRecord &record, bool cleanAbility);
|
||||
int32_t PendingWantStartAbility(
|
||||
|
45
services/abilitymgr/include/screenshot_handler.h
Normal file
45
services/abilitymgr/include/screenshot_handler.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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_AAFWK_SCREEN_SHOT_HANDLER_H
|
||||
#define OHOS_AAFWK_SCREEN_SHOT_HANDLER_H
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include "nocopyable.h"
|
||||
#include "screenshot_response.h"
|
||||
#include "window_manager_service_client.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
class ScreenshotHandler {
|
||||
public:
|
||||
ScreenshotHandler();
|
||||
virtual ~ScreenshotHandler() = default;
|
||||
|
||||
void StartScreenshot(int32_t missionId, int32_t winId);
|
||||
WMImageInfo GetImageInfo(int32_t missionId);
|
||||
void RemoveImageInfo(int32_t missionId);
|
||||
|
||||
private:
|
||||
std::map<int32_t, WMImageInfo> screenShot_;
|
||||
sptr<IWindowManagerService> windowMS_;
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OHOS_AAFWK_SCREEN_SHOT_HANDLER_H
|
@ -13,27 +13,34 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_AAFWK_INTERFACES_INNERKITS_MISSION_SNAPSHOT_INFO_H
|
||||
#define OHOS_AAFWK_INTERFACES_INNERKITS_MISSION_SNAPSHOT_INFO_H
|
||||
#ifndef OHOS_AAFWK_SCREEN_SHOT_RESPONSE_H
|
||||
#define OHOS_AAFWK_SCREEN_SHOT_RESPONSE_H
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include "image_info.h"
|
||||
#include "parcel.h"
|
||||
#include "nocopyable.h"
|
||||
#include <condition_variable>
|
||||
#include "wm_common.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
/**
|
||||
* @struct MissionSnapshotInfo
|
||||
* MissionSnapshotInfo is used to save informations about mission sanpshot.
|
||||
*/
|
||||
struct MissionSnapshotInfo : public Parcelable {
|
||||
ImageInfo snapshot;
|
||||
class ScreenShotResponse {
|
||||
public:
|
||||
ScreenShotResponse() = default;
|
||||
virtual ~ScreenShotResponse() = default;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
virtual bool Marshalling(Parcel &parcel) const override;
|
||||
static MissionSnapshotInfo *Unmarshalling(Parcel &parcel);
|
||||
void OnWindowShot(const struct WMImageInfo &info);
|
||||
WMImageInfo GetImageInfo();
|
||||
|
||||
private:
|
||||
static constexpr int TIME_OUT = 200 * 1000;
|
||||
std::mutex mutex_;
|
||||
std::condition_variable condition_;
|
||||
std::shared_ptr<WMImageInfo> info_;
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_AAFWK_INTERFACES_INNERKITS_MISSION_SNAPSHOT_INFO_H
|
||||
|
||||
#endif // OHOS_AAFWK_SCREEN_SHOT_RESPONSE_H
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "ability_manager_client.h"
|
||||
|
||||
#include "string_ex.h"
|
||||
#include "ability_manager_interface.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "if_system_ability_manager.h"
|
||||
@ -22,6 +23,7 @@
|
||||
#include "iservice_registry.h"
|
||||
#include "string_ex.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "shared_memory.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
@ -244,11 +246,41 @@ ErrCode AbilityManagerClient::GetRecentMissions(
|
||||
return abms->GetRecentMissions(numMax, flags, recentList);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot)
|
||||
ErrCode AbilityManagerClient::GetMissionSnapshot(const int32_t missionId, MissionSnapshot &missionSnapshot)
|
||||
{
|
||||
CHECK_REMOTE_OBJECT_AND_RETURN(remoteObject_, ABILITY_SERVICE_NOT_CONNECTED);
|
||||
sptr<IAbilityManager> abms = iface_cast<IAbilityManager>(remoteObject_);
|
||||
return abms->GetMissionSnapshot(missionId, snapshot);
|
||||
MissionPixelMap missionPixelMap;
|
||||
int ret = abms->GetMissionSnapshot(missionId, missionPixelMap);
|
||||
if (ret == ERR_OK) {
|
||||
HILOG_INFO("missionPixelMap.imageInfo.shmKey: %{public}d", missionPixelMap.imageInfo.shmKey);
|
||||
if (0 == missionPixelMap.imageInfo.size) {
|
||||
HILOG_INFO("size is 0.");
|
||||
return -1;
|
||||
}
|
||||
void *data = SharedMemory::PopSharedMemory(missionPixelMap.imageInfo.shmKey, missionPixelMap.imageInfo.size);
|
||||
if (!data) {
|
||||
HILOG_INFO("SharedMemory::PopSharedMemory return value is nullptr.");
|
||||
return -1;
|
||||
}
|
||||
Media::InitializationOptions mediaOption;
|
||||
mediaOption.size.width = missionPixelMap.imageInfo.width;
|
||||
mediaOption.size.height = missionPixelMap.imageInfo.height;
|
||||
mediaOption.pixelFormat = Media::PixelFormat::BGRA_8888;
|
||||
mediaOption.editable = true;
|
||||
auto pixel =
|
||||
Media::PixelMap::Create((const uint32_t *)data, missionPixelMap.imageInfo.size / sizeof(uint32_t), mediaOption);
|
||||
if (!pixel) {
|
||||
HILOG_INFO(" Media::PixelMap::Create return value is nullptr.");
|
||||
return -1;
|
||||
}
|
||||
HILOG_INFO("width = [%{public}d]", pixel->GetWidth());
|
||||
HILOG_INFO("height = [%{public}d]", pixel->GetHeight());
|
||||
HILOG_INFO("size = [%{public}d]", missionPixelMap.imageInfo.size);
|
||||
missionSnapshot.topAbility = missionPixelMap.topAbility;
|
||||
missionSnapshot.snapshot = std::move(pixel);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::MoveMissionToTop(int32_t missionId)
|
||||
@ -562,6 +594,21 @@ ErrCode AbilityManagerClient::GetPendingRequestWant(const sptr<IWantSender> &tar
|
||||
return abms->GetPendingRequestWant(target, want);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info)
|
||||
{
|
||||
CHECK_REMOTE_OBJECT_AND_RETURN(remoteObject_, ABILITY_SERVICE_NOT_CONNECTED);
|
||||
if (target == nullptr) {
|
||||
HILOG_ERROR("target is nullptr.");
|
||||
return ABILITY_SERVICE_NOT_CONNECTED;
|
||||
}
|
||||
if (info == nullptr) {
|
||||
HILOG_ERROR("info is nullptr.");
|
||||
return ABILITY_SERVICE_NOT_CONNECTED;
|
||||
}
|
||||
sptr<IAbilityManager> abms = iface_cast<IAbilityManager>(remoteObject_);
|
||||
return abms->GetWantSenderInfo(target, info);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::SetShowOnLockScreen(bool isAllow)
|
||||
{
|
||||
CHECK_REMOTE_OBJECT_AND_RETURN(remoteObject_, ABILITY_SERVICE_NOT_CONNECTED);
|
||||
|
@ -15,6 +15,10 @@
|
||||
|
||||
#include "ability_manager_proxy.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
#include "errors.h"
|
||||
#include "string_ex.h"
|
||||
|
||||
@ -634,7 +638,7 @@ int AbilityManagerProxy::GetRecentMissions(
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int AbilityManagerProxy::GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot)
|
||||
int AbilityManagerProxy::GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap)
|
||||
{
|
||||
int error;
|
||||
MessageParcel data;
|
||||
@ -653,12 +657,12 @@ int AbilityManagerProxy::GetMissionSnapshot(const int32_t missionId, MissionSnap
|
||||
HILOG_ERROR("Send request error: %{public}d", error);
|
||||
return error;
|
||||
}
|
||||
std::unique_ptr<MissionSnapshotInfo> info(reply.ReadParcelable<MissionSnapshotInfo>());
|
||||
std::unique_ptr<MissionPixelMap> info(reply.ReadParcelable<MissionPixelMap>());
|
||||
if (!info) {
|
||||
HILOG_ERROR("readParcelableInfo failed.");
|
||||
return ERR_UNKNOWN_OBJECT;
|
||||
}
|
||||
snapshot = *info;
|
||||
missionPixelMap = *info;
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
@ -1416,6 +1420,37 @@ int AbilityManagerProxy::GetPendingRequestWant(const sptr<IWantSender> &target,
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int AbilityManagerProxy::GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!WriteInterfaceToken(data)) {
|
||||
return INNER_ERR;
|
||||
}
|
||||
if (target == nullptr || !data.WriteParcelable(target->AsObject())) {
|
||||
HILOG_ERROR("target write failed.");
|
||||
return INNER_ERR;
|
||||
}
|
||||
if (info == nullptr || !data.WriteParcelable(info.get())) {
|
||||
HILOG_ERROR("info write failed.");
|
||||
return INNER_ERR;
|
||||
}
|
||||
auto error = Remote()->SendRequest(IAbilityManager::GET_PENDING_WANT_SENDER_INFO, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
HILOG_ERROR("Send request error: %{public}d", error);
|
||||
return error;
|
||||
}
|
||||
std::unique_ptr<WantSenderInfo> wantSenderInfo(reply.ReadParcelable<WantSenderInfo>());
|
||||
if (!wantSenderInfo) {
|
||||
HILOG_ERROR("readParcelable Info failed");
|
||||
return INNER_ERR;
|
||||
}
|
||||
info = std::move(wantSenderInfo);
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int AbilityManagerProxy::SetShowOnLockScreen(bool isAllow)
|
||||
{
|
||||
int error;
|
||||
@ -1742,4 +1777,4 @@ int AbilityManagerProxy::MoveMissionToFront(int32_t missionId)
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
} // namespace OHOS
|
@ -598,9 +598,13 @@ int AbilityManagerService::GetRecentMissions(
|
||||
return currentStackManager_->GetRecentMissions(numMax, flags, recentList);
|
||||
}
|
||||
|
||||
int AbilityManagerService::GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot)
|
||||
int AbilityManagerService::GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap)
|
||||
{
|
||||
return 0;
|
||||
if (missionId < 0) {
|
||||
HILOG_ERROR("GetMissionSnapshot failed.");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
return currentStackManager_->GetMissionSnapshot(missionId, missionPixelMap);
|
||||
}
|
||||
|
||||
int AbilityManagerService::SetMissionDescriptionInfo(
|
||||
@ -2353,6 +2357,15 @@ bool AbilityManagerService::CheckCallerIsSystemAppByIpc()
|
||||
return bms->CheckIsSystemAppByUid(callerUid);
|
||||
}
|
||||
|
||||
int AbilityManagerService::GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info)
|
||||
{
|
||||
HILOG_INFO("Get pending request info.");
|
||||
CHECK_POINTER_AND_RETURN(pendingWantManager_, ERR_INVALID_VALUE);
|
||||
CHECK_POINTER_AND_RETURN(target, ERR_INVALID_VALUE);
|
||||
CHECK_POINTER_AND_RETURN(info, ERR_INVALID_VALUE);
|
||||
return pendingWantManager_->GetWantSenderInfo(target, info);
|
||||
}
|
||||
|
||||
void AbilityManagerService::UpdateLockScreenState(bool isLockScreen)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s begin", __func__);
|
||||
|
@ -100,6 +100,7 @@ void AbilityManagerStub::SecondStepInit()
|
||||
requestFuncMap_[REGISTER_CANCEL_LISTENER] = &AbilityManagerStub::RegisterCancelListenerInner;
|
||||
requestFuncMap_[UNREGISTER_CANCEL_LISTENER] = &AbilityManagerStub::UnregisterCancelListenerInner;
|
||||
requestFuncMap_[GET_PENDING_REQUEST_WANT] = &AbilityManagerStub::GetPendingRequestWantInner;
|
||||
requestFuncMap_[GET_PENDING_WANT_SENDER_INFO] = &AbilityManagerStub::GetPendingRequestWantInner;
|
||||
requestFuncMap_[SET_MISSION_INFO] = &AbilityManagerStub::SetMissionDescriptionInfoInner;
|
||||
requestFuncMap_[GET_MISSION_LOCK_MODE_STATE] = &AbilityManagerStub::GetMissionLockModeStateInner;
|
||||
requestFuncMap_[UPDATE_CONFIGURATION] = &AbilityManagerStub::UpdateConfigurationInner;
|
||||
@ -290,10 +291,10 @@ int AbilityManagerStub::ScheduleCommandAbilityDoneInner(MessageParcel &data, Mes
|
||||
|
||||
int AbilityManagerStub::GetMissionSnapshotInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
MissionSnapshotInfo snapshot;
|
||||
MissionPixelMap missionPixelMap;
|
||||
int32_t missionId = data.ReadInt32();
|
||||
int32_t result = GetMissionSnapshot(missionId, snapshot);
|
||||
if (!reply.WriteParcelable(&snapshot)) {
|
||||
int32_t result = GetMissionSnapshot(missionId, missionPixelMap);
|
||||
if (!reply.WriteParcelable(&missionPixelMap)) {
|
||||
HILOG_ERROR("GetMissionSnapshot error");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
@ -864,6 +865,24 @@ int AbilityManagerStub::GetPendingRequestWantInner(MessageParcel &data, MessageP
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int AbilityManagerStub::GetWantSenderInfoInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
sptr<IWantSender> wantSender = iface_cast<IWantSender>(data.ReadParcelable<IRemoteObject>());
|
||||
if (wantSender == nullptr) {
|
||||
HILOG_ERROR("wantSender is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
|
||||
std::shared_ptr<WantSenderInfo> info(data.ReadParcelable<WantSenderInfo>());
|
||||
int32_t result = GetWantSenderInfo(wantSender, info);
|
||||
if (result != NO_ERROR) {
|
||||
HILOG_ERROR("GetWantSenderInfo is failed");
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
reply.WriteParcelable(info.get());
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int AbilityManagerStub::SetShowOnLockScreenInner(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
auto isAllow = data.ReadBool();
|
||||
|
@ -16,7 +16,10 @@
|
||||
#include "ability_stack_manager.h"
|
||||
|
||||
#include <map>
|
||||
#include <singleton.h>
|
||||
#include <fstream>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
#include "ability_manager_errors.h"
|
||||
#include "ability_manager_service.h"
|
||||
@ -25,7 +28,7 @@
|
||||
#include "bytrace.h"
|
||||
#include "common_event.h"
|
||||
#include "common_event_manager.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "shared_memory.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
@ -49,6 +52,7 @@ void AbilityStackManager::Init()
|
||||
|
||||
resumeMissionContainer_ = std::make_shared<ResumeMissionContainer>(
|
||||
DelayedSingleton<AbilityManagerService>::GetInstance()->GetEventHandler());
|
||||
screenshotHandler_ = std::make_shared<ScreenshotHandler>();
|
||||
powerStorage_ = std::make_shared<PowerStorage>();
|
||||
if (!SubscribeEvent()) {
|
||||
HILOG_ERROR("SubscribeEvent Error.");
|
||||
@ -4402,6 +4406,42 @@ void AbilityStackManager::CheckMissionRecordIsResume(const std::shared_ptr<Missi
|
||||
}
|
||||
}
|
||||
|
||||
int AbilityStackManager::GetMissionSnapshot(int32_t missionId, MissionPixelMap &missionPixelMap)
|
||||
{
|
||||
HILOG_INFO("Get mission snapshot.");
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(stackLock_);
|
||||
|
||||
auto missionRecord = GetMissionRecordFromAllStacks(missionId);
|
||||
CHECK_POINTER_AND_RETURN_LOG(missionRecord, REMOVE_MISSION_ID_NOT_EXIST, "mission is invalid.");
|
||||
auto topAbilityRecord = missionRecord->GetTopAbilityRecord();
|
||||
CHECK_POINTER_AND_RETURN_LOG(topAbilityRecord, REMOVE_MISSION_ID_NOT_EXIST, "top ability is invalid.");
|
||||
auto windowInfo = topAbilityRecord->GetWindowInfo();
|
||||
int windowID = 0;
|
||||
if(windowInfo){
|
||||
windowID = windowInfo->windowToken_;
|
||||
HILOG_INFO("windowID is %{public}d", windowID);
|
||||
}
|
||||
screenshotHandler_->StartScreenshot(missionId, windowID);
|
||||
auto topAbility = missionRecord->GetTopAbilityRecord();
|
||||
if (topAbility) {
|
||||
OHOS::AppExecFwk::ElementName topElement(topAbility->GetAbilityInfo().deviceId,
|
||||
topAbility->GetAbilityInfo().bundleName,
|
||||
topAbility->GetAbilityInfo().name);
|
||||
missionPixelMap.topAbility = topElement;
|
||||
}
|
||||
|
||||
auto imageInfo = screenshotHandler_->GetImageInfo(missionId);
|
||||
screenshotHandler_->RemoveImageInfo(missionId);
|
||||
HILOG_INFO("width : %{public}d, height: %{public}d", imageInfo.width, imageInfo.height);
|
||||
missionPixelMap.imageInfo.width = imageInfo.width;
|
||||
missionPixelMap.imageInfo.height = imageInfo.height;
|
||||
missionPixelMap.imageInfo.format = imageInfo.format;
|
||||
missionPixelMap.imageInfo.size = imageInfo.size;
|
||||
missionPixelMap.imageInfo.shmKey = SharedMemory::PushSharedMemory(imageInfo.data, imageInfo.size);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
bool AbilityStackManager::IsLockScreenState()
|
||||
{
|
||||
HILOG_INFO("Is Lock Screen State.");
|
||||
|
@ -21,41 +21,14 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
bool ImageHeader::ReadFromParcel(Parcel &parcel)
|
||||
{
|
||||
colorMode = parcel.ReadUint32();
|
||||
reserved = parcel.ReadUint32();
|
||||
width = parcel.ReadUint16();
|
||||
height = parcel.ReadUint16();
|
||||
return true;
|
||||
}
|
||||
|
||||
ImageHeader *ImageHeader::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
ImageHeader *info = new (std::nothrow) ImageHeader();
|
||||
if (info == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!info->ReadFromParcel(parcel)) {
|
||||
delete info;
|
||||
info = nullptr;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
bool ImageHeader::Marshalling(Parcel &parcel) const
|
||||
{
|
||||
parcel.WriteUint32(colorMode);
|
||||
parcel.WriteUint32(reserved);
|
||||
parcel.WriteUint16(width);
|
||||
parcel.WriteUint16(height);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ImageInfo::ReadFromParcel(Parcel &parcel)
|
||||
{
|
||||
return false;
|
||||
parcel.ReadUint32(width);
|
||||
parcel.ReadUint32(height);
|
||||
parcel.ReadUint32(format);
|
||||
parcel.ReadUint32(size);
|
||||
parcel.ReadInt32(shmKey);
|
||||
return true;
|
||||
}
|
||||
|
||||
ImageInfo *ImageInfo::Unmarshalling(Parcel &parcel)
|
||||
@ -74,7 +47,12 @@ ImageInfo *ImageInfo::Unmarshalling(Parcel &parcel)
|
||||
|
||||
bool ImageInfo::Marshalling(Parcel &parcel) const
|
||||
{
|
||||
return false;
|
||||
parcel.WriteUint32(width);
|
||||
parcel.WriteUint32(height);
|
||||
parcel.WriteUint32(format);
|
||||
parcel.WriteUint32(size);
|
||||
parcel.WriteInt32(shmKey);
|
||||
return true;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
@ -1,60 +1,64 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "mission_snapshot.h"
|
||||
|
||||
#include "hilog_wrapper.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "string_ex.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
bool MissionSnapshot::ReadFromParcel(Parcel &parcel)
|
||||
{
|
||||
auto elementName = parcel.ReadParcelable<AppExecFwk::ElementName>();
|
||||
if (elementName == nullptr) {
|
||||
return false;
|
||||
}
|
||||
ability = *elementName;
|
||||
auto pixelMap = parcel.ReadParcelable<Media::PixelMap>();
|
||||
if (pixelMap == nullptr) {
|
||||
return false;
|
||||
}
|
||||
snapshot = *pixelMap;
|
||||
return true;
|
||||
}
|
||||
|
||||
MissionSnapshot *MissionSnapshot::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
MissionSnapshot *info = new (std::nothrow) MissionSnapshot();
|
||||
if (info == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!info->ReadFromParcel(parcel)) {
|
||||
delete info;
|
||||
info = nullptr;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
bool MissionSnapshot::Marshalling(Parcel &parcel) const
|
||||
{
|
||||
parcel.WriteParcelable(&ability);
|
||||
parcel.WriteParcelable(&snapshot);
|
||||
return true;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "mission_snapshot.h"
|
||||
|
||||
#include "hilog_wrapper.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "string_ex.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
bool MissionPixelMap::ReadFromParcel(Parcel &parcel)
|
||||
{
|
||||
std::unique_ptr<AppExecFwk::ElementName> ability(parcel.ReadParcelable<AppExecFwk::ElementName>());
|
||||
if (ability == nullptr) {
|
||||
return false;
|
||||
}
|
||||
topAbility = *ability;
|
||||
std::unique_ptr<AAFwk::ImageInfo> image(parcel.ReadParcelable<AAFwk::ImageInfo>());
|
||||
if (ability == nullptr) {
|
||||
return false;
|
||||
}
|
||||
imageInfo = *image;
|
||||
return true;
|
||||
}
|
||||
|
||||
MissionPixelMap *MissionPixelMap::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
MissionPixelMap *info = new (std::nothrow) MissionPixelMap();
|
||||
if (info == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!info->ReadFromParcel(parcel)) {
|
||||
delete info;
|
||||
info = nullptr;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
bool MissionPixelMap::Marshalling(Parcel &parcel) const
|
||||
{
|
||||
if (!parcel.WriteParcelable(&topAbility)) {
|
||||
return false;
|
||||
}
|
||||
if (!parcel.WriteParcelable(&imageInfo)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "mission_snapshot_info.h"
|
||||
|
||||
#include "hilog_wrapper.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "string_ex.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
bool MissionSnapshotInfo::ReadFromParcel(Parcel &parcel)
|
||||
{
|
||||
std::unique_ptr<ImageInfo> image(parcel.ReadParcelable<ImageInfo>());
|
||||
if (image == nullptr) {
|
||||
return false;
|
||||
}
|
||||
snapshot = *image;
|
||||
return true;
|
||||
}
|
||||
|
||||
MissionSnapshotInfo *MissionSnapshotInfo::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
MissionSnapshotInfo *info = new (std::nothrow) MissionSnapshotInfo();
|
||||
if (info == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!info->ReadFromParcel(parcel)) {
|
||||
delete info;
|
||||
info = nullptr;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
bool MissionSnapshotInfo::Marshalling(Parcel &parcel) const
|
||||
{
|
||||
parcel.WriteParcelable(&snapshot);
|
||||
return true;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
@ -424,6 +424,33 @@ int32_t PendingWantManager::GetPendingRequestWant(const sptr<IWantSender> &targe
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t PendingWantManager::GetWantSenderInfo(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info)
|
||||
{
|
||||
HILOG_INFO("%{public}s:begin.", __func__);
|
||||
if (target == nullptr) {
|
||||
HILOG_ERROR("%{public}s:target is nullptr.", __func__);
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
if (info == nullptr) {
|
||||
HILOG_ERROR("%{public}s:info is nullptr.", __func__);
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
sptr<PendingWantRecord> targetRecord = iface_cast<PendingWantRecord>(target->AsObject());
|
||||
auto record = GetPendingWantRecordByCode(targetRecord->GetKey()->GetCode());
|
||||
if (record == nullptr) {
|
||||
HILOG_ERROR("%{public}s:record is nullptr.", __func__);
|
||||
return ERR_INVALID_VALUE;
|
||||
}
|
||||
WantSenderInfo wantSenderInfo;
|
||||
wantSenderInfo.requestCode = record->GetKey()->GetRequestCode();
|
||||
wantSenderInfo.type = record->GetKey()->GetType();
|
||||
wantSenderInfo.flags = record->GetKey()->GetFlags();
|
||||
wantSenderInfo.allWants = record->GetKey()->GetAllWantsInfos();
|
||||
info.reset(new (std::nothrow) WantSenderInfo(wantSenderInfo));
|
||||
HILOG_ERROR("%{public}s:want is ok.", __func__);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
void PendingWantManager::ClearPendingWantRecord(const std::string &bundleName)
|
||||
{
|
||||
HILOG_INFO("ClearPendingWantRecord, bundleName: %{public}s", bundleName.c_str());
|
||||
|
98
services/abilitymgr/src/screenshot_handler.cpp
Normal file
98
services/abilitymgr/src/screenshot_handler.cpp
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "screenshot_handler.h"
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <sys/mman.h>
|
||||
#include "hilog_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
|
||||
ScreenshotHandler::ScreenshotHandler()
|
||||
{
|
||||
auto wmsClient = WindowManagerServiceClient::GetInstance();
|
||||
if (wmsClient) {
|
||||
HILOG_INFO("init window manager service.");
|
||||
wmsClient->Init();
|
||||
windowMS_ = wmsClient->GetService();
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenshotHandler::StartScreenshot(int32_t missionId, int32_t winId)
|
||||
{
|
||||
HILOG_INFO("StartScreenshot");
|
||||
if (!windowMS_) {
|
||||
HILOG_INFO("wms is nullptr.");
|
||||
return;
|
||||
}
|
||||
auto response = std::make_shared<ScreenShotResponse>();
|
||||
|
||||
auto promise = windowMS_->ShotWindow(winId);
|
||||
if (!promise) {
|
||||
HILOG_INFO("promise is nullptr.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto then = [response](const auto &wmsinfo) {
|
||||
WMImageInfo wminfo = {
|
||||
.wret = wmsinfo.wret,
|
||||
.width = wmsinfo.width,
|
||||
.height = wmsinfo.height,
|
||||
.format = wmsinfo.format,
|
||||
.size = wmsinfo.stride * wmsinfo.height,
|
||||
.data = nullptr,
|
||||
};
|
||||
|
||||
auto data = mmap(nullptr, wminfo.size, PROT_READ, MAP_SHARED, wmsinfo.fd, 0);
|
||||
wminfo.data = data;
|
||||
|
||||
response->OnWindowShot(wminfo);
|
||||
|
||||
// 0xffffffff
|
||||
uint8_t *errPtr = nullptr;
|
||||
errPtr--;
|
||||
if (data != errPtr) {
|
||||
munmap(data, wminfo.size);
|
||||
}
|
||||
};
|
||||
promise->Then(then);
|
||||
|
||||
auto imageInfo = response->GetImageInfo();
|
||||
screenShot_.emplace(missionId, imageInfo);
|
||||
}
|
||||
|
||||
WMImageInfo ScreenshotHandler::GetImageInfo(int32_t missionId)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s begin", __func__);
|
||||
WMImageInfo imageInfo;
|
||||
auto iter = screenShot_.find(missionId);
|
||||
if (iter != screenShot_.end()) {
|
||||
imageInfo = iter->second;
|
||||
}
|
||||
|
||||
return imageInfo;
|
||||
}
|
||||
|
||||
void ScreenshotHandler::RemoveImageInfo(int32_t missionId)
|
||||
{
|
||||
HILOG_DEBUG("%{public}s begin", __func__);
|
||||
screenShot_.erase(missionId);
|
||||
HILOG_DEBUG("%{public}zu screenShot_ size", screenShot_.size());
|
||||
}
|
||||
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
56
services/abilitymgr/src/screenshot_response.cpp
Normal file
56
services/abilitymgr/src/screenshot_response.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include "hilog_wrapper.h"
|
||||
#include "screenshot_response.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
|
||||
void ScreenShotResponse::OnWindowShot(const struct WMImageInfo &info)
|
||||
{
|
||||
HILOG_INFO("On screen shot call back.");
|
||||
std::unique_lock<std::mutex> lock(mutex_);
|
||||
info_ = std::make_shared<WMImageInfo>();
|
||||
if (!info_) {
|
||||
return;
|
||||
}
|
||||
info_->width = info.width;
|
||||
info_->size = info.size;
|
||||
info_->height = info.height;
|
||||
info_->format = info.format;
|
||||
info_->data = info.data;
|
||||
condition_.notify_all();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
WMImageInfo info = *info_;
|
||||
info_.reset();
|
||||
return info;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
128
services/abilitymgr/src/shared_memory.cpp
Normal file
128
services/abilitymgr/src/shared_memory.cpp
Normal file
@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "shared_memory.h"
|
||||
#include <stdlib.h>
|
||||
#include <sys/shm.h>
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#include "hilog_wrapper.h"
|
||||
#include "securec.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace {
|
||||
constexpr int SHM_KEY_START = 400000; // chosen randomly
|
||||
constexpr int SHM_KEY_END = 500000; // chosen randomly
|
||||
constexpr unsigned int SHM_READ_WRITE_PERMISSIONS = 0666U;
|
||||
|
||||
#ifndef EOK
|
||||
#define EOK (0)
|
||||
#endif
|
||||
}
|
||||
|
||||
void SharedMemory::ReleaseShmId(const int shmId)
|
||||
{
|
||||
if (shmId == -1) {
|
||||
return;
|
||||
}
|
||||
if (shmctl(shmId, IPC_RMID, nullptr) == -1) {
|
||||
HILOG_ERROR("shmctl IPC_RMID failed: %{public}d.", errno);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
int SharedMemory::PushSharedMemory(const void *data, const int size)
|
||||
{
|
||||
// internal call, no need to check null.
|
||||
static int shmKey = SHM_KEY_START;
|
||||
int shmId;
|
||||
while ((shmId = shmget(shmKey, size, SHM_READ_WRITE_PERMISSIONS | IPC_CREAT | IPC_EXCL)) < 0) {
|
||||
if (errno == EEXIST) {
|
||||
++shmKey;
|
||||
if (shmKey >= SHM_KEY_END) {
|
||||
shmKey = SHM_KEY_START;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
HILOG_ERROR("shmget failed: %{public}d.", errno);
|
||||
return -1;
|
||||
}
|
||||
HILOG_INFO("shmget succeed, shmKey = %{public}d, shmId = %{public}d.", shmKey, shmId);
|
||||
|
||||
void *shared = shmat(shmId, nullptr, 0);
|
||||
if (shared == reinterpret_cast<void *>(-1)) {
|
||||
ReleaseShmId(shmId);
|
||||
HILOG_ERROR("shmat failed: %{public}d.", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int retCode;
|
||||
if ((retCode = memcpy_s(shared, size, data, size)) != EOK) {
|
||||
shmdt(shared);
|
||||
ReleaseShmId(shmId);
|
||||
HILOG_ERROR("memcpy_s failed: %{public}d.", retCode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// memcpy(shared, data, size);
|
||||
|
||||
if (shmdt(shared) == -1) {
|
||||
ReleaseShmId(shmId);
|
||||
HILOG_ERROR("shmdt failed: %{public}d.", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return shmKey;
|
||||
}
|
||||
|
||||
void* SharedMemory::PopSharedMemory(int shmKey, int size)
|
||||
{
|
||||
void *data = reinterpret_cast<void *>(malloc(size));
|
||||
int shmId = shmget(shmKey, 0, 0 | SHM_READ_WRITE_PERMISSIONS);
|
||||
if (shmId == -1) {
|
||||
HILOG_ERROR("shmId is invalid: %{public}d, %{public}d.", shmId, errno);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void *shared = shmat(shmId, nullptr, 0);
|
||||
if (shared == reinterpret_cast<void *>(-1)) {
|
||||
HILOG_ERROR("shmat failed %{public}d.", errno);
|
||||
ReleaseShmId(shmId);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int retCode = memcpy_s(data, size, shared, size);
|
||||
if (retCode != EOK) {
|
||||
shmdt(shared);
|
||||
ReleaseShmId(shmId);
|
||||
HILOG_ERROR("Failed to memory copy, retCode[%{public}d].", retCode);
|
||||
return nullptr;
|
||||
}
|
||||
// memcpy(data, shared, size);
|
||||
|
||||
if (shmdt(shared) == -1) {
|
||||
ReleaseShmId(shmId);
|
||||
HILOG_ERROR("shmdt failed: %{public}d.", errno);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ReleaseShmId(shmId);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
@ -65,7 +65,6 @@ ohos_source_set("abilityms_test_source") {
|
||||
"${services_path}/abilitymgr/src/mission_record.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_record_info.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_snapshot.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_snapshot_info.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_stack.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_stack_info.cpp",
|
||||
"${services_path}/abilitymgr/src/pending_want_common_event.cpp",
|
||||
@ -74,7 +73,10 @@ ohos_source_set("abilityms_test_source") {
|
||||
"${services_path}/abilitymgr/src/pending_want_record.cpp",
|
||||
"${services_path}/abilitymgr/src/power_storage.cpp",
|
||||
"${services_path}/abilitymgr/src/resume_mission_container.cpp",
|
||||
"${services_path}/abilitymgr/src/screenshot_handler.cpp",
|
||||
"${services_path}/abilitymgr/src/screenshot_response.cpp",
|
||||
"${services_path}/abilitymgr/src/sender_info.cpp",
|
||||
"${services_path}/abilitymgr/src/shared_memory.cpp",
|
||||
"${services_path}/abilitymgr/src/stack_info.cpp",
|
||||
"${services_path}/abilitymgr/src/stack_setting.cpp",
|
||||
"${services_path}/abilitymgr/src/task_data_persistence_mgr.cpp",
|
||||
@ -123,6 +125,7 @@ ohos_source_set("abilityms_test_source") {
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core:appexecfwk_core",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
|
||||
"//foundation/graphic/standard:libwmservice",
|
||||
"//foundation/multimedia/image_standard/interfaces/innerkits:image_native",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
@ -144,46 +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/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",
|
||||
]
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ ohos_source_set("appmgr_test_service") {
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
|
||||
public_deps = [ "//foundation/graphic/standard:libwmservice" ]
|
||||
|
||||
external_deps = [
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
|
@ -55,7 +55,7 @@ void AbilityConnectCallBackStubTest::WriteInterfaceToken(MessageParcel &data)
|
||||
* EnvConditions: ElementName is nullptr
|
||||
* CaseDescription: Verify that on remote request is normal and abnormal
|
||||
*/
|
||||
HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_001, TestSize.Level0)
|
||||
HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_001, TestSize.Level1)
|
||||
{
|
||||
sptr<MockAbilityConnectCallback> mockAbilityConnectStub(new MockAbilityConnectCallback());
|
||||
|
||||
@ -83,7 +83,7 @@ HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_001, Test
|
||||
* EnvConditions: ElementName is not nullptr
|
||||
* CaseDescription: Verify that on remote request is normal and abnormal
|
||||
*/
|
||||
HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_002, TestSize.Level0)
|
||||
HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_002, TestSize.Level1)
|
||||
{
|
||||
sptr<MockAbilityConnectCallback> mockAbilityConnectStub(new MockAbilityConnectCallback());
|
||||
|
||||
@ -112,7 +112,7 @@ HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_002, Test
|
||||
* EnvConditions: ElementName is nullptr
|
||||
* CaseDescription: Verify that on remote request is normal and abnormal
|
||||
*/
|
||||
HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_003, TestSize.Level0)
|
||||
HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_003, TestSize.Level1)
|
||||
{
|
||||
sptr<MockAbilityConnectCallback> mockAbilityConnectStub(new MockAbilityConnectCallback());
|
||||
|
||||
@ -140,7 +140,7 @@ HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_003, Test
|
||||
* EnvConditions: ElementName is not nullptr
|
||||
* CaseDescription: Verify that on remote request is normal and abnormal
|
||||
*/
|
||||
HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_004, TestSize.Level0)
|
||||
HWTEST_F(AbilityConnectCallBackStubTest, AbilityConnectionCallBack_IPC_004, TestSize.Level1)
|
||||
{
|
||||
sptr<MockAbilityConnectCallback> mockAbilityConnectStub(new MockAbilityConnectCallback());
|
||||
|
||||
|
@ -59,7 +59,7 @@ void AbilityManagerProxyTest::SetUp()
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal process of startability
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_001, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_001, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -79,7 +79,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_001, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the return value of startability is abnormal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_002, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_002, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -99,7 +99,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_002, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal process of TerminateAbility
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_003, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_003, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -120,7 +120,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_003, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the return value of TerminateAbility is abnormal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_004, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_004, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -141,7 +141,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_004, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of connectability
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_005, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_005, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -166,7 +166,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_005, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the abnormal conditions of connectability
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_006, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_006, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -188,7 +188,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_006, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of disconnectAbility
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_007, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_007, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -208,7 +208,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_007, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the abnormal conditions of disconnectAbility
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_008, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_008, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -228,7 +228,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_008, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of attachAbilityThread
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_009, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_009, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -249,7 +249,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_009, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the abnormal conditions of attachAbilityThread
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_010, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_010, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -274,7 +274,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_010, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of abilityTransitionDone
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0011, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0011, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -295,7 +295,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0011, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the abnormal conditions of abilityTransitionDone
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_012, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_012, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -316,7 +316,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_012, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of scheduleConnectAbilityDone
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0013, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0013, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -337,7 +337,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0013, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the abnormal conditions of scheduleConnectAbilityDone
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_014, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_014, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -358,7 +358,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_014, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of scheduleDisconnectAbilityDone
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0015, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0015, TestSize.Level1)
|
||||
{
|
||||
sptr<IRemoteObject> token = nullptr;
|
||||
auto res = proxy_->ScheduleDisconnectAbilityDone(token);
|
||||
@ -373,7 +373,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0015, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of addWindowInfo
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0016, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0016, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -392,7 +392,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0016, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of dumpState
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0017, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0017, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -412,7 +412,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0017, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of terminateAbilityResult
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0018, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0018, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -432,7 +432,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0018, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the abnormal conditions of terminateAbilityResult
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_019, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_019, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -452,7 +452,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_019, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of getAllStackInfo
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0020, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0020, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -471,7 +471,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0020, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of getRecentMissions
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0021, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0021, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -493,7 +493,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0021, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of RemoveMission
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0023, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0023, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -511,7 +511,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0023, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of RemoveStack
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0024, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0024, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -529,7 +529,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0024, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal conditions of MoveMissionToTop
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0025, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0025, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -547,7 +547,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0025, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the abnormal conditions of ScheduleCommandAbilityDone
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_026, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_026, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -567,7 +567,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_026, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the normal process of StopServiceAbility
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_027, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_027, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -661,7 +661,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_031, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the function AcquireDataAbility normal flow.
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_AcquireDataAbility_001, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_AcquireDataAbility_001, TestSize.Level1)
|
||||
{
|
||||
OHOS::Uri dataAbilityUri("dataability:///data.bundle.DataAbility");
|
||||
AbilityRequest abilityRequest;
|
||||
@ -682,7 +682,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_AcquireDataAbility_001, Te
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the function AcquireDataAbility callerToken is nullptr.
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_AcquireDataAbility_002, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_AcquireDataAbility_002, TestSize.Level1)
|
||||
{
|
||||
OHOS::Uri dataAbilityUri("dataability:///data.bundle.DataAbility");
|
||||
|
||||
@ -698,7 +698,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_AcquireDataAbility_002, Te
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the function AcquireDataAbility SendRequest return error.
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_AcquireDataAbility_003, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_AcquireDataAbility_003, TestSize.Level1)
|
||||
{
|
||||
OHOS::Uri dataAbilityUri("dataability:///data.bundle.DataAbility");
|
||||
AbilityRequest abilityRequest;
|
||||
@ -719,7 +719,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_AcquireDataAbility_003, Te
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the function ReleaseDataAbility normal flow.
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_001, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_001, TestSize.Level1)
|
||||
{
|
||||
OHOS::sptr<IAbilityScheduler> scheduler = new AbilityScheduler();
|
||||
AbilityRequest abilityRequest;
|
||||
@ -740,7 +740,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_001, Te
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the function ReleaseDataAbility dataAbilityScheduler is nullptr.
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_002, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_002, TestSize.Level1)
|
||||
{
|
||||
AbilityRequest abilityRequest;
|
||||
abilityRequest.appInfo.bundleName = "data.client.bundle";
|
||||
@ -760,7 +760,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_002, Te
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the function ReleaseDataAbility callerToken is nullptr.
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_003, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_003, TestSize.Level1)
|
||||
{
|
||||
OHOS::sptr<IAbilityScheduler> scheduler = new AbilityScheduler();
|
||||
|
||||
@ -776,7 +776,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_003, Te
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the function ReleaseDataAbility SendRequest error.
|
||||
*/
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_004, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_ReleaseDataAbility_004, TestSize.Level1)
|
||||
{
|
||||
OHOS::sptr<IAbilityScheduler> scheduler = new AbilityScheduler();
|
||||
AbilityRequest abilityRequest;
|
||||
|
@ -168,7 +168,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot)
|
||||
int GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -327,6 +327,7 @@ public:
|
||||
MOCK_METHOD1(CleanMission, int(int32_t missionId));
|
||||
MOCK_METHOD0(CleanAllMissions, int());
|
||||
MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId));
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
@ -45,20 +45,8 @@ public:
|
||||
MOCK_METHOD2(UnregisterCancelListener, void(const sptr<IWantSender> &sender, const sptr<IWantReceiver> &receiver));
|
||||
MOCK_METHOD2(GetPendingRequestWant, int(const sptr<IWantSender> &target, std::shared_ptr<Want> &want));
|
||||
MOCK_METHOD1(GetSystemMemoryAttr, void(AppExecFwk::SystemMemoryAttr &memoryInfo));
|
||||
MOCK_METHOD2(StartContinuation, int(const Want &want, const sptr<IRemoteObject> &abilityToken));
|
||||
MOCK_METHOD2(NotifyContinuationResult, int(const sptr<IRemoteObject> &abilityToken, const int32_t result));
|
||||
|
||||
MOCK_METHOD1(LockMissionForCleanup, int(int32_t missionId));
|
||||
MOCK_METHOD1(UnlockMissionForCleanup, int(int32_t missionId));
|
||||
MOCK_METHOD1(RegisterMissionListener, int(const sptr<IMissionListener> &listener));
|
||||
MOCK_METHOD1(UnRegisterMissionListener, int(const sptr<IMissionListener> &listener));
|
||||
MOCK_METHOD3(
|
||||
GetMissionInfos, int(const std::string& deviceId, int32_t numMax, std::vector<MissionInfo> &missionInfos));
|
||||
MOCK_METHOD3(GetMissionInfo, int(const std::string& deviceId, int32_t missionId, MissionInfo &missionInfo));
|
||||
MOCK_METHOD1(CleanMission, int(int32_t missionId));
|
||||
MOCK_METHOD0(CleanAllMissions, int());
|
||||
MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId));
|
||||
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
|
||||
int InvokeSendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
{
|
||||
code_ = code;
|
||||
@ -181,7 +169,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GetMissionSnapshot(const int32_t missionId, MissionSnapshotInfo &snapshot)
|
||||
int GetMissionSnapshot(const int32_t missionId, MissionPixelMap &missionPixelMap)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ void AbilityManagerStubTest::WriteInterfaceToken(MessageParcel &data)
|
||||
* EnvConditions: code is START_ABILITY
|
||||
* CaseDescription: Verify that on remote request is normal and abnormal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_001, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_001, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -89,7 +89,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_001, TestSize.Level0)
|
||||
* EnvConditions: code is TERMINATE_ABILITY
|
||||
* CaseDescription: Verify that on remote request is normal and abnormal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_002, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_002, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -114,7 +114,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_002, TestSize.Level0)
|
||||
* EnvConditions: code is CONNECT_ABILITY
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_004, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_004, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -141,7 +141,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_004, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: OnRemoteRequest IAbilityManager::CONNECT_ABILITY
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_005, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_005, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -168,7 +168,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_005, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: OnRemoteRequest IAbilityManager::CONNECT_ABILITY
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_006, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_006, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -193,7 +193,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_006, TestSize.Level0)
|
||||
* EnvConditions: code is DISCONNECT_ABILITY
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_007, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_007, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -215,7 +215,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_007, TestSize.Level0)
|
||||
* EnvConditions: code is ATTACH_ABILITY_THREAD
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_008, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_008, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -239,7 +239,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_008, TestSize.Level0)
|
||||
* EnvConditions: code is ABILITY_TRANSITION_DONE
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_009, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_009, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -265,7 +265,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_009, TestSize.Level0)
|
||||
* EnvConditions: code is CONNECT_ABILITY_DONE
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_010, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_010, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -289,7 +289,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_010, TestSize.Level0)
|
||||
* EnvConditions: code is DISCONNECT_ABILITY_DONE
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_011, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_011, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -311,7 +311,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_011, TestSize.Level0)
|
||||
* EnvConditions: code is ADD_WINDOW_INFO
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_012, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_012, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -334,7 +334,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_012, TestSize.Level0)
|
||||
* EnvConditions: code is DUMP_STATE
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_013, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_013, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -357,7 +357,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_013, TestSize.Level0)
|
||||
* EnvConditions: code is LIST_STACK_INFO
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_014, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_014, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -376,7 +376,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_014, TestSize.Level0)
|
||||
* EnvConditions: code is TERMINATE_ABILITY_RESULT
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_015, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_015, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -395,7 +395,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_015, TestSize.Level0)
|
||||
* EnvConditions: code is default
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_016, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_016, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -414,7 +414,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_016, TestSize.Level0)
|
||||
* EnvConditions: code is GET_RECENT_MISSION
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_017, TestSize.Level0)
|
||||
HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_017, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
@ -97,19 +97,7 @@ public:
|
||||
MOCK_METHOD1(ChangeFocusTest, void(const std::vector<int> missionId));
|
||||
MOCK_METHOD1(TerminateAbilityTest, void(int id));
|
||||
MOCK_METHOD1(MoveMissionToEnd, int(int id));
|
||||
MOCK_METHOD2(StartContinuation, int(const Want &want, const sptr<IRemoteObject> &abilityToken));
|
||||
MOCK_METHOD2(NotifyContinuationResult, int(const sptr<IRemoteObject> &abilityToken, const int32_t result));
|
||||
|
||||
MOCK_METHOD1(LockMissionForCleanup, int(int32_t missionId));
|
||||
MOCK_METHOD1(UnlockMissionForCleanup, int(int32_t missionId));
|
||||
MOCK_METHOD1(RegisterMissionListener, int(const sptr<IMissionListener> &listener));
|
||||
MOCK_METHOD1(UnRegisterMissionListener, int(const sptr<IMissionListener> &listener));
|
||||
MOCK_METHOD3(
|
||||
GetMissionInfos, int(const std::string& deviceId, int32_t numMax, std::vector<MissionInfo> &missionInfos));
|
||||
MOCK_METHOD3(GetMissionInfo, int(const std::string& deviceId, int32_t missionId, MissionInfo &missionInfo));
|
||||
MOCK_METHOD1(CleanMission, int(int32_t missionId));
|
||||
MOCK_METHOD0(CleanAllMissions, int());
|
||||
MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId));
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
@ -287,7 +287,7 @@ HWTEST_F(AbilityRecordTest, AaFwk_AbilityMS_IsLauncherAbility, TestSize.Level1)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: AddConnectRecordToList UT.
|
||||
*/
|
||||
HWTEST_F(AbilityRecordTest, AaFwk_AbilityMS_AddConnectRecordToList, TestSize.Level0)
|
||||
HWTEST_F(AbilityRecordTest, AaFwk_AbilityMS_AddConnectRecordToList, TestSize.Level1)
|
||||
{
|
||||
// test1 for input param is null
|
||||
abilityRecord_->AddConnectRecordToList(nullptr);
|
||||
|
@ -58,7 +58,7 @@ void AbilitySchedulerProxyTest::SetUp(void)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: verify AbilitySchedulerProxy is create success
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_001, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_001, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(abilitySchedulerProxy_, nullptr);
|
||||
}
|
||||
@ -71,7 +71,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_001, TestS
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: verify AbilitySchedulerRecipient is create success
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_002, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_002, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(abilitySchedulerRecipient_, nullptr);
|
||||
}
|
||||
@ -84,7 +84,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_002, TestS
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: verify ScheduleAbilityTransaction Normal case
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_003, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_003, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -105,7 +105,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_003, TestS
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: verify ScheduleAbilityTransaction Return value exception
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_004, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_004, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -126,7 +126,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_004, TestS
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: verify SendResult Normal case
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_005, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_005, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -146,7 +146,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_005, TestS
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: verify SendResult Return value exception
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_006, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_006, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -166,7 +166,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_006, TestS
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: verify ScheduleConnectAbility Normal case
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_007, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_007, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -186,7 +186,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_007, TestS
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: verify ScheduleConnectAbility Return value exception
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_008, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_008, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -206,7 +206,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_008, TestS
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: verify ScheduleDisconnectAbility Normal case
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_009, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_009, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -226,7 +226,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_009, TestS
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: verify ScheduleDisconnectAbility Return value exception
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_010, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_010, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -246,7 +246,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_010, TestS
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: verify ScheduleCommandAbility Normal case
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_011, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_011, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -266,7 +266,7 @@ HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_011, TestS
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: verify ScheduleCommandAbility Return value exception
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_012, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerProxyTest, ability_scheduler_proxy_operating_012, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
|
@ -54,7 +54,7 @@ void AbilitySchedulerStubTest::WriteInterfaceToken(MessageParcel &data)
|
||||
* EnvConditions: code is SCHEDULE_ABILITY_TRANSACTION
|
||||
* CaseDescription: Verify the normal process of onremoterequest
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_001, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_001, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -77,7 +77,7 @@ HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_001, TestSize.Level0)
|
||||
* EnvConditions: code is SCHEDULE_ABILITY_TRANSACTION
|
||||
* CaseDescription: Verifying stateinfo is nullptr causes onremoterequest to fail
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_002, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_002, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -99,7 +99,7 @@ HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_002, TestSize.Level0)
|
||||
* EnvConditions: code is SEND_RESULT
|
||||
* CaseDescription: Verify the normal process of onremoterequest
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_003, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_003, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -123,7 +123,7 @@ HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_003, TestSize.Level0)
|
||||
* EnvConditions: code is SEND_RESULT
|
||||
* CaseDescription: Verifying want is nullptr causes onremoterequest to fail
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_004, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_004, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -144,7 +144,7 @@ HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_004, TestSize.Level0)
|
||||
* EnvConditions: code is SCHEDULE_ABILITY_CONNECT
|
||||
* CaseDescription: Verify the normal and failed conditions of onremoterequest
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_005, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_005, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -171,7 +171,7 @@ HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_005, TestSize.Level0)
|
||||
* EnvConditions: code is SCHEDULE_ABILITY_DISCONNECT
|
||||
* CaseDescription: Verify the normal conditions of onremoterequest
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_006, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_006, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -189,7 +189,7 @@ HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_006, TestSize.Level0)
|
||||
* EnvConditions: code is SCHEDULE_SAVE_ABILITY_STATE
|
||||
* CaseDescription: Verify the failed conditions of onremoterequest
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_007, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_007, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -207,7 +207,7 @@ HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_007, TestSize.Level0)
|
||||
* EnvConditions: code is default
|
||||
* CaseDescription: Verify the normal conditions of onremoterequest
|
||||
*/
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_008, TestSize.Level0)
|
||||
HWTEST_F(AbilitySchedulerStubTest, AbilitySchedulerStub_008, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
@ -3180,6 +3180,45 @@ HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_084, TestSize.
|
||||
EXPECT_EQ(AbilityState::TERMINATING, ability->GetAbilityState());
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: AbilityStackManager
|
||||
* Function : GetMissionSnapshot
|
||||
* SubFunction : NA
|
||||
* FunctionPoints : Get Mission Snapshot
|
||||
* EnvConditions: NA
|
||||
* CaseDescription : Get Mission Snapshot
|
||||
*/
|
||||
HWTEST_F(AbilityStackManagerTest, ability_stack_manager_getMissionSnapshot_001, TestSize.Level1)
|
||||
{
|
||||
stackManager_->Init();
|
||||
EXPECT_TRUE(stackManager_);
|
||||
int32_t missionId = -1;
|
||||
MissionPixelMap missionPixelMap;
|
||||
auto ret = stackManager_->GetMissionSnapshot(missionId, missionPixelMap);
|
||||
|
||||
EXPECT_TRUE(REMOVE_MISSION_ID_NOT_EXIST == ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: AbilityStackManager
|
||||
* Function : GetMissionSnapshot
|
||||
* SubFunction : NA
|
||||
* FunctionPoints : Get Mission Snapshot
|
||||
* EnvConditions: NA
|
||||
* CaseDescription : Get Mission Snapshot
|
||||
*/
|
||||
HWTEST_F(AbilityStackManagerTest, ability_stack_manager_getMissionSnapshot_002, TestSize.Level1)
|
||||
{
|
||||
stackManager_->Init();
|
||||
EXPECT_TRUE(stackManager_);
|
||||
int32_t missionId = 0;
|
||||
MissionPixelMap missionPixelMap;
|
||||
stackManager_->missionStackList_.clear();
|
||||
auto ret = stackManager_->GetMissionSnapshot(missionId, missionPixelMap);
|
||||
|
||||
EXPECT_TRUE(REMOVE_MISSION_ID_NOT_EXIST == ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: AbilityStackManager
|
||||
* Function: GenerateMissinOptionsOfSplitScreen
|
||||
@ -3201,7 +3240,7 @@ HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_087, TestSize.
|
||||
auto ref = stackManager_->GenerateMissinOptionsOfSplitScreen(primary, secondary, options);
|
||||
EXPECT_EQ(ERR_INVALID_DATA, ref);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Feature: AbilityStackManager
|
||||
* Function: GenerateMissinOptionsOfSplitScreen
|
||||
|
@ -50,7 +50,7 @@ void AbilityTokenProxyTest::SetUp(void)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: verify AbilityTokenProxy is create success
|
||||
*/
|
||||
HWTEST_F(AbilityTokenProxyTest, ability_token_proxy_operating_001, TestSize.Level0)
|
||||
HWTEST_F(AbilityTokenProxyTest, ability_token_proxy_operating_001, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(abilityTokenProxy_, nullptr);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ void AbilityTokenStubTest::SetUp(void)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: verify AbilityTokenStub is create success
|
||||
*/
|
||||
HWTEST_F(AbilityTokenStubTest, ability_token_stub_operating_001, TestSize.Level0)
|
||||
HWTEST_F(AbilityTokenStubTest, ability_token_stub_operating_001, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(abilityTokenStub_, nullptr);
|
||||
}
|
||||
@ -64,7 +64,7 @@ HWTEST_F(AbilityTokenStubTest, ability_token_stub_operating_001, TestSize.Level0
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: verify AbilityTokenRecipient is create success
|
||||
*/
|
||||
HWTEST_F(AbilityTokenStubTest, ability_token_stub_operating_002, TestSize.Level0)
|
||||
HWTEST_F(AbilityTokenStubTest, ability_token_stub_operating_002, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(abilityTokenRecipient_, nullptr);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ AbilityRequest AppSchedulerTest::GenerateAbilityRequest(const std::string &devic
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Appstatecallback is nullptr causes init to fail
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_001, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_001, TestSize.Level1)
|
||||
{
|
||||
std::shared_ptr<AppStateCallbackMock> appStateMock;
|
||||
EXPECT_EQ(false, DelayedSingleton<AppScheduler>::GetInstance()->Init(appStateMock));
|
||||
@ -95,7 +95,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_001, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify init success
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_002, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_002, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(true, DelayedSingleton<AppScheduler>::GetInstance()->Init(appStateMock_));
|
||||
}
|
||||
@ -108,7 +108,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_002, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify the normal process of loadability
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_003, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_003, TestSize.Level1)
|
||||
{
|
||||
std::string deviceName = "device";
|
||||
std::string abilityName = "FirstAbility";
|
||||
@ -139,7 +139,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_003, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify the fail process of loadability
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_004, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_004, TestSize.Level1)
|
||||
{
|
||||
std::string deviceName = "device";
|
||||
std::string abilityName = "FirstAbility";
|
||||
@ -170,7 +170,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_004, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify appmgrclient_ Is nullptr causes init to fail
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_005, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_005, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(false, DelayedSingleton<AppScheduler>::GetInstance()->Init(appStateMock_));
|
||||
}
|
||||
@ -183,7 +183,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_005, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify appmgrclient_ Is nullptr causes TerminateAbility to fail
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_006, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_006, TestSize.Level1)
|
||||
{
|
||||
std::string deviceName = "device";
|
||||
std::string abilityName = "FirstAbility";
|
||||
@ -204,7 +204,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_006, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify appmgrclient_ Is not nullptr causes TerminateAbility to success
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_007, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_007, TestSize.Level1)
|
||||
{
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::make_unique<AppExecFwk::AppMgrClient>();
|
||||
|
||||
@ -227,7 +227,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_007, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify appmgrclient_ Is null causes movetoforground to be invalid
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_008, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_008, TestSize.Level1)
|
||||
{
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = nullptr;
|
||||
|
||||
@ -250,7 +250,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_008, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify the normal process of movetoforground
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_009, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_009, TestSize.Level1)
|
||||
{
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::make_unique<AppExecFwk::AppMgrClient>();
|
||||
|
||||
@ -273,7 +273,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_009, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify appmgrclient_ Is null causes OnAbilityRequestDone to be invalid
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_010, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_010, TestSize.Level1)
|
||||
{
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = nullptr;
|
||||
|
||||
@ -296,7 +296,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_010, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify appmgrclient_ Is not nullptr causes onabilityrequestdone invoke
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_011, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_011, TestSize.Level1)
|
||||
{
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::make_unique<AppExecFwk::AppMgrClient>();
|
||||
std::string deviceName = "device";
|
||||
@ -320,7 +320,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_011, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify ConvertToAppAbilityState result
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_012, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_012, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(AppAbilityState::ABILITY_STATE_FOREGROUND,
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->ConvertToAppAbilityState(
|
||||
@ -343,7 +343,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_012, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify ConvertToAppAbilityState result
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_013, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_013, TestSize.Level1)
|
||||
{
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = nullptr;
|
||||
EXPECT_EQ(false, DelayedSingleton<AppScheduler>::GetInstance()->Init(appStateMock_));
|
||||
@ -357,7 +357,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_013, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify appmgrclient_ Is not nullptr causes AbilityBehaviorAnalysis to success
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_014, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_014, TestSize.Level1)
|
||||
{
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::make_unique<AppExecFwk::AppMgrClient>();
|
||||
|
||||
@ -400,7 +400,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_014, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify appmgrclient_ Is nullptr causes AbilityBehaviorAnalysis to fail
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_015, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_015, TestSize.Level1)
|
||||
{
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = nullptr;
|
||||
|
||||
@ -427,7 +427,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_015, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify appmgrclient_ Is not nullptr causes KillProcessByAbilityToken to success
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_016, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_016, TestSize.Level1)
|
||||
{
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::make_unique<AppExecFwk::AppMgrClient>();
|
||||
|
||||
@ -450,7 +450,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_016, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify appmgrclient_ Is nullptr causes KillProcessByAbilityToken to fail
|
||||
*/
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_017, TestSize.Level0)
|
||||
HWTEST_F(AppSchedulerTest, AppScheduler_oprator_017, TestSize.Level1)
|
||||
{
|
||||
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = nullptr;
|
||||
|
||||
|
@ -66,6 +66,45 @@ HWTEST_F(ConfigurationTest, AddItem_001, TestSize.Level1)
|
||||
EXPECT_EQ(1, config.GetItemSize());
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: Configuration
|
||||
* Function: AddItem
|
||||
* SubFunction: NA
|
||||
* FunctionPoints: NA
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Update Configuration
|
||||
*/
|
||||
HWTEST_F(ConfigurationTest, AddItem_002, TestSize.Level1)
|
||||
{
|
||||
AppExecFwk::Configuration config;
|
||||
std::string val {"中文"};
|
||||
EXPECT_EQ(0, config.GetItemSize());
|
||||
config.AddItem(GlobalConfigurationKey::SYSTEM_LANGUAGE, val);
|
||||
EXPECT_EQ(1, config.GetItemSize());
|
||||
|
||||
// replace
|
||||
config.AddItem(GlobalConfigurationKey::SYSTEM_LANGUAGE, val);
|
||||
EXPECT_EQ(1, config.GetItemSize());
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: Configuration
|
||||
* Function: AddItem
|
||||
* SubFunction: NA
|
||||
* FunctionPoints: NA
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Update Configuration
|
||||
*/
|
||||
HWTEST_F(ConfigurationTest, AddItem_003, TestSize.Level1)
|
||||
{
|
||||
AppExecFwk::Configuration config;
|
||||
std::string val {"中文"};
|
||||
std::string key {"test_key"};
|
||||
EXPECT_EQ(0, config.GetItemSize());
|
||||
auto ref = config.AddItem(key, val);
|
||||
EXPECT_FALSE(ref);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: Configuration
|
||||
* Function: GetItem
|
||||
@ -96,6 +135,50 @@ HWTEST_F(ConfigurationTest, GetItem_001, TestSize.Level1)
|
||||
EXPECT_EQ(item, non);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: Configuration
|
||||
* Function: GetItem
|
||||
* SubFunction: NA
|
||||
* FunctionPoints: NA
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Process Configuration Change
|
||||
*/
|
||||
HWTEST_F(ConfigurationTest, GetItem_002, TestSize.Level1)
|
||||
{
|
||||
AppExecFwk::Configuration config;
|
||||
std::string val {"中文"};
|
||||
config.AddItem(GlobalConfigurationKey::SYSTEM_LANGUAGE, val);
|
||||
|
||||
auto item = config.GetItem(GlobalConfigurationKey::SYSTEM_LANGUAGE);
|
||||
EXPECT_EQ(item, val);
|
||||
|
||||
// replace
|
||||
std::string english {"英文"};
|
||||
config.AddItem(GlobalConfigurationKey::SYSTEM_LANGUAGE, english);
|
||||
item = config.GetItem(GlobalConfigurationKey::SYSTEM_LANGUAGE);
|
||||
EXPECT_EQ(item, english);
|
||||
|
||||
int displayId2 = 1002;
|
||||
std::string non {""};
|
||||
item = config.GetItem(displayId2, GlobalConfigurationKey::SYSTEM_LANGUAGE);
|
||||
EXPECT_EQ(item, non);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: Configuration
|
||||
* Function: GetItem
|
||||
* SubFunction: NA
|
||||
* FunctionPoints: NA
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Process Configuration Change
|
||||
*/
|
||||
HWTEST_F(ConfigurationTest, GetItem_003, TestSize.Level1)
|
||||
{
|
||||
AppExecFwk::Configuration config;
|
||||
std::string non {""};
|
||||
auto item = config.GetItem("test_kay");
|
||||
EXPECT_EQ(item, non);
|
||||
}
|
||||
/*
|
||||
* Feature: Configuration
|
||||
* Function: RemoveItem
|
||||
@ -130,6 +213,38 @@ HWTEST_F(ConfigurationTest, RemoveItem_001, TestSize.Level1)
|
||||
EXPECT_FALSE(canRemove);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: Configuration
|
||||
* Function: RemoveItem
|
||||
* SubFunction: NA
|
||||
* FunctionPoints: NA
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Process Configuration Change
|
||||
*/
|
||||
HWTEST_F(ConfigurationTest, RemoveItem_002, TestSize.Level1)
|
||||
{
|
||||
AppExecFwk::Configuration config;
|
||||
std::string val {"中文"};
|
||||
config.AddItem(GlobalConfigurationKey::SYSTEM_LANGUAGE, val);
|
||||
|
||||
auto item = config.GetItem(GlobalConfigurationKey::SYSTEM_LANGUAGE);
|
||||
EXPECT_EQ(item, val);
|
||||
|
||||
// remove it
|
||||
bool canRemove = config.RemoveItem(GlobalConfigurationKey::SYSTEM_LANGUAGE);
|
||||
EXPECT_TRUE(canRemove);
|
||||
|
||||
std::string non {""};
|
||||
item = config.GetItem(GlobalConfigurationKey::SYSTEM_LANGUAGE);
|
||||
EXPECT_EQ(item, non);
|
||||
|
||||
canRemove = config.RemoveItem(non);
|
||||
EXPECT_FALSE(canRemove);
|
||||
|
||||
canRemove = config.RemoveItem(GlobalConfigurationKey::SYSTEM_LANGUAGE);
|
||||
EXPECT_FALSE(canRemove);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: Configuration
|
||||
* Function: GetItemSize
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "stack_info.h"
|
||||
#include "lifecycle_state_info.h"
|
||||
#include "image_info.h"
|
||||
#include "mission_snapshot_info.h"
|
||||
#include "mission_snapshot.h"
|
||||
#include "mission_description_info.h"
|
||||
#include "ability_mission_info.h"
|
||||
|
||||
@ -38,8 +38,6 @@ public:
|
||||
AbilityRecordInfo abilityRecordInfo_ {};
|
||||
LifeCycleStateInfo lifeCycleStateInfo_ {};
|
||||
ImageInfo imageInfo_ {};
|
||||
ImageHeader imageHeader_ {};
|
||||
MissionSnapshotInfo missionSnapshotInfo_ {};
|
||||
MissionDescriptionInfo missionDescriptionInfo_ {};
|
||||
AbilityMissionInfo recentMissionInfo_ {};
|
||||
};
|
||||
@ -61,7 +59,7 @@ void InfoTest::TearDown()
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: The process of verifying stackenfo parcel
|
||||
*/
|
||||
HWTEST_F(InfoTest, stack_info_oprator_001, TestSize.Level0)
|
||||
HWTEST_F(InfoTest, stack_info_oprator_001, TestSize.Level1)
|
||||
{
|
||||
MissionStackInfo missionInfo;
|
||||
missionInfo.id = 10;
|
||||
@ -88,7 +86,7 @@ HWTEST_F(InfoTest, stack_info_oprator_001, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: The process of verifying MissionStackInfo parcel
|
||||
*/
|
||||
HWTEST_F(InfoTest, stack_info_oprator_002, TestSize.Level0)
|
||||
HWTEST_F(InfoTest, stack_info_oprator_002, TestSize.Level1)
|
||||
{
|
||||
MissionRecordInfo info;
|
||||
info.id = 1;
|
||||
@ -113,7 +111,7 @@ HWTEST_F(InfoTest, stack_info_oprator_002, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: The process of verifying MissionRecordInfo parcel
|
||||
*/
|
||||
HWTEST_F(InfoTest, stack_info_oprator_003, TestSize.Level0)
|
||||
HWTEST_F(InfoTest, stack_info_oprator_003, TestSize.Level1)
|
||||
{
|
||||
AbilityRecordInfo info;
|
||||
info.id = 10;
|
||||
@ -164,7 +162,7 @@ HWTEST_F(InfoTest, stack_info_oprator_003, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: The process of verifying AbilityRecordInfo parcel
|
||||
*/
|
||||
HWTEST_F(InfoTest, stack_info_oprator_004, TestSize.Level0)
|
||||
HWTEST_F(InfoTest, stack_info_oprator_004, TestSize.Level1)
|
||||
{
|
||||
abilityRecordInfo_.id = 10;
|
||||
abilityRecordInfo_.elementName = "test";
|
||||
@ -212,7 +210,7 @@ HWTEST_F(InfoTest, stack_info_oprator_004, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: The process of verifying LifeCycleStateInfo parcel
|
||||
*/
|
||||
HWTEST_F(InfoTest, stack_info_oprator_005, TestSize.Level0)
|
||||
HWTEST_F(InfoTest, stack_info_oprator_005, TestSize.Level1)
|
||||
{
|
||||
lifeCycleStateInfo_.isNewWant = 10;
|
||||
lifeCycleStateInfo_.state = AbilityLifeCycleState::ABILITY_STATE_BACKGROUND;
|
||||
@ -229,30 +227,32 @@ HWTEST_F(InfoTest, stack_info_oprator_005, TestSize.Level0)
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: ImageHeader
|
||||
* Feature: ImageInfo
|
||||
* Function: ReadFromParcel and Marshalling and Unmarshalling
|
||||
* SubFunction: NA
|
||||
* FunctionPoints: ImageHeader ReadFromParcel and Marshalling and Unmarshalling
|
||||
* FunctionPoints: ImageInfo ReadFromParcel and Marshalling and Unmarshalling
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: The process of verifying ImageHeader parcel
|
||||
* CaseDescription: The process of verifying ImageInfo parcel
|
||||
*/
|
||||
HWTEST_F(InfoTest, stack_info_oprator_007, TestSize.Level0)
|
||||
HWTEST_F(InfoTest, stack_info_oprator_007, TestSize.Level1)
|
||||
{
|
||||
imageHeader_.colorMode = 8;
|
||||
imageHeader_.reserved = 24;
|
||||
imageHeader_.width = 10;
|
||||
imageHeader_.height = 10;
|
||||
imageInfo_.width = 8;
|
||||
imageInfo_.height = 24;
|
||||
imageInfo_.format = 10;
|
||||
imageInfo_.size = 10;
|
||||
imageInfo_.shmKey = 30;
|
||||
Parcel parcel;
|
||||
imageHeader_.Marshalling(parcel);
|
||||
ImageHeader *obj = imageHeader_.Unmarshalling(parcel);
|
||||
imageInfo_.Marshalling(parcel);
|
||||
ImageInfo *obj = imageInfo_.Unmarshalling(parcel);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
EXPECT_TRUE(obj);
|
||||
EXPECT_EQ(obj->colorMode, imageHeader_.colorMode);
|
||||
EXPECT_EQ(obj->reserved, imageHeader_.reserved);
|
||||
EXPECT_EQ(obj->width, imageHeader_.width);
|
||||
EXPECT_EQ(obj->height, imageHeader_.height);
|
||||
EXPECT_EQ(obj->width, imageInfo_.width);
|
||||
EXPECT_EQ(obj->height, imageInfo_.height);
|
||||
EXPECT_EQ(obj->format, imageInfo_.format);
|
||||
EXPECT_EQ(obj->size, imageInfo_.size);
|
||||
EXPECT_EQ(obj->shmKey, imageInfo_.shmKey);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -263,7 +263,7 @@ HWTEST_F(InfoTest, stack_info_oprator_007, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: The process of verifying MissionDescriptionInfo parcel
|
||||
*/
|
||||
HWTEST_F(InfoTest, stack_info_oprator_008, TestSize.Level0)
|
||||
HWTEST_F(InfoTest, stack_info_oprator_008, TestSize.Level1)
|
||||
{
|
||||
missionDescriptionInfo_.label = "label";
|
||||
missionDescriptionInfo_.iconPath = "iconpath";
|
||||
@ -286,7 +286,7 @@ HWTEST_F(InfoTest, stack_info_oprator_008, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: The process of verifying AbilityMissionInfo parcel
|
||||
*/
|
||||
HWTEST_F(InfoTest, stack_info_oprator_009, TestSize.Level0)
|
||||
HWTEST_F(InfoTest, stack_info_oprator_009, TestSize.Level1)
|
||||
{
|
||||
recentMissionInfo_.id = 10;
|
||||
recentMissionInfo_.runingState = -1;
|
||||
|
@ -54,7 +54,7 @@ void LifecycleDealTest::SetUp()
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify activate operation and call mock once
|
||||
*/
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_001, TestSize.Level0)
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_001, TestSize.Level1)
|
||||
{
|
||||
LifeCycleStateInfo val;
|
||||
EXPECT_CALL(*abilityScheduler_, ScheduleAbilityTransaction(::testing::_, ::testing::_))
|
||||
@ -86,7 +86,7 @@ HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_001, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify Inactivate operation and call mock once
|
||||
*/
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_002, TestSize.Level0)
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_002, TestSize.Level1)
|
||||
{
|
||||
LifeCycleStateInfo val;
|
||||
EXPECT_CALL(*abilityScheduler_, ScheduleAbilityTransaction(::testing::_, ::testing::_))
|
||||
@ -118,7 +118,7 @@ HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_002, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify MoveToBackground operation and call mock once
|
||||
*/
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_003, TestSize.Level0)
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_003, TestSize.Level1)
|
||||
{
|
||||
LifeCycleStateInfo val;
|
||||
EXPECT_CALL(*abilityScheduler_, ScheduleAbilityTransaction(::testing::_, ::testing::_))
|
||||
@ -150,7 +150,7 @@ HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_003, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify ConnectAbility operation and call mock once
|
||||
*/
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_004, TestSize.Level0)
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_004, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*abilityScheduler_, ScheduleConnectAbility(::testing::_)).Times(1);
|
||||
const Want want;
|
||||
@ -167,7 +167,7 @@ HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_004, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify DisconnectAbility operation and call mock once
|
||||
*/
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_005, TestSize.Level0)
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_005, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*abilityScheduler_, ScheduleDisconnectAbility(::testing::_)).Times(1);
|
||||
|
||||
@ -185,7 +185,7 @@ HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_005, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify Terminate operation and call mock once
|
||||
*/
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_006, TestSize.Level0)
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_006, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*abilityScheduler_, ScheduleAbilityTransaction(::testing::_, ::testing::_)).Times(1);
|
||||
|
||||
@ -210,7 +210,7 @@ HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_006, TestSize.Level0)
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify CommandAbility operation and call mock once
|
||||
*/
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_007, TestSize.Level0)
|
||||
HWTEST_F(LifecycleDealTest, LifecycleDeal_oprator_007, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*abilityScheduler_, ScheduleCommandAbility(::testing::_, ::testing::_, ::testing::_)).Times(1);
|
||||
const Want want;
|
||||
|
@ -109,7 +109,7 @@ std::shared_ptr<MissionRecord> getSecondMissionRecord()
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Results after verifying removeAll
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_01, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_01, TestSize.Level1)
|
||||
{
|
||||
missionStack_->AddMissionRecordToTop(getFirstMissionRecord());
|
||||
missionStack_->RemoveAll();
|
||||
@ -124,7 +124,7 @@ HWTEST_F(MissionStackTest, MS_oprator_01, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the top ability record is the same as the added record
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_002, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_002, TestSize.Level1)
|
||||
{
|
||||
std::shared_ptr<MissionRecord> nullMissionRecord = nullptr;
|
||||
missionStack_->AddMissionRecordToTop(nullMissionRecord);
|
||||
@ -153,7 +153,7 @@ HWTEST_F(MissionStackTest, MS_oprator_002, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the top mission record is not empty
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_003, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_003, TestSize.Level1)
|
||||
{
|
||||
missionStack_->AddMissionRecordToTop(getFirstMissionRecord());
|
||||
missionStack_->AddMissionRecordToTop(getSecondMissionRecord());
|
||||
@ -169,7 +169,7 @@ HWTEST_F(MissionStackTest, MS_oprator_003, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the top mission record is the same as the added record
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_004, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_004, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(missionStack_->GetTopMissionRecord(), nullptr);
|
||||
|
||||
@ -194,7 +194,7 @@ HWTEST_F(MissionStackTest, MS_oprator_004, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the mission stack id is not 0
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_005, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_005, TestSize.Level1)
|
||||
{
|
||||
missionStack_->AddMissionRecordToTop(getFirstMissionRecord());
|
||||
EXPECT_NE(missionStack_->GetMissionStackId(), 0);
|
||||
@ -208,7 +208,7 @@ HWTEST_F(MissionStackTest, MS_oprator_005, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the get target mission record is equal to the one added
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_006, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_006, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(nullptr, missionStack_->GetTargetMissionRecord("FirstApp"));
|
||||
|
||||
@ -234,7 +234,7 @@ HWTEST_F(MissionStackTest, MS_oprator_006, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the value of get mission stack ID and get mission stack user ID
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_007, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_007, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(missionStack_->GetMissionStackId(), 1);
|
||||
EXPECT_EQ(missionStack_->GetMissionStackUserId(), 2);
|
||||
@ -248,7 +248,7 @@ HWTEST_F(MissionStackTest, MS_oprator_007, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the value of get mission record count
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_008, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_008, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(missionStack_->GetMissionRecordCount(), 0);
|
||||
missionStack_->AddMissionRecordToTop(getSecondMissionRecord());
|
||||
@ -263,7 +263,7 @@ HWTEST_F(MissionStackTest, MS_oprator_008, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the get top mission record is equal to the one added
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_009, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_009, TestSize.Level1)
|
||||
{
|
||||
std::string deviceName = "device";
|
||||
std::string abilityName = "FirstAbility";
|
||||
@ -291,7 +291,7 @@ HWTEST_F(MissionStackTest, MS_oprator_009, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify Dump and DumpStackList results
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_010, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_010, TestSize.Level1)
|
||||
{
|
||||
std::vector<std::string> info;
|
||||
std::vector<std::string> listInfo;
|
||||
@ -329,7 +329,7 @@ HWTEST_F(MissionStackTest, MS_oprator_010, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the get mission record by ID value is empty
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_011, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_011, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(missionStack_->GetMissionRecordById(0), nullptr);
|
||||
|
||||
@ -355,7 +355,7 @@ HWTEST_F(MissionStackTest, MS_oprator_011, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify the get mission record by ID value
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_012, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_012, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(missionStack_->GetMissionRecordById(0), nullptr);
|
||||
|
||||
@ -381,7 +381,7 @@ HWTEST_F(MissionStackTest, MS_oprator_012, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the values of get ability record by token are equal
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_013, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_013, TestSize.Level1)
|
||||
{
|
||||
OHOS::sptr<Token> token = nullptr;
|
||||
EXPECT_EQ(missionStack_->GetAbilityRecordByToken(token), nullptr);
|
||||
@ -409,7 +409,7 @@ HWTEST_F(MissionStackTest, MS_oprator_013, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that remove ability record by token is successful
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_014, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_014, TestSize.Level1)
|
||||
{
|
||||
std::string deviceName = "device";
|
||||
std::string abilityName = "FirstAbility";
|
||||
@ -436,7 +436,7 @@ HWTEST_F(MissionStackTest, MS_oprator_014, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that remove mission record is successful
|
||||
*/
|
||||
HWTEST_F(MissionStackTest, MS_oprator_015, TestSize.Level0)
|
||||
HWTEST_F(MissionStackTest, MS_oprator_015, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(missionStack_->RemoveMissionRecord(100), false);
|
||||
|
||||
|
@ -0,0 +1,69 @@
|
||||
# Copyright (c) 2021 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.
|
||||
|
||||
import("//build/test.gni")
|
||||
import("//foundation/aafwk/standard/aafwk.gni")
|
||||
|
||||
module_output_path = "aafwk_standard/abilitymgr"
|
||||
|
||||
ohos_unittest("ability_screenshot_handler_test") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
include_dirs = [
|
||||
"${services_path}/abilitymgr/test/mock/libs/system_ability_mock",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/test/mock/libs/ability_scheduler_mock",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/appmgr/",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"//foundation/aafwk/standard/services/abilitymgr/test/mock/libs/appexecfwk_core/src/appmgr/mock_app_scheduler.cpp",
|
||||
"screenshot_handler_test.cpp",
|
||||
]
|
||||
|
||||
configs = [
|
||||
"${services_path}/abilitymgr:abilityms_config",
|
||||
"${services_path}/abilitymgr/test/mock:aafwk_mock_config",
|
||||
]
|
||||
cflags = []
|
||||
if (target_cpu == "arm") {
|
||||
cflags += [ "-DBINDER_IPC_32BIT" ]
|
||||
}
|
||||
deps = [
|
||||
"${innerkits_path}/want:want",
|
||||
"${services_path}/abilitymgr/test:abilityms_test_source",
|
||||
"${services_path}/abilitymgr/test/mock/libs/aakit:aakit_mock",
|
||||
"${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_appmgr_mock",
|
||||
"${services_path}/abilitymgr/test/mock/libs/appexecfwk_core:appexecfwk_bundlemgr_mock",
|
||||
"//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
|
||||
"//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes",
|
||||
"//foundation/aafwk/standard/interfaces/innerkits/base:base",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/libeventhandler:libeventhandler",
|
||||
"//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
|
||||
"//third_party/googletest:gmock_main",
|
||||
"//third_party/googletest:gtest_main",
|
||||
"//utils/native/base:utils",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
"ipc:ipc_core",
|
||||
]
|
||||
}
|
||||
|
||||
group("unittest") {
|
||||
testonly = true
|
||||
|
||||
deps = [ ":ability_screenshot_handler_test" ]
|
||||
}
|
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "ability_stack_manager.h"
|
||||
#include "screenshot_handler.h"
|
||||
#include "screenshot_response.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
|
||||
#include "app_process_data.h"
|
||||
#include "mock_bundle_manager.h"
|
||||
#include "sa_mgr_client.h"
|
||||
#include "system_ability_definition.h"
|
||||
#include "ability_manager_errors.h"
|
||||
#include "ability_scheduler.h"
|
||||
#include "mock_ability_connect_callback.h"
|
||||
#include "ability_scheduler_mock.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
using namespace OHOS::AppExecFwk;
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
|
||||
class ScreenShotHandlerTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase(void);
|
||||
static void TearDownTestCase(void);
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
|
||||
std::shared_ptr<ScreenshotHandler> screenShotHandler_;
|
||||
std::shared_ptr<ScreenShotResponse> screenShotResponse_;
|
||||
};
|
||||
|
||||
void ScreenShotHandlerTest::SetUpTestCase(void)
|
||||
{}
|
||||
|
||||
void ScreenShotHandlerTest::TearDownTestCase(void)
|
||||
{}
|
||||
|
||||
void ScreenShotHandlerTest::SetUp()
|
||||
{
|
||||
screenShotHandler_ = std::make_shared<ScreenshotHandler>();
|
||||
screenShotResponse_ = std::make_shared<ScreenShotResponse>();
|
||||
}
|
||||
|
||||
void ScreenShotHandlerTest::TearDown()
|
||||
{
|
||||
screenShotHandler_.reset();
|
||||
screenShotResponse_.reset();
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: ScreenShotHandlerTest
|
||||
* Function: OnWindowShot
|
||||
* SubFunction: NA
|
||||
* FunctionPoints: NA
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: get Screen Shot
|
||||
*/
|
||||
HWTEST_F(ScreenShotHandlerTest, ability_screenshot_response_001, TestSize.Level1)
|
||||
{
|
||||
WMImageInfo info;
|
||||
info.width = 1;
|
||||
info.size = 5;
|
||||
info.height = 2;
|
||||
info.format = 3;
|
||||
info.data = nullptr;
|
||||
screenShotResponse_->OnWindowShot(info);
|
||||
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));
|
||||
EXPECT_EQ(infos.format, static_cast<uint32_t>(3));
|
||||
EXPECT_EQ(infos.data, nullptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: ScreenShotHandlerTest
|
||||
* Function: ScreenshotHandler::GetImageInfo
|
||||
* SubFunction: NA
|
||||
* FunctionPoints: NA
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: get Image Info
|
||||
*/
|
||||
HWTEST_F(ScreenShotHandlerTest, ability_screenshot_handler_001, TestSize.Level1)
|
||||
{
|
||||
int missionId = 0;
|
||||
WMImageInfo info;
|
||||
info.width = 1;
|
||||
info.size = 5;
|
||||
info.height = 2;
|
||||
info.format = 3;
|
||||
info.data = nullptr;
|
||||
screenShotHandler_->screenShot_.emplace(missionId, info);
|
||||
EXPECT_EQ(static_cast<uint32_t>(screenShotHandler_->screenShot_.size()), static_cast<uint32_t>(1));
|
||||
auto imageInfo = screenShotHandler_->GetImageInfo(missionId);
|
||||
EXPECT_EQ(static_cast<uint32_t>(screenShotHandler_->screenShot_.size()), static_cast<uint32_t>(1));
|
||||
EXPECT_EQ(imageInfo.width, static_cast<uint32_t>(1));
|
||||
EXPECT_EQ(imageInfo.size, static_cast<uint32_t>(5));
|
||||
EXPECT_EQ(imageInfo.height, static_cast<uint32_t>(2));
|
||||
EXPECT_EQ(imageInfo.format, static_cast<uint32_t>(3));
|
||||
EXPECT_EQ(imageInfo.data, nullptr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: ScreenShotHandlerTest
|
||||
* Function: ScreenshotHandler::RemoveImageInfo
|
||||
* SubFunction: NA
|
||||
* FunctionPoints: NA
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: remove Image Info
|
||||
*/
|
||||
HWTEST_F(ScreenShotHandlerTest, ability_screenshot_handler_002, TestSize.Level1)
|
||||
{
|
||||
int missionId = 0;
|
||||
WMImageInfo info;
|
||||
info.width = 1;
|
||||
info.size = 5;
|
||||
info.height = 2;
|
||||
info.format = 3;
|
||||
info.data = nullptr;
|
||||
screenShotHandler_->screenShot_.emplace(missionId, info);
|
||||
EXPECT_EQ(static_cast<uint32_t>(screenShotHandler_->screenShot_.size()), static_cast<uint32_t>(1));
|
||||
screenShotHandler_->RemoveImageInfo(missionId);
|
||||
EXPECT_EQ(static_cast<uint32_t>(screenShotHandler_->screenShot_.size()), static_cast<uint32_t>(0));
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
@ -56,7 +56,7 @@ void WantReceiverProxyTest::SetUp()
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the return value of Send is normal
|
||||
*/
|
||||
HWTEST_F(WantReceiverProxyTest, WantReceiverProxyTest_001, TestSize.Level0)
|
||||
HWTEST_F(WantReceiverProxyTest, WantReceiverProxyTest_001, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
@ -75,7 +75,7 @@ HWTEST_F(WantReceiverProxyTest, WantReceiverProxyTest_001, TestSize.Level0)
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the return value of PerformReceive is normal
|
||||
*/
|
||||
HWTEST_F(WantReceiverProxyTest, WantReceiverProxyTest_002, TestSize.Level0)
|
||||
HWTEST_F(WantReceiverProxyTest, WantReceiverProxyTest_002, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
|
@ -57,7 +57,7 @@ void WantReceiverStubTest::WriteInterfaceToken(MessageParcel &data)
|
||||
* EnvConditions: The code which not exist
|
||||
* CaseDescription: Verify that on remote request is abnormal
|
||||
*/
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_OnRemoteRequest_001, TestSize.Level0)
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_OnRemoteRequest_001, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -77,7 +77,7 @@ HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_OnRemoteRequest_001, TestSiz
|
||||
* EnvConditions: Description abnormal
|
||||
* CaseDescription: Verify that on remote request is abnormal
|
||||
*/
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_OnRemoteRequest_002, TestSize.Level0)
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_OnRemoteRequest_002, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -96,7 +96,7 @@ HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_OnRemoteRequest_002, TestSiz
|
||||
* EnvConditions: Code is WANT_SENDER_SEND
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_OnRemoteRequest_003, TestSize.Level0)
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_OnRemoteRequest_003, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -119,7 +119,7 @@ HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_OnRemoteRequest_003, TestSiz
|
||||
* EnvConditions: Valid parameter
|
||||
* CaseDescription: Verify the function SendInner request is normal.
|
||||
*/
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_SendInner_001, TestSize.Level0)
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_SendInner_001, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -140,7 +140,7 @@ HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_SendInner_001, TestSize.Leve
|
||||
* EnvConditions: Invalid parameter
|
||||
* CaseDescription: Verify the function PerformReceiveInner request is abnormal.
|
||||
*/
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_PerformReceiveInner_001, TestSize.Level0)
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_PerformReceiveInner_001, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -158,7 +158,7 @@ HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_PerformReceiveInner_001, Tes
|
||||
* EnvConditions: Invalid parameter
|
||||
* CaseDescription: Verify the function PerformReceiveInner request is abnormal.
|
||||
*/
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_PerformReceiveInner_002, TestSize.Level0)
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_PerformReceiveInner_002, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -179,7 +179,7 @@ HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_PerformReceiveInner_002, Tes
|
||||
* EnvConditions: Valid parameter
|
||||
* CaseDescription: Verify the function PerformReceiveInner request is normal.
|
||||
*/
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_PerformReceiveInner_003, TestSize.Level0)
|
||||
HWTEST_F(WantReceiverStubTest, WantReceiverStubTest_PerformReceiveInner_003, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
@ -57,7 +57,7 @@ void WantSenderProxyTest::SetUp()
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Verify that the return value of Send is normal
|
||||
*/
|
||||
HWTEST_F(WantSenderProxyTest, WantSenderProxyTest_001, TestSize.Level0)
|
||||
HWTEST_F(WantSenderProxyTest, WantSenderProxyTest_001, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
|
||||
.Times(1)
|
||||
|
@ -57,7 +57,7 @@ void WantSenderStubTest::WriteInterfaceToken(MessageParcel &data)
|
||||
* EnvConditions: The code which not exist
|
||||
* CaseDescription: Verify that on remote request is abnormal
|
||||
*/
|
||||
HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_001, TestSize.Level0)
|
||||
HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_001, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -77,7 +77,7 @@ HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_001, TestSize.Le
|
||||
* EnvConditions: Description abnormal
|
||||
* CaseDescription: Verify that on remote request is abnormal
|
||||
*/
|
||||
HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_002, TestSize.Level0)
|
||||
HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_002, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -96,7 +96,7 @@ HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_002, TestSize.Le
|
||||
* EnvConditions: Code is WANT_SENDER_SEND
|
||||
* CaseDescription: Verify that on remote request is normal
|
||||
*/
|
||||
HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_003, TestSize.Level0)
|
||||
HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_003, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -119,7 +119,7 @@ HWTEST_F(WantSenderStubTest, WantSenderStubTest_OnRemoteRequest_003, TestSize.Le
|
||||
* EnvConditions: Invalid parameter
|
||||
* CaseDescription: Verify the function SendInner request is abnormal.
|
||||
*/
|
||||
HWTEST_F(WantSenderStubTest, WantSenderStubTest_SendInner_001, TestSize.Level0)
|
||||
HWTEST_F(WantSenderStubTest, WantSenderStubTest_SendInner_001, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -137,7 +137,7 @@ HWTEST_F(WantSenderStubTest, WantSenderStubTest_SendInner_001, TestSize.Level0)
|
||||
* EnvConditions: Valid parameter
|
||||
* CaseDescription: Verify the function SendInner request is normal.
|
||||
*/
|
||||
HWTEST_F(WantSenderStubTest, WantSenderStubTest_SendInner_002, TestSize.Level0)
|
||||
HWTEST_F(WantSenderStubTest, WantSenderStubTest_SendInner_002, TestSize.Level1)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
@ -57,7 +57,7 @@ std::shared_ptr<WindowInfo> WindowInfoTest::get() const
|
||||
* EnvConditions:NA
|
||||
* CaseDescription: Verify member variable values
|
||||
*/
|
||||
HWTEST_F(WindowInfoTest, AAFWK_Window_Info, TestSize.Level0)
|
||||
HWTEST_F(WindowInfoTest, AAFWK_Window_Info, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ((int)get()->windowToken_, 1);
|
||||
EXPECT_FALSE(get()->isVisible_);
|
||||
|
@ -50,8 +50,8 @@ public:
|
||||
MOCK_METHOD2(TerminateAbilityResult, int(const sptr<IRemoteObject> &, int startId));
|
||||
MOCK_METHOD1(StopServiceAbility, int(const Want &));
|
||||
MOCK_METHOD1(GetAllStackInfo, int(StackInfo &stackInfo));
|
||||
MOCK_METHOD3(GetRecentMissions, int(const int32_t, const int32_t, std::vector<AbilityMissionInfo> &));
|
||||
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t, MissionSnapshotInfo &));
|
||||
MOCK_METHOD3(GetRecentMissions, int(const int32_t, const int32_t, std::vector<RecentMissionInfo> &));
|
||||
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t, MissionPixelMap &));
|
||||
MOCK_METHOD1(RemoveMission, int(int));
|
||||
MOCK_METHOD1(RemoveStack, int(int));
|
||||
MOCK_METHOD1(MoveMissionToTop, int(int32_t));
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
MOCK_METHOD1(StopServiceAbility, int(const Want &));
|
||||
MOCK_METHOD1(GetAllStackInfo, int(StackInfo &stackInfo));
|
||||
MOCK_METHOD3(GetRecentMissions, int(const int32_t, const int32_t, std::vector<AbilityMissionInfo> &));
|
||||
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t, MissionSnapshotInfo &));
|
||||
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t, MissionPixelMap &));
|
||||
MOCK_METHOD1(RemoveMission, int(int));
|
||||
MOCK_METHOD1(RemoveStack, int(int));
|
||||
MOCK_METHOD1(MoveMissionToTop, int(int32_t));
|
||||
@ -103,6 +103,8 @@ public:
|
||||
MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId));
|
||||
MOCK_METHOD1(ClearUpApplicationData, int(const std::string &));
|
||||
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
|
||||
void Wait()
|
||||
{
|
||||
sem_.Wait();
|
||||
|
56
services/test/mock/include/mock_window_manager.h
Normal file
56
services/test/mock/include/mock_window_manager.h
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2021 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 FRAMEWORKS_WM_INCLUDE_MOCK_WINDOW_MANAGER_H
|
||||
#define FRAMEWORKS_WM_INCLUDE_MOCK_WINDOW_MANAGER_H
|
||||
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
#include "iwindow_manager_service.h"
|
||||
|
||||
namespace OHOS {
|
||||
class WindowManagerServiceMock : public IWindowManagerService {
|
||||
public:
|
||||
virtual ~WindowManagerServiceMock() = default;
|
||||
|
||||
MOCK_METHOD1(GetDisplays, WMError(std::vector<struct WMDisplayInfo> &displays));
|
||||
MOCK_METHOD1(GetDisplayPower, sptr<PromisePowerStatus>(int32_t did));
|
||||
MOCK_METHOD2(SetDisplayPower, sptr<PromiseWMError>(int32_t did, DispPowerStatus status));
|
||||
MOCK_METHOD1(GetDisplayBacklight, sptr<PromiseBacklight>(int32_t did));
|
||||
MOCK_METHOD2(SetDisplayBacklight, sptr<PromiseWMError>(int32_t did, uint32_t level));
|
||||
MOCK_METHOD1(GetDisplayModes, WMError(uint32_t &displayModes));
|
||||
MOCK_METHOD1(SetDisplayMode, sptr<PromiseWMError>(WMSDisplayMode modes));
|
||||
MOCK_METHOD1(AddDisplayChangeListener, WMError(IWindowManagerDisplayListenerClazz *listener));
|
||||
MOCK_METHOD1(OnWindowListChange, sptr<PromiseWMError>(IWindowChangeListenerClazz *listener));
|
||||
MOCK_METHOD1(SetDisplayDirection, WMError(WMSDisplayDirection direction));
|
||||
MOCK_METHOD1(OnDisplayDirectionChange, WMError(DisplayDirectionChangeFunc func));
|
||||
MOCK_METHOD1(SetStatusBarVisibility, sptr<PromiseWMError>(bool visibility));
|
||||
MOCK_METHOD1(SetNavigationBarVisibility, sptr<PromiseWMError>(bool visibility));
|
||||
MOCK_METHOD1(ShotScreen, sptr<PromiseWMSImageInfo>(int32_t did));
|
||||
MOCK_METHOD1(ShotWindow, sptr<PromiseWMSImageInfo>(int32_t wid));
|
||||
MOCK_METHOD1(DestroyWindow, sptr<PromiseWMError>(int32_t wid));
|
||||
MOCK_METHOD1(SwitchTop, sptr<PromiseWMError>(int32_t wid));
|
||||
MOCK_METHOD1(Show, sptr<PromiseWMError>(int32_t wid));
|
||||
MOCK_METHOD1(Hide, sptr<PromiseWMError>(int32_t wid));
|
||||
MOCK_METHOD3(Move, sptr<PromiseWMError>(int32_t wid, int32_t x, int32_t y));
|
||||
MOCK_METHOD3(Resize, sptr<PromiseWMError>(int32_t wid, uint32_t width, uint32_t height));
|
||||
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));
|
||||
};
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // FRAMEWORKS_WM_INCLUDE_MOCK_WINDOW_MANAGER_H
|
@ -45,7 +45,6 @@ ohos_moduletest("ability_mgr_module_test") {
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/connection_record.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/data_ability_manager.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/data_ability_record.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/image_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/kernal_system_app_manager.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/launch_param.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/lifecycle_deal.cpp",
|
||||
@ -54,7 +53,7 @@ ohos_moduletest("ability_mgr_module_test") {
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_option.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_record.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_record_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_snapshot_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_snapshot.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_stack.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_stack_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/pending_want_key.cpp",
|
||||
|
@ -46,7 +46,6 @@ ohos_moduletest("AbilityRecordModuleTest") {
|
||||
"${services_path}/abilitymgr/src/connection_record.cpp",
|
||||
"${services_path}/abilitymgr/src/data_ability_manager.cpp",
|
||||
"${services_path}/abilitymgr/src/data_ability_record.cpp",
|
||||
"${services_path}/abilitymgr/src/image_info.cpp",
|
||||
"${services_path}/abilitymgr/src/kernal_system_app_manager.cpp",
|
||||
"${services_path}/abilitymgr/src/launch_param.cpp",
|
||||
"${services_path}/abilitymgr/src/lifecycle_deal.cpp",
|
||||
@ -54,7 +53,7 @@ ohos_moduletest("AbilityRecordModuleTest") {
|
||||
"${services_path}/abilitymgr/src/mission_description_info.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_record.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_record_info.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_snapshot_info.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_snapshot.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_stack.cpp",
|
||||
"${services_path}/abilitymgr/src/mission_stack_info.cpp",
|
||||
"${services_path}/abilitymgr/src/pending_want_key.cpp",
|
||||
|
@ -44,7 +44,6 @@ ohos_moduletest("ability_stack_module_test") {
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/connection_record.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/data_ability_manager.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/data_ability_record.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/image_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/kernal_system_app_manager.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/launch_param.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/lifecycle_deal.cpp",
|
||||
@ -52,7 +51,7 @@ ohos_moduletest("ability_stack_module_test") {
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_description_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_record.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_record_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_snapshot_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_snapshot.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_stack.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/mission_stack_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/pending_want_key.cpp",
|
||||
@ -60,6 +59,7 @@ ohos_moduletest("ability_stack_module_test") {
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/pending_want_record.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/power_storage.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/sender_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/shared_memory.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/stack_info.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/want_receiver_stub.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/want_sender_info.cpp",
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "mock_app_mgr_client.h"
|
||||
#include "mock_app_scheduler.h"
|
||||
#include "ability_manager_service.h"
|
||||
#include "mock_window_manager.h"
|
||||
#include "screenshot_handler.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
#include <thread>
|
||||
@ -262,6 +264,55 @@ ApplicationInfo AbilityStackModuleTest::CreateAppInfo(const std::string &appName
|
||||
return appInfo;
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: AaFwk
|
||||
* Function:GetMissionSnapshot
|
||||
* SubFunction: Get Mission Snapshot
|
||||
* FunctionPoints:
|
||||
* EnvConditions: NA
|
||||
* CaseDescription: Get Mission Snapshot
|
||||
*/
|
||||
HWTEST_F(AbilityStackModuleTest, ability_stack_test_getMissionSnapshot_001, TestSize.Level1)
|
||||
{
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
stackManager_->Init();
|
||||
|
||||
WindowManagerServiceMock *mockWindowManager = new WindowManagerServiceMock();
|
||||
// set mock
|
||||
stackManager_->screenshotHandler_->windowMS_ = mockWindowManager;
|
||||
sptr<PromiseWMSImageInfo> promise = new PromiseWMSImageInfo();
|
||||
auto infos = [promise](int32_t id) -> sptr<PromiseWMSImageInfo> {
|
||||
return promise;
|
||||
};
|
||||
EXPECT_CALL(*mockWindowManager, ShotWindow)
|
||||
.Times(AtLeast(1))
|
||||
.WillOnce(Invoke(infos));
|
||||
|
||||
auto launcherAbilityRequest_ = GenerateAbilityRequest("device", "LauncherAbility", "launcher", "com.ix.hiworld");
|
||||
auto ref = stackManager_->StartAbility(launcherAbilityRequest_);
|
||||
EXPECT_EQ(ERR_OK, ref);
|
||||
EXPECT_TRUE(stackManager_->missionStackList_.size() != 0);
|
||||
|
||||
int32_t missionId = 0;
|
||||
MissionPixelMap missionPixelMap;
|
||||
std::thread([promise]() {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(2000));
|
||||
WMSImageInfo imageInfo;
|
||||
imageInfo.width = 2;
|
||||
imageInfo.height = 3;
|
||||
imageInfo.format = 10;
|
||||
promise->Resolve(imageInfo);
|
||||
}).detach();
|
||||
auto ret = stackManager_->GetMissionSnapshot(missionId,missionPixelMap);
|
||||
|
||||
EXPECT_TRUE(missionPixelMap.topAbility.abilityName_ == "LauncherAbility");
|
||||
EXPECT_TRUE(missionPixelMap.topAbility.bundleName_ == "com.ix.hiworld");
|
||||
EXPECT_TRUE(missionPixelMap.imageInfo.width == 2);
|
||||
EXPECT_TRUE(missionPixelMap.imageInfo.height== 3);
|
||||
EXPECT_TRUE(missionPixelMap.imageInfo.format == 10);
|
||||
EXPECT_TRUE(ERR_OK == ret);
|
||||
}
|
||||
|
||||
/*
|
||||
* Feature: AaFwk
|
||||
* Function: ability stack management
|
||||
|
@ -480,11 +480,11 @@ HWTEST_F(IpcAbilityMgrModuleTest, AbilityMgrService_IPC_015, TestSize.Level1)
|
||||
sptr<MockAbilityMgrService> mockAbilityMgr(new MockAbilityMgrService());
|
||||
sptr<IAbilityManager> abilityMgrClient = iface_cast<IAbilityManager>(mockAbilityMgr);
|
||||
|
||||
MissionSnapshotInfo snapshot;
|
||||
MissionPixelMap missionPixelMap;
|
||||
EXPECT_CALL(*mockAbilityMgr, GetMissionSnapshot(_, _))
|
||||
.Times(1)
|
||||
.WillOnce(InvokeWithoutArgs(mockAbilityMgr.GetRefPtr(), &MockAbilityMgrService::Post));
|
||||
abilityMgrClient->GetMissionSnapshot(1, snapshot);
|
||||
abilityMgrClient->GetMissionSnapshot(1, missionPixelMap);
|
||||
mockAbilityMgr->Wait();
|
||||
}
|
||||
|
||||
|
@ -22,24 +22,15 @@ ohos_moduletest("PandingWantMgrTest") {
|
||||
|
||||
include_dirs = [
|
||||
"//foundation/aafwk/standard/services/test/mock/include",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
||||
"//foundation/distributedschedule/samgr/adapter/interfaces/innerkits/include/",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_core/include/appmg",
|
||||
"//foundation/appexecfwk/standard/kits/appkit/native/app/include",
|
||||
"//base/notification/ns_standard/interfaces/innerkits/wantagent/include",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
|
||||
"//foundation/distributedschedule/samgr/adapter/interfaces/innerkits/include/",
|
||||
"//third_party/jsoncpp/include",
|
||||
"//base/notification/ans_standard/interfaces/innerkits/wantagent/include",
|
||||
]
|
||||
|
||||
sources = abilityms_files
|
||||
sources += [
|
||||
"//base/notification/ans_standard/frameworks/wantagent/src/completed_dispatcher.cpp",
|
||||
"//base/notification/ans_standard/frameworks/wantagent/src/pending_want.cpp",
|
||||
"//base/notification/ans_standard/frameworks/wantagent/src/trigger_info.cpp",
|
||||
"//base/notification/ans_standard/frameworks/wantagent/src/want_agent.cpp",
|
||||
"//base/notification/ans_standard/frameworks/wantagent/src/want_agent_helper.cpp",
|
||||
"//base/notification/ans_standard/frameworks/wantagent/src/want_agent_info.cpp",
|
||||
"//base/notification/ans_standard/frameworks/wantagent/src/want_agent_log_wrapper.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/src/ability_manager_client.cpp",
|
||||
"//foundation/aafwk/standard/services/abilitymgr/test/mock/libs/sa_mgr/src/sa_mgr_client_mock.cpp",
|
||||
"//foundation/aafwk/standard/services/test/mock/src/mock_app_mgr_client.cpp",
|
||||
@ -59,6 +50,7 @@ ohos_moduletest("PandingWantMgrTest") {
|
||||
"${innerkits_path}/want:want",
|
||||
"//base/global/i18n_standard/frameworks/intl:intl_util",
|
||||
"//base/hiviewdfx/hiview/adapter/utility:hiview_adapter_utility",
|
||||
"//base/notification/ans_standard/frameworks/wantagent:wantagent_innerkits",
|
||||
"//foundation/aafwk/standard/frameworks/kits/ability/native:abilitykit_native",
|
||||
"//foundation/aafwk/standard/frameworks/kits/ability/native:dummy_classes",
|
||||
"//foundation/appexecfwk/standard/interfaces/innerkits/appexecfwk_base:appexecfwk_base",
|
||||
@ -67,6 +59,7 @@ ohos_moduletest("PandingWantMgrTest") {
|
||||
"//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
|
||||
"//foundation/distributedschedule/safwk/interfaces/innerkits/safwk:system_ability_fwk",
|
||||
"//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
|
||||
"//foundation/graphic/standard:libwmservice",
|
||||
"//third_party/googletest:gmock_main",
|
||||
"//third_party/googletest:gtest_main",
|
||||
"//third_party/jsoncpp:jsoncpp",
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include <getopt.h>
|
||||
#include "ability_manager_client.h"
|
||||
#include "mission_snapshot.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "ohos/aafwk/base/bool_wrapper.h"
|
||||
|
||||
@ -933,5 +934,6 @@ ErrCode AbilityManagerShellCommand::MakeWantFromCmd(Want &want, std::string &win
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
MOCK_METHOD1(GetAllStackInfo, int(StackInfo &stackInfo));
|
||||
MOCK_METHOD3(
|
||||
GetRecentMissions, int(const int32_t numMax, const int32_t flags, std::vector<AbilityMissionInfo> &recentList));
|
||||
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t missionId, MissionSnapshotInfo &snapshot));
|
||||
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t missionId, MissionPixelMap &missionPixelMap));
|
||||
MOCK_METHOD1(MoveMissionToTop, int(int32_t missionId));
|
||||
MOCK_METHOD1(RemoveMission, int(int id));
|
||||
MOCK_METHOD1(RemoveStack, int(int id));
|
||||
@ -129,6 +129,7 @@ public:
|
||||
MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId));
|
||||
MOCK_METHOD1(ClearUpApplicationData, int(const std::string &));
|
||||
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
public:
|
||||
std::string powerState_;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user