231ede1b创建于 2025年10月17日历史提交
/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef IMF_HOOK_H
#define IMF_HOOK_H
#include <chrono>
#include <mutex>
#include <string>

#include "hookmgr.h"
#include "visibility.h"
namespace OHOS {
namespace MiscServices {
enum class ImfHookStage : int32_t {
    REPORT_CURRENT_IME_INFO,
};

struct ImeReportedInfo {
    std::string bundleName;
    std::string versionName;
    int32_t securityMode{ 0 };
    bool needSetConfig{ false };
    int64_t timeStampMs{ 0 };
    bool operator==(const ImeReportedInfo &info) const
    {
        return info.bundleName == bundleName && info.versionName == versionName && info.securityMode == securityMode;
    }
    std::string ToString() const
    {
        std::string info;
        info.append("bundleName/versionName/securityMode: " + bundleName + "/" + versionName + "/"
                    + std::to_string(securityMode));
        info.append("  needSetConfig/timeStampMs: " + std::to_string(static_cast<int32_t>(needSetConfig)) + "/"
                    + std::to_string(timeStampMs));
        return info;
    }
};

IMF_API HOOK_MGR *GetImfHookMgr();
} // namespace MiscServices
} // namespace OHOS

#endif // IMF_HOOK_H