1 /* 2 * Copyright (c) 2023 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 IMF_SA_STUB_FUZZ_UTIL_H 17 #define IMF_SA_STUB_FUZZ_UTIL_H 18 19 #define private public 20 #define protected public 21 #include "input_method_system_ability.h" 22 #include "input_method_system_ability_proxy.h" 23 #undef private 24 25 #include <cstddef> 26 #include <cstdint> 27 28 namespace OHOS { 29 namespace MiscServices { 30 const std::u16string SYSTEMABILITY_INTERFACE_TOKEN = u"ohos.miscservices.inputmethod.IInputMethodSystemAbility"; 31 constexpr const int32_t USER_ID = 100; 32 class ImfSaStubFuzzUtil { 33 public: 34 static bool FuzzInputMethodSystemAbility(const uint8_t *rawData, size_t size, InputMethodInterfaceCode code); 35 36 private: 37 static void InitKeyboardDelegate(); 38 static void Initialize(); 39 static void GrantNativePermission(); 40 static bool isInitialize_; 41 static std::mutex initMutex_; 42 }; 43 } // namespace MiscServices 44 } // namespace OHOS 45 #endif // IMF_SA_STUB_FUZZ_UTIL_H