From 8594f3624ee083cac716c8609d5c02d5ac05a011 Mon Sep 17 00:00:00 2001 From: zhangqiang Date: Fri, 14 Apr 2023 19:52:56 +0800 Subject: [PATCH] =?UTF-8?q?IssueNo:=20state=5Fregistry=20inner=20api?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Description: state_registry inner api优化 Sig: SIG_Telephony Feature or Bugfix: Feature Binary Source: No Signed-off-by: zhangqiang Change-Id: I4e3db4286101c6aff9337d782da632d149045354 --- BUILD.gn | 2 +- bundle.json | 10 +-- frameworks/js/napi/BUILD.gn | 2 +- frameworks/native/observer/BUILD.gn | 6 +- .../libtel_state_registry_api.versionscript | 22 ++++++ .../innerkits/observer/telephony_observer.h | 69 +++++++++++++++++++ .../observer/telephony_observer_client.h | 23 +++++++ test/unittest/state_test/BUILD.gn | 2 +- 8 files changed, 123 insertions(+), 13 deletions(-) create mode 100644 interfaces/innerkits/libtel_state_registry_api.versionscript diff --git a/BUILD.gn b/BUILD.gn index 48a36aa..a4f299e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -40,7 +40,7 @@ ohos_shared_library("tel_state_registry") { "core_service:tel_core_service_api", "hiviewdfx_hilog_native:libhilog", "init:libbegetutil", - "ipc:ipc_core", + "ipc:ipc_single", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] diff --git a/bundle.json b/bundle.json index f399b86..ec467b8 100755 --- a/bundle.json +++ b/bundle.json @@ -65,15 +65,7 @@ { "type": "so", "header": { - "header_files": [ - "../../../../state_registry/interfaces/innerkits/observer/telephony_observer_client.h", - "i_telephony_state_notify.h", - "telephony_observer_broker.h", - "cell_information.h", - "network_state.h", - "signal_information.h", - "sim_state_type.h" - ], + "header_files": [], "header_base": "//base/telephony/core_service/interfaces/innerkits/include" }, "name": "//base/telephony/state_registry/frameworks/native/observer:tel_state_registry_api" diff --git a/frameworks/js/napi/BUILD.gn b/frameworks/js/napi/BUILD.gn index 106e49f..765b487 100644 --- a/frameworks/js/napi/BUILD.gn +++ b/frameworks/js/napi/BUILD.gn @@ -36,7 +36,7 @@ ohos_shared_library("observer") { "eventhandler:libeventhandler", "hiviewdfx_hilog_native:libhilog", "init:libbegetutil", - "ipc:ipc_core", + "ipc:ipc_single", "napi:ace_napi", "state_registry:tel_state_registry_api", ] diff --git a/frameworks/native/observer/BUILD.gn b/frameworks/native/observer/BUILD.gn index 005b27f..63c9cb5 100644 --- a/frameworks/native/observer/BUILD.gn +++ b/frameworks/native/observer/BUILD.gn @@ -30,6 +30,10 @@ ohos_shared_library("tel_state_registry_api") { include_dirs = [ "$SUBSYSTEM_DIR/frameworks/native/observer/include" ] + innerapi_tags = [ "platformsdk" ] + + version_script = "$SUBSYSTEM_DIR/interfaces/innerkits/libtel_state_registry_api.versionscript" + public_configs = [ ":state_registry_observer_config" ] external_deps = [ @@ -37,7 +41,7 @@ ohos_shared_library("tel_state_registry_api") { "core_service:libtel_common", "core_service:tel_core_service_api", "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", + "ipc:ipc_single", "samgr:samgr_proxy", ] diff --git a/interfaces/innerkits/libtel_state_registry_api.versionscript b/interfaces/innerkits/libtel_state_registry_api.versionscript new file mode 100644 index 0000000..7ea4064 --- /dev/null +++ b/interfaces/innerkits/libtel_state_registry_api.versionscript @@ -0,0 +1,22 @@ +# Copyright (c) 2023 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. + +1.0 { + global: + extern "C++" { + *OHOS::Telephony::TelephonyObserver*; + *OHOS::Telephony::TelephonyStateManager*; + }; + local: + *; +}; diff --git a/interfaces/innerkits/observer/telephony_observer.h b/interfaces/innerkits/observer/telephony_observer.h index bd919a1..a3e7eb1 100644 --- a/interfaces/innerkits/observer/telephony_observer.h +++ b/interfaces/innerkits/observer/telephony_observer.h @@ -30,21 +30,90 @@ class TelephonyObserver : public IRemoteStub { public: TelephonyObserver() {} ~TelephonyObserver() {} + + /** + * @brief Called when call state is updated. + * + * @param slotId Indicates the slot identification. + * @param callState Indicates the call state. + * @param phoneNumber Indicates the phoneNumber. + */ void OnCallStateUpdated( int32_t slotId, int32_t callState, const std::u16string &phoneNumber) override; + + /** + * @brief Called when signal info is updated. + * + * @param slotId Indicates the slot identification. + * @param vec Indicates the signal information lists. + */ void OnSignalInfoUpdated( int32_t slotId, const std::vector> &vec) override; + + /** + * @brief Called when network state is updated. + * + * @param slotId Indicates the slot identification. + * @param networkState Indicates the NetworkState. + */ void OnNetworkStateUpdated( int32_t slotId, const sptr &networkState) override; + + /** + * @brief Called when cell info is updated. + * + * @param slotId Indicates the slot identification. + * @param vec Indicates the cell information list. + */ void OnCellInfoUpdated( int32_t slotId, const std::vector> &vec) override; + + /** + * @brief Called when sim state is updated. + * + * @param slotId Indicates the slot identification. + * @param type Indicates the type of sim card. + * @param state Indicates the sim state. + * @param reason Indicates the sim lock reason. + */ void OnSimStateUpdated( int32_t slotId, CardType type, SimState state, LockReason reason) override; + + /** + * @brief Called when cellular data connect state is updated. + * + * @param slotId Indicates the slot identification. + * @param dataState Indicates the cellular data state. + * @param networkType Indicates the network type. + */ void OnCellularDataConnectStateUpdated( int32_t slotId, int32_t dataState, int32_t networkType) override; + + /** + * @brief Called when cellular data flow type is updated. + * + * @param slotId Indicates the slot identification. + * @param dataFlowType Indicates the data flow type. + */ void OnCellularDataFlowUpdated( int32_t slotId, int32_t dataFlowType) override; + + /** + * @brief Called when CFU(Call Forwarding Unconditional) indicator updated. + * + * @param slotId Indicates the slot identification. + * @param cfuResult Indicates whether support CFU, true if support, false if + * not. + */ virtual void OnCfuIndicatorUpdated(int32_t slotId, bool cfuResult) override; + + /** + * @brief Called when the voice mailbox state corresponding to the monitored slotId + * is updated. + * + * @param slotId Indicates the slot identification. + * @param voiceMailMsgResult + */ virtual void OnVoiceMailMsgIndicatorUpdated(int32_t slotId, bool voiceMailMsgResult) override; int32_t OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/innerkits/observer/telephony_observer_client.h b/interfaces/innerkits/observer/telephony_observer_client.h index d5ea7e0..0e52ce1 100644 --- a/interfaces/innerkits/observer/telephony_observer_client.h +++ b/interfaces/innerkits/observer/telephony_observer_client.h @@ -28,9 +28,32 @@ class TelephonyObserverClient : public DelayedRefSingleton &telephonyObserver, int32_t slotId, uint32_t mask, bool isUpdate); + + /** + * @brief Remove state observer. + * + * @param slotId Indicates the slot identification. + * @param mask Indicates event type mask. + * @return Return 0 if remove successful, others if remove failed. + */ int32_t RemoveStateObserver(int32_t slotId, uint32_t mask); + + /** + * @brief Get the state registry proxy. + * + * @return Return the ITelephonyStateNotify interface. + */ sptr GetProxy(); private: diff --git a/test/unittest/state_test/BUILD.gn b/test/unittest/state_test/BUILD.gn index 337296f..5bba9db 100644 --- a/test/unittest/state_test/BUILD.gn +++ b/test/unittest/state_test/BUILD.gn @@ -39,7 +39,7 @@ ohos_unittest("tel_state_registry_test") { "core_service:libtel_common", "core_service:tel_core_service_api", "init:libbegetutil", - "ipc:ipc_core", + "ipc:ipc_single", "safwk:system_ability_fwk", "samgr:samgr_proxy", ] -- Gitee