修改app_spawn_client对象创建销毁时的日志级别,修改deeplink_reserve文件名和单例

Signed-off-by: hanchenZz <wanghanchen1@huawei.com>
This commit is contained in:
hanchenZz 2024-05-08 11:35:01 +08:00
parent 098e193264
commit 3f370db341
7 changed files with 22 additions and 20 deletions

View File

@ -98,7 +98,7 @@ abilityms_files = [
"src/mission_list.cpp",
"src/scene_board/status_bar_delegate_manager.cpp",
"src/scene_board/ui_ability_lifecycle_manager.cpp",
"src/deeplink_reserve/deeplink_reserve.cpp",
"src/deeplink_reserve/deeplink_reserve_config.cpp",
#connection observer
"src/connection_observer_controller.cpp",

View File

@ -44,7 +44,7 @@
#include "bundle_constants.h"
#include "bundle_mgr_helper.h"
#include "data_ability_manager.h"
#include "deeplink_reserve/deeplink_reserve.h"
#include "deeplink_reserve/deeplink_reserve_config.h"
#include "event_report.h"
#include "free_install_manager.h"
#include "hilog_wrapper.h"
@ -2232,7 +2232,6 @@ private:
#endif
std::shared_ptr<AbilityInterceptorExecuter> interceptorExecuter_;
std::shared_ptr<AbilityInterceptorExecuter> afterCheckExecuter_;
std::shared_ptr<DeepLinkReserveConfig> deepLinkReserveConfig_;
std::unordered_map<int32_t, int64_t> appRecoveryHistory_; // uid:time
bool isPrepareTerminateEnable_ = false;

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_ABILITY_RUNTIME_DEEPLINK_RESERVE_H
#define OHOS_ABILITY_RUNTIME_DEEPLINK_RESERVE_H
#ifndef OHOS_ABILITY_RUNTIME_DEEPLINK_RESERVE_CONFIG_H
#define OHOS_ABILITY_RUNTIME_DEEPLINK_RESERVE_CONFIG_H
#include <nlohmann/json.hpp>
#include <string>
@ -36,23 +36,31 @@ struct ReserveUri {
std::string utd;
};
class DeepLinkReserveConfig : public DelayedSingleton<DeepLinkReserveConfig> {
class DeepLinkReserveConfig {
public:
DeepLinkReserveConfig() = default;
virtual ~DeepLinkReserveConfig() = default;
static DeepLinkReserveConfig &GetInstance()
{
static DeepLinkReserveConfig instance;
return instance;
}
~DeepLinkReserveConfig() = default;
bool LoadConfiguration();
bool isLinkReserved(const std::string &linkString, std::string &bundleName);
private:
std::string GetConfigPath();
bool ReadFileInfoJson(const std::string &filePath, nlohmann::json &jsonBuf);
bool LoadReservedUriList(const nlohmann::json &object);
bool isUriMatched(const ReserveUri &reservedUri, const std::string &link);
void LoadReservedUrilItem(const nlohmann::json &jsonUriObject, std::vector<ReserveUri> &uriList);
DeepLinkReserveConfig() = default;
DISALLOW_COPY_AND_MOVE(DeepLinkReserveConfig);
private:
std::map<std::string, std::vector<ReserveUri>> deepLinkReserveUris_;
};
} // OHOS
} // AAFwk
#endif // OHOS_ABILITY_RUNTIME_DEEPLINK_RESERVE_H
#endif // OHOS_ABILITY_RUNTIME_DEEPLINK_RESERVE_CONFIG_H

View File

@ -425,12 +425,7 @@ bool AbilityManagerService::Init()
void AbilityManagerService::InitDeepLinkReserve()
{
deepLinkReserveConfig_ = DelayedSingleton<DeepLinkReserveConfig>::GetInstance();
if (deepLinkReserveConfig_ == nullptr) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Get DeepLinkReserveConfig instance is nullptr.");
return;
}
if (!deepLinkReserveConfig_->LoadConfiguration()) {
if (!DeepLinkReserveConfig::GetInstance().LoadConfiguration()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "InitDeepLinkReserve failed.");
}
}
@ -885,7 +880,7 @@ void AbilityManagerService::SetReserveInfo(const std::string &linkString)
}
std::string reservedBundleName = "";
if (deepLinkReserveConfig_->isLinkReserved(linkString, reservedBundleName)) {
if (DeepLinkReserveConfig::GetInstance().isLinkReserved(linkString, reservedBundleName)) {
implicitStartProcessor_->SetUriReservedFlag(true);
implicitStartProcessor_->SetUriReservedBundle(reservedBundleName);
} else {

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
#include "deeplink_reserve/deeplink_reserve.h"
#include "deeplink_reserve/deeplink_reserve_config.h"
#include <fstream>
#include <sstream>
#include <unistd.h>

View File

@ -380,7 +380,7 @@ int ImplicitStartProcessor::GenerateAbilityRequestByAction(int32_t userId,
return ERR_IMPLICIT_START_ABILITY_FAIL;
}
if (isOpenLink && !appLinkingOnly) {
if (!appLinkingOnly) {
ProcessLinkType(abilityInfos);
}

View File

@ -40,7 +40,7 @@ namespace {
}
AppSpawnClient::AppSpawnClient(bool isNWebSpawn)
{
TAG_LOGI(AAFwkTag::APPMGR, "AppspawnCreateClient");
TAG_LOGD(AAFwkTag::APPMGR, "AppspawnCreateClient");
if (isNWebSpawn) {
serviceName_ = NWEBSPAWN_SERVER_NAME;
}
@ -76,7 +76,7 @@ ErrCode AppSpawnClient::OpenConnection()
void AppSpawnClient::CloseConnection()
{
TAG_LOGI(AAFwkTag::APPMGR, "AppspawnDestroyClient");
TAG_LOGD(AAFwkTag::APPMGR, "AppspawnDestroyClient");
if (state_ == SpawnConnectionState::STATE_CONNECTED) {
AppSpawnClientDestroy(handle_);
}