mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-25 12:23:20 -04:00
!5596 修复ErmsParam析构崩溃
Merge pull request !5596 from donglin/free_install_0513
This commit is contained in:
@@ -75,7 +75,6 @@ ohos_shared_library("ability_manager") {
|
||||
"${ability_runtime_services_path}/abilitymgr/src/acquire_share_data_callback_proxy.cpp",
|
||||
"${ability_runtime_services_path}/abilitymgr/src/acquire_share_data_callback_stub.cpp",
|
||||
"${ability_runtime_services_path}/abilitymgr/src/caller_info.cpp",
|
||||
"${ability_runtime_services_path}/abilitymgr/src/erms_mgr_param.cpp",
|
||||
"${ability_runtime_services_path}/abilitymgr/src/extension_running_info.cpp",
|
||||
"${ability_runtime_services_path}/abilitymgr/src/image_info.cpp",
|
||||
"${ability_runtime_services_path}/abilitymgr/src/launch_param.cpp",
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "parcel.h"
|
||||
#include "want.h"
|
||||
|
||||
namespace OHOS {
|
||||
@@ -27,29 +26,17 @@ namespace AppExecFwk {
|
||||
namespace ErmsParams {
|
||||
using Want = OHOS::AAFwk::Want;
|
||||
|
||||
struct ExperienceRule : public Parcelable {
|
||||
struct ExperienceRule {
|
||||
bool isAllow = false;
|
||||
std::shared_ptr<Want> replaceWant = nullptr;
|
||||
int64_t sceneCode = 0L;
|
||||
int64_t allowTypes;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
|
||||
static ExperienceRule *Unmarshalling(Parcel &parcel);
|
||||
};
|
||||
|
||||
struct CallerInfo : public Parcelable {
|
||||
struct CallerInfo {
|
||||
std::string packageName;
|
||||
int64_t uid = 0L;
|
||||
int64_t pid = 0L;
|
||||
|
||||
bool ReadFromParcel(Parcel &parcel);
|
||||
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
|
||||
static CallerInfo *Unmarshalling(Parcel &parcel);
|
||||
};
|
||||
} // namespace ErmsParams
|
||||
} // namespace AppExecFwk
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "erms_mgr_param.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "iremote_broker.h"
|
||||
#include "iremote_object.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
using ErmsCallerInfo = OHOS::AppExecFwk::ErmsParams::CallerInfo;
|
||||
using ExperienceRule = OHOS::AppExecFwk::ErmsParams::ExperienceRule;
|
||||
|
||||
bool ExperienceRule::ReadFromParcel(Parcel &parcel)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ExperienceRule *ExperienceRule::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
ExperienceRule *info = new (std::nothrow) ExperienceRule();
|
||||
return info;
|
||||
}
|
||||
|
||||
bool ExperienceRule::Marshalling(Parcel &parcel) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ErmsCallerInfo::ReadFromParcel(Parcel &parcel)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ErmsCallerInfo *ErmsCallerInfo::Unmarshalling(Parcel &parcel)
|
||||
{
|
||||
ErmsCallerInfo *info = new (std::nothrow) CallerInfo();
|
||||
return info;
|
||||
}
|
||||
|
||||
bool ErmsCallerInfo::Marshalling(Parcel &parcel) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
@@ -1362,50 +1362,5 @@ HWTEST_F(AbilityTerminateTest,
|
||||
EXPECT_EQ(0, erms->QueryLastSyncTime());
|
||||
GTEST_LOG_(INFO) << "AppExecFwk_IEcologicalRuleManager_QueryLastSyncTime_0100";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AppExecFwk_ExperienceRule_ReadFromParcel_0100
|
||||
* @tc.name: ReadFromParcel
|
||||
* @tc.desc: test ReadFromParcel function
|
||||
*/
|
||||
HWTEST_F(AbilityTerminateTest,
|
||||
AppExecFwk_ExperienceRule_ReadFromParcel_0100, Function | MediumTest | Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AppExecFwk_ExperienceRule_ReadFromParcel_0100";
|
||||
ErmsParams::ExperienceRule rule;
|
||||
Parcel parcel;
|
||||
EXPECT_EQ(true, rule.ReadFromParcel(parcel));
|
||||
GTEST_LOG_(INFO) << "AppExecFwk_ExperienceRule_ReadFromParcel_0100";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AppExecFwk_ExperienceRule_Marshalling_0100
|
||||
* @tc.name: Marshalling
|
||||
* @tc.desc: test Marshalling function
|
||||
*/
|
||||
HWTEST_F(AbilityTerminateTest,
|
||||
AppExecFwk_ExperienceRule_Marshalling_0100, Function | MediumTest | Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AppExecFwk_ExperienceRule_Marshalling_0100";
|
||||
ErmsParams::ExperienceRule rule;
|
||||
Parcel parcel;
|
||||
EXPECT_EQ(true, rule.Marshalling(parcel));
|
||||
GTEST_LOG_(INFO) << "AppExecFwk_ExperienceRule_Marshalling_0100";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: AppExecFwk_ExperienceRule_Unmarshalling_0100
|
||||
* @tc.name: Unmarshalling
|
||||
* @tc.desc: test Unmarshalling function
|
||||
*/
|
||||
HWTEST_F(AbilityTerminateTest,
|
||||
AppExecFwk_ExperienceRule_Unmarshalling_0100, Function | MediumTest | Level1)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "AppExecFwk_ExperienceRule_Unmarshalling_0100";
|
||||
ErmsParams::ExperienceRule rule;
|
||||
Parcel parcel;
|
||||
EXPECT_NE(nullptr, rule.Unmarshalling(parcel));
|
||||
GTEST_LOG_(INFO) << "AppExecFwk_ExperienceRule_Unmarshalling_0100";
|
||||
}
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
||||
Reference in New Issue
Block a user