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 RESSCHED_PLUGINS_SOCPERF_PLUGIN_INCLUDE_SOCPERF_PLUGIN_H 17 #define RESSCHED_PLUGINS_SOCPERF_PLUGIN_INCLUDE_SOCPERF_PLUGIN_H 18 19 #include <set> 20 #include <unordered_map> 21 #include "plugin.h" 22 #include "single_instance.h" 23 #include "app_mgr_constants.h" 24 #include "socperf_client.h" 25 26 namespace OHOS { 27 namespace ResourceSchedule { 28 class SocPerfPlugin : public Plugin { 29 DECLARE_SINGLE_INSTANCE(SocPerfPlugin) 30 31 public: 32 void Init() override; 33 34 void Disable() override; 35 36 void DispatchResource(const std::shared_ptr<ResData>& resData) override; 37 38 private: 39 std::set<uint32_t> resTypes; 40 std::unordered_map<uint32_t, std::function<void(const std::shared_ptr<ResData>& data)>> functionMap; 41 void HandleWindowFocus(const std::shared_ptr<ResData>& data); 42 void HandleEventClick(const std::shared_ptr<ResData>& data); 43 void HandlePushPage(const std::shared_ptr<ResData>& data); 44 void HandlePopPage(const std::shared_ptr<ResData>& data); 45 void HandleEventSlide(const std::shared_ptr<ResData>& data); 46 void HandleEventWebGesture(const std::shared_ptr<ResData>& data); 47 void HandleAppAbilityStart(const std::shared_ptr<ResData>& data); 48 void HandleResizeWindow(const std::shared_ptr<ResData>& data); 49 void HandleMoveWindow(const std::shared_ptr<ResData>& data); 50 void HandleSlideNormal(const std::shared_ptr<ResData>& data); 51 }; 52 } // namespace ResourceSchedule 53 } // namespace OHOS 54 55 #endif // RESSCHED_PLUGINS_SOCPERF_PLUGIN_INCLUDE_SOCPERF_PLUGIN_H 56