1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "res_sched_util.h"
17
18 #include <string>
19
20 #include "ability_info.h"
21 #include "ui_extension_utils.h"
22 #include "hilog_tag_wrapper.h"
23 #include "mock_my_status.h"
24 #ifdef RESOURCE_SCHEDULE_SERVICE_ENABLE
25 #include "res_sched_client.h"
26 #include "res_type.h"
27 #endif
28
29 namespace OHOS {
30 namespace AAFwk {
31 using AssociatedStartType = ResourceSchedule::ResType::AssociatedStartType;
GetInstance()32 ResSchedUtil &ResSchedUtil::GetInstance()
33 {
34 static ResSchedUtil instance;
35 return instance;
36 }
37
convertType(int64_t resSchedType)38 int64_t ResSchedUtil::convertType(int64_t resSchedType)
39 {
40 return -1;
41 }
42
ReportAbilityAssociatedStartInfoToRSS(const AbilityInfo & abilityInfo,int64_t resSchedType,int32_t callerUid,int32_t callerPid)43 void ResSchedUtil::ReportAbilityAssociatedStartInfoToRSS(
44 const AbilityInfo &abilityInfo, int64_t resSchedType, int32_t callerUid, int32_t callerPid)
45 {
46 }
47
ReportPreloadApplicationToRSS(const std::shared_ptr<AbilityInfo> & abilityInfo,int32_t preloadMode)48 void ResSchedUtil::ReportPreloadApplicationToRSS(const std::shared_ptr<AbilityInfo>& abilityInfo, int32_t preloadMode)
49 {
50 }
51
GetThawReasonByAbilityType(const AbilityInfo & abilityInfo)52 std::string ResSchedUtil::GetThawReasonByAbilityType(const AbilityInfo &abilityInfo)
53 {
54 return "";
55 }
56
ReportAbilityIntentExemptionInfoToRSS(int32_t callerUid,int32_t callerPid)57 void ResSchedUtil::ReportAbilityIntentExemptionInfoToRSS(int32_t callerUid, int32_t callerPid)
58 {
59 }
60
ReportEventToRSS(const int32_t uid,const std::string & bundleName,const std::string & reason,const int32_t pid,const int32_t callerPid)61 void ResSchedUtil::ReportEventToRSS(const int32_t uid, const std::string &bundleName, const std::string &reason,
62 const int32_t pid, const int32_t callerPid)
63 {
64 }
65
GetAllFrozenPidsFromRSS(std::unordered_set<int32_t> & frozenPids)66 void ResSchedUtil::GetAllFrozenPidsFromRSS(std::unordered_set<int32_t> &frozenPids)
67 {
68 }
69
CheckShouldForceKillProcess(int32_t pid,const std::string & bundleName)70 bool ResSchedUtil::CheckShouldForceKillProcess(int32_t pid, const std::string& bundleName)
71 {
72 return AAFwk::MyStatus::GetInstance().isShouldKillProcess_;
73 }
74
ReportLoadingEventToRss(LoadingStage stage,int32_t pid,int32_t uid,int64_t timeDuration,int64_t abilityRecordId)75 void ResSchedUtil::ReportLoadingEventToRss(LoadingStage stage, int32_t pid, int32_t uid,
76 int64_t timeDuration, int64_t abilityRecordId)
77 {
78 }
79
GetNWebPreloadSet() const80 std::unordered_set<std::string> ResSchedUtil::GetNWebPreloadSet() const
81 {
82 return std::unordered_set<std::string>();
83 }
84 } // namespace AAFwk
85 } // namespace OHOS
86