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 INPUTMETHOD_IMF_INPUT__CLIENT_INFO_H 17 #define INPUTMETHOD_IMF_INPUT__CLIENT_INFO_H 18 19 #include "i_input_client.h" 20 #include "i_input_data_channel.h" 21 #include "input_attribute.h" 22 #include "input_death_recipient.h" 23 24 namespace OHOS { 25 namespace MiscServices { 26 enum class UpdateFlag : uint32_t { 27 EVENTFLAG = 0, 28 ISSHOWKEYBOARD, 29 BINDIMETYPE, 30 STATE, 31 TEXT_CONFIG, 32 UIEXTENSION_TOKENID, 33 CLIENT_TYPE, 34 }; 35 enum class ImeType : int32_t { 36 IME = 0, 37 PROXY_IME, 38 NONE 39 }; 40 enum class ClientState : uint32_t { 41 INACTIVE = 0, 42 ACTIVE 43 }; 44 45 enum ClientType : uint32_t { 46 CAPI, 47 JS, 48 CJ, 49 INNER_KIT, 50 CLIENT_TYPE_END, 51 }; 52 53 constexpr uint32_t NO_EVENT_ON = 0; 54 constexpr uint32_t IMF_INVALID_TOKENID = 0; 55 struct InputClientInfo { 56 pid_t pid { -1 }; // process id 57 pid_t uid { -1 }; // uid 58 int32_t userID { 0 }; // user id of input client 59 bool isShowKeyboard { false }; // soft keyboard status 60 ImeType bindImeType { ImeType::NONE }; // type of the ime client bind 61 TextTotalConfig config = {}; // text config 62 uint32_t eventFlag { NO_EVENT_ON }; // the flag of the all listen event 63 InputAttribute attribute; // the input client attribute 64 sptr<IInputClient> client { nullptr }; // the remote object handler for service to callback input client 65 sptr<IRemoteObject> channel { nullptr }; // the remote object handler for ime to callback input client 66 sptr<InputDeathRecipient> deathRecipient { nullptr }; // death recipient of client 67 ClientState state { ClientState::INACTIVE }; // the state of input client 68 bool isNotifyInputStart { true }; 69 bool needHide { false }; // panel needs to be hidden first, when input pattern is switched between pwd and normal 70 uint32_t uiExtensionTokenId { IMF_INVALID_TOKENID }; // the value is valid only in curClient and only UIExtension 71 RequestKeyboardReason requestKeyboardReason { RequestKeyboardReason::NONE }; // show keyboard reason 72 ClientType type{ INNER_KIT }; // for hiSysEvent 73 std::string name; // for hiSysEvent, client name:SA/processName app/bundleName 74 }; 75 76 struct HiSysEventClientInfo { 77 int64_t pid{ -1 }; 78 ClientType type{ INNER_KIT }; 79 std::string name; 80 }; 81 } // namespace MiscServices 82 } // namespace OHOS 83 84 #endif // INPUTMETHOD_IMF_INPUT_CLIENT_INFO_H 85