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 #ifndef FRAME_MSG_INTF_H
17 #define FRAME_MSG_INTF_H
18 
19 #include "ffrt.h"
20 #include "rme_constants.h"
21 #include "single_instance.h"
22 #include "event_handler.h"
23 
24 namespace OHOS {
25 namespace RME {
26 class FrameMsgIntf {
27 public:
28     static FrameMsgIntf& GetInstance();
29     bool Init();
30     bool GetThreadQueue();
31     void ReportAppInfo(const int pid, const int uid, const std::string bundleName, ThreadState state);
32     void ReportProcessInfo(const int pid, const int uid, const std::string bundleName, ThreadState state);
33     void ReportCgroupChange(const int pid, const int uid, const int oldGroup, const int newGroup);
34     void ReportWindowFocus(const int pid, const int uid, const int isFocus);
35     void ReportRenderThread(const int pid, const int uid, const int renderTid);
36     void ReportContinuousTask(const int pid, const int uid, const int status);
37     void ReportSlideEvent(const int pid, const int uid, const int64_t status);
38     void ReportInteractionScene(const int64_t status);
39     void Stop();
40 protected:
41     FrameMsgIntf() = default;
42     ~FrameMsgIntf();
43 private:
44     ffrt::mutex frameMsgIntfMutex_;
45     ffrt::queue* taskQueue_ = nullptr;
46 };
47 } // namespace RME
48 } // namespace OHOS
49 #endif
50