1 /*
2 * Copyright (c) 2022 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 "sched_controller.h"
17
18 #include "if_system_ability_manager.h"
19 #include "iservice_registry.h"
20 #include "system_ability_definition.h"
21 #include "app_mgr_interface.h"
22 #include "bundle_mgr_interface.h"
23 #include "cgroup_adjuster.h"
24 #include "cgroup_event_handler.h"
25 #include "cgroup_sched_log.h"
26 #include "hisysevent.h"
27 #include "plugin_mgr.h"
28 #include "ressched_utils.h"
29 #include "res_type.h"
30 #include "supervisor.h"
31 #ifdef POWER_MANAGER_ENABLE
32 #include "power_mgr_client.h"
33 #endif
34
35 #undef LOG_TAG
36 #define LOG_TAG "SchedController"
37
38 namespace OHOS {
39 namespace ResourceSchedule {
40 namespace {
41 const std::string CG_HANDLER_QUEUE = "CgroupEventHandlerQueue";
42 const std::string LIB_NAME = "libcgroup_sched.z.so";
43 constexpr int32_t DUMP_OPTION = 0;
44 }
45
IMPLEMENT_SINGLE_INSTANCE(SchedController)46 IMPLEMENT_SINGLE_INSTANCE(SchedController)
47
48 void SchedController::Init()
49 {
50 ChronoScope cs("Init SchedController.");
51 // Init supervisor which contains cached data for ccgroup controller.
52 InitSupervisor();
53 // init dispatch resource function map
54 InitDispatchResFuncMap();
55 // Init cgroup handler thread
56 InitCgroupHandler();
57 // Init cgroup adjuster thread
58 InitCgroupAdjuster();
59 // Subscribe ResTypes
60 InitResTypes();
61 for (auto resType: resTypes) {
62 PluginMgr::GetInstance().SubscribeResource(LIB_NAME, resType);
63 }
64 ResSchedUtils::GetInstance().SubscribeResourceExt();
65 }
66
Disable()67 void SchedController::Disable()
68 {
69 if (cgHandler_) {
70 cgHandler_->PostTaskAndWait([]() {});
71 cgHandler_ = nullptr;
72 }
73 if (supervisor_) {
74 supervisor_ = nullptr;
75 }
76 }
77
GetProcessGroup(pid_t pid)78 int SchedController::GetProcessGroup(pid_t pid)
79 {
80 if (!supervisor_) {
81 CGS_LOGE("%{public}s, supervisor nullptr.", __func__);
82 return (int32_t)(SP_DEFAULT);
83 }
84 std::shared_ptr<ProcessRecord> pr = supervisor_->FindProcessRecord(pid);
85 return pr ? (int32_t)(pr->curSchedGroup_) : (int32_t)(SP_DEFAULT);
86 }
87
InitResTypes()88 void SchedController::InitResTypes()
89 {
90 resTypes = {
91 ResType::RES_TYPE_REPORT_MMI_PROCESS,
92 ResType::RES_TYPE_REPORT_RENDER_THREAD,
93 ResType::RES_TYPE_REPORT_KEY_THREAD,
94 ResType::RES_TYPE_REPORT_WINDOW_STATE,
95 ResType::RES_TYPE_WEBVIEW_AUDIO_STATUS_CHANGE,
96 ResType::RES_TYPE_INNER_AUDIO_STATE,
97 ResType::RES_TYPE_RUNNINGLOCK_STATE,
98 ResType::RES_TYPE_REPORT_SCENE_BOARD,
99 ResType::RES_TYPE_WEBVIEW_SCREEN_CAPTURE,
100 ResType::RES_TYPE_WEBVIEW_VIDEO_STATUS_CHANGE,
101 ResType::RES_TYPE_SYSTEM_ABILITY_STATUS_CHANGE,
102 ResType::RES_TYPE_MMI_STATUS_CHANGE,
103 ResType::RES_TYPE_REPORT_CAMERA_STATE,
104 ResType::RES_TYPE_BLUETOOTH_A2DP_CONNECT_STATE_CHANGE,
105 ResType::RES_TYPE_WIFI_CONNECT_STATE_CHANGE,
106 ResType::RES_TYPE_MMI_INPUT_STATE,
107 ResType::RES_TYPE_REPORT_SCREEN_CAPTURE,
108 ResType::RES_TYPE_AV_CODEC_STATE,
109 ResType::RES_TYPE_SA_CONTROL_APP_EVENT,
110 ResType::RES_TYPE_FORM_STATE_CHANGE_EVENT,
111 ResType::RES_TYPE_CONTINUOUS_STARTUP,
112 ResType::RES_TYPE_SCREEN_LOCK,
113 ResType::RES_TYPE_BOOT_COMPLETED,
114 ResType::RES_TYPE_SYSTEM_CPU_LOAD,
115 ResType::RES_TYPE_THERMAL_STATE,
116 ResType::RES_TYPE_COSMIC_CUBE_STATE_CHANGE,
117 ResType::RES_TYPE_APP_STOPPED,
118 ResType::RES_TYPE_ABILITY_STATE_CHANGE,
119 ResType::RES_TYPE_EXTENSION_STATE_CHANGE,
120 ResType::RES_TYPE_PROCESS_STATE_CHANGE,
121 ResType::RES_TYPE_APP_STATE_CHANGE,
122 ResType::RES_TYPE_WINDOW_FOCUS,
123 ResType::RES_TYPE_WINDOW_VISIBILITY_CHANGE,
124 ResType::RES_TYPE_WINDOW_DRAWING_CONTENT_CHANGE,
125 ResType::RES_TYPE_TRANSIENT_TASK,
126 ResType::RES_TYPE_CONTINUOUS_TASK,
127 };
128 }
129
DispatchResource(const std::shared_ptr<ResData> & resData)130 void SchedController::DispatchResource(const std::shared_ptr<ResData>& resData)
131 {
132 auto handler = this->cgHandler_;
133 if (!handler) {
134 return;
135 }
136
137 auto iter = dispatchResFuncMap_.find(resData->resType);
138 if (iter == dispatchResFuncMap_.end()) {
139 DispatchOtherResource(resData->resType, resData->value, resData->payload);
140 return;
141 }
142 handler->PostTask([func = iter->second, handler, resData] {
143 func(handler, resData->resType, resData->value, resData->payload);
144 });
145 DispatchOtherResource(resData->resType, resData->value, resData->payload);
146 }
147
DispatchOtherResource(uint32_t resType,int64_t value,const nlohmann::json & payload)148 void SchedController::DispatchOtherResource(uint32_t resType, int64_t value, const nlohmann::json& payload)
149 {
150 auto handler = this->cgHandler_;
151 if (!handler) {
152 return;
153 }
154 handler->PostTask([handler, resType, value, payload] {
155 switch (resType) {
156 case ResType::RES_TYPE_REPORT_CAMERA_STATE:
157 case ResType::RES_TYPE_WIFI_CONNECT_STATE_CHANGE: {
158 handler->HandleReportHisysEvent(resType, value, payload);
159 break;
160 }
161 case ResType::RES_TYPE_MMI_INPUT_STATE: {
162 handler->HandleMmiInputState(resType, value, payload);
163 break;
164 }
165 case ResType::RES_TYPE_BLUETOOTH_A2DP_CONNECT_STATE_CHANGE: {
166 handler->HandleReportBluetoothConnectState(resType, value, payload);
167 break;
168 }
169 case ResType::RES_TYPE_AV_CODEC_STATE: {
170 handler->HandleReportAvCodecEvent(resType, value, payload);
171 break;
172 }
173 default: {
174 break;
175 }
176 }
177 });
178 ResSchedUtils::GetInstance().DispatchResourceExt(resType, value, payload);
179 }
180
GetBundleNameByUid(const int32_t uid)181 std::string SchedController::GetBundleNameByUid(const int32_t uid)
182 {
183 std::string bundleName = "";
184 OHOS::sptr<OHOS::ISystemAbilityManager> systemAbilityManager =
185 OHOS::SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
186 OHOS::sptr<OHOS::IRemoteObject> object =
187 systemAbilityManager->GetSystemAbility(OHOS::BUNDLE_MGR_SERVICE_SYS_ABILITY_ID);
188 sptr<AppExecFwk::IBundleMgr> iBundleMgr = OHOS::iface_cast<OHOS::AppExecFwk::IBundleMgr>(object);
189 if (!iBundleMgr) {
190 CGS_LOGD("%{public}s null bundle manager.", __func__);
191 return bundleName;
192 }
193
194 ErrCode ret = iBundleMgr->GetNameForUid(uid, bundleName);
195 if (ret != ERR_OK) {
196 CGS_LOGD("%{public}s get bundle name failed for %{public}d, err_code:%{public}d.", __func__, uid, ret);
197 }
198 return bundleName;
199 }
200
InitCgroupHandler()201 inline void SchedController::InitCgroupHandler()
202 {
203 cgHandler_ = std::make_shared<CgroupEventHandler>(CG_HANDLER_QUEUE);
204 cgHandler_->SetSupervisor(supervisor_);
205 }
206
InitCgroupAdjuster()207 inline void SchedController::InitCgroupAdjuster()
208 {
209 CgroupAdjuster::GetInstance().InitAdjuster();
210 }
211
InitSupervisor()212 inline void SchedController::InitSupervisor()
213 {
214 supervisor_ = std::make_shared<Supervisor>();
215 }
216
InitDispatchResFuncMap()217 void SchedController::InitDispatchResFuncMap()
218 {
219 dispatchResFuncMap_ = {
220 { ResType::RES_TYPE_REPORT_MMI_PROCESS, [](std::shared_ptr<CgroupEventHandler> handler,
221 uint32_t resType, int64_t value, const nlohmann::json& payload)
222 { handler->HandleReportMMIProcess(resType, value, payload); } },
223 { ResType::RES_TYPE_REPORT_RENDER_THREAD, [](std::shared_ptr<CgroupEventHandler> handler,
224 uint32_t resType, int64_t value, const nlohmann::json& payload)
225 { handler->HandleReportRenderThread(resType, value, payload); } },
226 { ResType::RES_TYPE_REPORT_KEY_THREAD, [](std::shared_ptr<CgroupEventHandler> handler,
227 uint32_t resType, int64_t value, const nlohmann::json& payload)
228 { handler->HandleReportKeyThread(resType, value, payload); } },
229 { ResType::RES_TYPE_REPORT_WINDOW_STATE, [](std::shared_ptr<CgroupEventHandler> handler,
230 uint32_t resType, int64_t value, const nlohmann::json& payload)
231 { handler->HandleReportWindowState(resType, value, payload); } },
232 { ResType::RES_TYPE_WEBVIEW_AUDIO_STATUS_CHANGE, [](std::shared_ptr<CgroupEventHandler> handler,
233 uint32_t resType, int64_t value, const nlohmann::json& payload)
234 { handler->HandleReportWebviewAudioState(resType, value, payload); } },
235 { ResType::RES_TYPE_INNER_AUDIO_STATE, [](std::shared_ptr<CgroupEventHandler> handler,
236 uint32_t resType, int64_t value, const nlohmann::json& payload)
237 { handler->HandleReportAudioState(resType, value, payload); } },
238 { ResType::RES_TYPE_RUNNINGLOCK_STATE, [](std::shared_ptr<CgroupEventHandler> handler,
239 uint32_t resType, int64_t value, const nlohmann::json& payload)
240 { handler->HandleReportRunningLockEvent(resType, value, payload); } },
241 { ResType::RES_TYPE_REPORT_SCENE_BOARD, [](std::shared_ptr<CgroupEventHandler> handler,
242 uint32_t resType, int64_t value, const nlohmann::json& payload)
243 { handler->HandleSceneBoardState(resType, value, payload); } },
244 { ResType::RES_TYPE_WEBVIEW_SCREEN_CAPTURE, [](std::shared_ptr<CgroupEventHandler> handler,
245 uint32_t resType, int64_t value, const nlohmann::json& payload)
246 { handler->HandleWebviewScreenCapture(resType, value, payload); } },
247 { ResType::RES_TYPE_REPORT_SCREEN_CAPTURE, [](std::shared_ptr<CgroupEventHandler> handler,
248 uint32_t resType, int64_t value, const nlohmann::json& payload)
249 { handler->HandleReportScreenCaptureEvent(resType, value, payload); } },
250 { ResType::RES_TYPE_WEBVIEW_VIDEO_STATUS_CHANGE, [](std::shared_ptr<CgroupEventHandler> handler,
251 uint32_t resType, int64_t value, const nlohmann::json& payload)
252 { handler->HandleReportWebviewVideoState(resType, value, payload); } },
253 { ResType::RES_TYPE_SYSTEM_ABILITY_STATUS_CHANGE, [](std::shared_ptr<CgroupEventHandler> handler,
254 uint32_t resType, int64_t value, const nlohmann::json& payload)
255 { handler->ReportAbilityStatus(resType, value, payload); } },
256 { ResType::RES_TYPE_MMI_STATUS_CHANGE, [](std::shared_ptr<CgroupEventHandler> handler,
257 uint32_t resType, int64_t value, const nlohmann::json& payload)
258 { handler->UpdateMmiStatus(resType, value, payload); } },
259 { ResType::RES_TYPE_COSMIC_CUBE_STATE_CHANGE, [](std::shared_ptr<CgroupEventHandler> handler,
260 uint32_t resType, int64_t value, const nlohmann::json& payload)
261 { handler->HandleReportCosmicCubeState(resType, value, payload); } },
262 { ResType::RES_TYPE_APP_STOPPED, [](std::shared_ptr<CgroupEventHandler> handler,
263 uint32_t resType, int64_t value, const nlohmann::json& payload)
264 { handler->HandleOnAppStopped(resType, value, payload); } },
265 };
266 InitAddDispatchResFuncMap();
267 }
268
InitAddDispatchResFuncMap()269 void SchedController::InitAddDispatchResFuncMap()
270 {
271 dispatchResFuncMap_.insert(std::make_pair(ResType::RES_TYPE_ABILITY_STATE_CHANGE,
272 [](std::shared_ptr<CgroupEventHandler> handler, uint32_t resType, int64_t value,
273 const nlohmann::json& payload) { handler->HandleAbilityStateChanged(resType, value, payload); }));
274 dispatchResFuncMap_.insert(std::make_pair(ResType::RES_TYPE_EXTENSION_STATE_CHANGE,
275 [](std::shared_ptr<CgroupEventHandler> handler, uint32_t resType, int64_t value,
276 const nlohmann::json& payload) { handler->HandleExtensionStateChanged(resType, value, payload); }));
277 dispatchResFuncMap_.insert(std::make_pair(ResType::RES_TYPE_PROCESS_STATE_CHANGE,
278 [](std::shared_ptr<CgroupEventHandler> handler, uint32_t resType, int64_t value,
279 const nlohmann::json& payload) { handler->HandleProcessStateChangedEx(resType, value, payload); }));
280 dispatchResFuncMap_.insert(std::make_pair(ResType::RES_TYPE_APP_STATE_CHANGE,
281 [](std::shared_ptr<CgroupEventHandler> handler, uint32_t resType, int64_t value,
282 const nlohmann::json& payload) { handler->HandleApplicationStateChanged(resType, value, payload); }));
283 dispatchResFuncMap_.insert(std::make_pair(ResType::RES_TYPE_WINDOW_FOCUS,
284 [](std::shared_ptr<CgroupEventHandler> handler, uint32_t resType, int64_t value,
285 const nlohmann::json& payload) { handler->HandleFocusStateChange(resType, value, payload); }));
286 dispatchResFuncMap_.insert(std::make_pair(ResType::RES_TYPE_WINDOW_VISIBILITY_CHANGE,
287 [](std::shared_ptr<CgroupEventHandler> handler, uint32_t resType, int64_t value,
288 const nlohmann::json& payload) { handler->HandleWindowVisibilityChanged(resType, value, payload); }));
289 dispatchResFuncMap_.insert(std::make_pair(ResType::RES_TYPE_WINDOW_DRAWING_CONTENT_CHANGE,
290 [](std::shared_ptr<CgroupEventHandler> handler, uint32_t resType, int64_t value,
291 const nlohmann::json& payload) { handler->HandleDrawingContentChangeWindow(resType, value, payload); }));
292 dispatchResFuncMap_.insert(std::make_pair(ResType::RES_TYPE_TRANSIENT_TASK,
293 [](std::shared_ptr<CgroupEventHandler> handler, uint32_t resType, int64_t value,
294 const nlohmann::json& payload) { handler->HandleTransientTaskStatus(resType, value, payload); }));
295 dispatchResFuncMap_.insert(std::make_pair(ResType::RES_TYPE_CONTINUOUS_TASK,
296 [](std::shared_ptr<CgroupEventHandler> handler, uint32_t resType, int64_t value,
297 const nlohmann::json& payload) { handler->HandleContinuousTaskStatus(resType, value, payload); }));
298 }
299
300 #ifdef POWER_MANAGER_ENABLE
GetRunningLockState()301 void SchedController::GetRunningLockState()
302 {
303 if (!supervisor_) {
304 CGS_LOGE("%{public}s, supervisor nullptr.", __func__);
305 return;
306 }
307 std::map<std::string, PowerMgr::RunningLockInfo> runningLockLists;
308 bool ret = PowerMgr::PowerMgrClient::GetInstance().QueryRunningLockLists(runningLockLists);
309 if (!ret) {
310 CGS_LOGE("%{public}s get running lock list failed.", __func__);
311 return;
312 }
313 for (auto it = runningLockLists.begin(); it != runningLockLists.end(); it++) {
314 std::string bundleName = it->first;
315 PowerMgr::RunningLockInfo lockInfo = it->second;
316 std::shared_ptr<Application> app = supervisor_->GetAppRecordNonNull(lockInfo.uid);
317 std::shared_ptr<ProcessRecord> procRecord = app->GetProcessRecordNonNull(lockInfo.pid);
318 uint32_t key = static_cast<uint32_t>(lockInfo.type);
319 procRecord->runningLockState_[key] = true;
320 }
321 }
322 #endif
323
Dump(const std::vector<std::string> & args,std::string & result)324 void SchedController::Dump(const std::vector<std::string>& args, std::string& result)
325 {
326 if (args.size() == 0) {
327 return;
328 }
329 if (args.size() == DUMP_OPTION + 1 && args[DUMP_OPTION] == "-h") {
330 DumpHelp(result);
331 } else if (args.size() == DUMP_OPTION + 1 && args[DUMP_OPTION] == "-getRunningLockInfo") {
332 DumpProcessRunningLock(result);
333 } else if (args.size() == DUMP_OPTION + 1 && args[DUMP_OPTION] == "-getProcessEventInfo") {
334 DumpProcessEventState(result);
335 } else if (args.size() == DUMP_OPTION + 1 && args[DUMP_OPTION] == "-getProcessWindowInfo") {
336 DumpProcessWindowInfo(result);
337 }
338 }
339
DumpHelp(std::string & result)340 void SchedController::DumpHelp(std::string& result)
341 {
342 result.append(" plugin name : libcgroup_sched.z.so \n")
343 .append(" -h: show the cgroup_sched_plugin help. \n")
344 .append(" -getRunningLockInfo: get all runnable process lock info. \n")
345 .append(" -getProcessEventInfo: get all runnable process event info. \n")
346 .append(" -getProcessWindowInfo: get all runnable process window info. \n");
347 }
348
DumpProcessRunningLock(std::string & result)349 void SchedController::DumpProcessRunningLock(std::string& result)
350 {
351 std::map<int32_t, std::shared_ptr<Application>> uidMap = supervisor_->GetUidsMap();
352 for (auto it = uidMap.begin(); it != uidMap.end(); it++) {
353 int32_t uid = it->first;
354 std::shared_ptr<Application> app = it->second;
355 std::map<pid_t, std::shared_ptr<ProcessRecord>> pidMap = app->GetPidsMap();
356 for (auto pidIt = pidMap.begin(); pidIt != pidMap.end(); pidIt++) {
357 int32_t pid = pidIt->first;
358 std::shared_ptr<ProcessRecord> process = pidIt->second;
359 for (auto lockIt = process->runningLockState_.begin();
360 lockIt != process->runningLockState_.end(); lockIt++) {
361 uint32_t lockType = lockIt->first;
362 bool lockState = lockIt->second;
363 result.append("uid: ").append(ToString(uid))
364 .append(", pid: ").append(ToString(pid))
365 .append(", lockType: ").append(ToString(lockType))
366 .append(", lockState: ").append(ToString(lockState));
367 }
368 }
369 }
370 }
371
DumpProcessEventState(std::string & result)372 void SchedController::DumpProcessEventState(std::string& result)
373 {
374 std::map<int32_t, std::shared_ptr<Application>> uidMap = supervisor_->GetUidsMap();
375 for (auto it = uidMap.begin(); it != uidMap.end(); it++) {
376 int32_t uid = it->first;
377 std::shared_ptr<Application> app = it->second;
378 std::map<pid_t, std::shared_ptr<ProcessRecord>> pidMap = app->GetPidsMap();
379 for (auto pidIt = pidMap.begin(); pidIt != pidMap.end(); pidIt++) {
380 int32_t pid = pidIt->first;
381 std::shared_ptr<ProcessRecord> process = pidIt->second;
382 result.append("uid: ").append(ToString(uid))
383 .append(", pid: ").append(ToString(pid))
384 .append(", processState: ").append(ToString(process->processState_))
385 .append(", napState: ").append(ToString(process->isNapState_))
386 .append(", processDrawingState: ").append(ToString(process->processDrawingState_))
387 .append(", mmiState: ").append(ToString(process->mmiStatus_))
388 .append(", cameraState: ").append(ToString(process->cameraState_))
389 .append(", bluetoothState: ").append(ToString(process->bluetoothState_))
390 .append(", wifiState: ").append(ToString(process->wifiState_))
391 .append(", screenCaptureState: ").append(ToString(process->screenCaptureState_))
392 .append(", videoState: ").append(ToString(process->videoState_))
393 .append(", isActive: ").append(ToString(process->isActive_))
394 .append(", linkedWindowId: ").append(ToString(process->linkedWindowId_))
395 .append(", audioPlayingState: ").append(ToString(process->audioPlayingState_));
396 result.append("\n");
397 }
398 }
399 }
400
DumpProcessWindowInfo(std::string & result)401 void SchedController::DumpProcessWindowInfo(std::string& result)
402 {
403 std::map<int32_t, std::shared_ptr<Application>> uidMap = supervisor_->GetUidsMap();
404 for (auto it = uidMap.begin(); it != uidMap.end(); it++) {
405 int32_t uid = it->first;
406 std::shared_ptr<Application> app = it->second;
407 std::map<pid_t, std::shared_ptr<ProcessRecord>> pidMap = app->GetPidsMap();
408 std::string bundleName = app->GetName();
409 for (auto pidIt = pidMap.begin(); pidIt != pidMap.end(); pidIt++) {
410 int32_t pid = pidIt->first;
411 std::shared_ptr<ProcessRecord> process = pidIt->second;
412 if (process->windows_.size() == 0) {
413 continue;
414 }
415 result.append("uid: ").append(ToString(uid))
416 .append(", pid: ").append(ToString(pid))
417 .append(", bundleName: ").append(bundleName)
418 .append(", processDrawingState: ").append(ToString(process->processDrawingState_))
419 .append(", windowInfo: ")
420 .append("\n");
421 for (auto &windows : process->windows_) {
422 result.append(" windowId:").append(ToString(windows->windowId_))
423 .append(" isVisible:").append(ToString(windows->isVisible_))
424 .append(" isFocus:").append(ToString(windows->isFocused_))
425 .append(" topWebviewRenderUid:").append(ToString(windows->topWebviewRenderUid_))
426 .append("\n");
427 }
428 }
429 }
430 }
431
OnPluginInit(std::string & libName)432 extern "C" bool OnPluginInit(std::string& libName)
433 {
434 if (libName != LIB_NAME) {
435 CGS_LOGE("SchedController::OnPluginInit lib name is not match.");
436 return false;
437 }
438 SchedController::GetInstance().Init();
439 return true;
440 }
441
OnPluginDisable()442 extern "C" void OnPluginDisable()
443 {
444 SchedController::GetInstance().Disable();
445 }
446
OnDispatchResource(const std::shared_ptr<ResData> & resData)447 extern "C" void OnDispatchResource(const std::shared_ptr<ResData>& resData)
448 {
449 SchedController::GetInstance().DispatchResource(resData);
450 }
451
GetProcessGroup(const pid_t pid)452 extern "C" int GetProcessGroup(const pid_t pid)
453 {
454 return SchedController::GetInstance().GetProcessGroup(pid);
455 }
456
OnDump(const std::vector<std::string> & args,std::string & result)457 extern "C" void OnDump(const std::vector<std::string>& args, std::string& result)
458 {
459 SchedController::GetInstance().Dump(args, result);
460 }
461
462 } // namespace ResourceSchedule
463 } // namespace OHOS
464