diff --git a/adapter/common/bus_center/wlan/lnn_wifiservice_monitor.cpp b/adapter/common/bus_center/wlan/lnn_wifiservice_monitor.cpp index fe75425dc..e544496bc 100644 --- a/adapter/common/bus_center/wlan/lnn_wifiservice_monitor.cpp +++ b/adapter/common/bus_center/wlan/lnn_wifiservice_monitor.cpp @@ -35,6 +35,7 @@ static const int32_t DELAY_LEN = 1000; static const int32_t RETRY_MAX = 20; static const std::string COMMON_EVENT_WIFI_SEMI_STATE = "usual.event.wifi.SEMI_STATE"; +static const int32_t WIFI_UID = 1010; namespace OHOS { namespace EventFwk { @@ -193,6 +194,7 @@ int32_t SubscribeEvent::SubscribeWifiSemiStateEvent() MatchingSkills matchingSkills; matchingSkills.AddEvent(COMMON_EVENT_WIFI_SEMI_STATE); CommonEventSubscribeInfo subscriberInfo(matchingSkills); + subscriberInfo.SetPublisherUid(WIFI_UID); std::shared_ptr subscriberPtr = std::make_shared(subscriberInfo); if (!CommonEventManager::SubscribeCommonEvent(subscriberPtr)) { return SOFTBUS_ERR; diff --git a/core/adapter/bus_center/src/lnn_settingdata_event_monitor.cpp b/core/adapter/bus_center/src/lnn_settingdata_event_monitor.cpp index 082d78949..2fddb53de 100644 --- a/core/adapter/bus_center/src/lnn_settingdata_event_monitor.cpp +++ b/core/adapter/bus_center/src/lnn_settingdata_event_monitor.cpp @@ -186,12 +186,18 @@ int32_t LnnGetSettingDeviceName(char *deviceName, uint32_t len) return ret; } if (ret == SOFTBUS_OK) { - LNN_LOGI(LNN_STATE, "get user defined deviceName success"); + char *anonyDeviceName = NULL; + Anonymize(deviceName, &anonyDeviceName); + LNN_LOGI(LNN_STATE, "get user defined deviceName=%{public}s", AnonymizeWrapper(anonyDeviceName)); + AnonymizeFree(anonyDeviceName); dataShareHelper->Release(); return SOFTBUS_OK; } ret = OHOS::BusCenter::GetDefaultDeviceName(dataShareHelper, deviceName, len); - LNN_LOGI(LNN_STATE, "get default deviceName, ret=%{public}d", ret); + char *anonyDeviceName = NULL; + Anonymize(deviceName, &anonyDeviceName); + LNN_LOGI(LNN_STATE, "get default deviceName=%{public}s, ret=%{public}d", AnonymizeWrapper(anonyDeviceName), ret); + AnonymizeFree(anonyDeviceName); dataShareHelper->Release(); return ret; } diff --git a/core/bus_center/lnn/lane_hub/heartbeat/src/lnn_heartbeat_ctrl.c b/core/bus_center/lnn/lane_hub/heartbeat/src/lnn_heartbeat_ctrl.c index 3b0e7f0b3..564bf984d 100644 --- a/core/bus_center/lnn/lane_hub/heartbeat/src/lnn_heartbeat_ctrl.c +++ b/core/bus_center/lnn/lane_hub/heartbeat/src/lnn_heartbeat_ctrl.c @@ -793,7 +793,7 @@ static void HbUserSwitchedHandler(const LnnEventBasicInfo *info) SoftBusUserSwitchState userSwitchState = (SoftBusUserSwitchState)event->status; switch (userSwitchState) { case SOFTBUS_USER_SWITCHED: - LNN_LOGI(LNN_HEART_BEAT, "HB SOFTBUS_USER_SWITCHED"); + LNN_LOGI(LNN_HEART_BEAT, "HB handle SOFTBUS_USER_SWITCHED"); LnnUpdateOhosAccount(true); HbConditionChanged(false); if (IsHeartbeatEnable()) { diff --git a/core/bus_center/lnn/net_builder/src/lnn_network_info.c b/core/bus_center/lnn/net_builder/src/lnn_network_info.c index a890ef171..bbddcdb03 100644 --- a/core/bus_center/lnn/net_builder/src/lnn_network_info.c +++ b/core/bus_center/lnn/net_builder/src/lnn_network_info.c @@ -295,27 +295,23 @@ static void LnnSetP2pNetCapability(uint32_t *capability) } } -static void GetApCapability(SoftBusWifiState wifiState, uint32_t *capability, bool *needSync) +static void ProcessApEnabled(uint32_t *capability, bool *needSync) { - switch (wifiState) { - case SOFTBUS_AP_ENABLED: - g_isApEnable = true; - LnnSetNetworkCapability(capability); - if (IsP2pAvailable(true)) { - (void)LnnSetNetCapability(capability, BIT_WIFI_P2P); - } - *needSync = true; - break; - case SOFTBUS_AP_DISABLED: - g_isApEnable = false; - if (IsP2pAvailable(false)) { - (void)LnnSetNetCapability(capability, BIT_WIFI_P2P); - } - *needSync = true; - break; - default: - break; + g_isApEnable = true; + LnnSetNetworkCapability(capability); + if (IsP2pAvailable(true)) { + (void)LnnSetNetCapability(capability, BIT_WIFI_P2P); } + *needSync = true; +} + +static void ProcessApDisabled(uint32_t *capability, bool *needSync) +{ + g_isApEnable = false; + if (IsP2pAvailable(false)) { + (void)LnnSetNetCapability(capability, BIT_WIFI_P2P); + } + *needSync = true; } static void GetNetworkCapability(SoftBusWifiState wifiState, uint32_t *capability, bool *needSync) @@ -350,8 +346,10 @@ static void GetNetworkCapability(SoftBusWifiState wifiState, uint32_t *capabilit *needSync = true; break; case SOFTBUS_AP_ENABLED: + ProcessApEnabled(capability, needSync); + break; case SOFTBUS_AP_DISABLED: - GetApCapability(wifiState, capability, needSync); + ProcessApDisabled(capability, needSync); break; case SOFTBUS_WIFI_SEMI_ACTIVE: g_isWifiEnable = true; diff --git a/core/bus_center/lnn/net_ledger/common/src/lnn_net_ledger.c b/core/bus_center/lnn/net_ledger/common/src/lnn_net_ledger.c index 83d850cc4..eba30475c 100644 --- a/core/bus_center/lnn/net_ledger/common/src/lnn_net_ledger.c +++ b/core/bus_center/lnn/net_ledger/common/src/lnn_net_ledger.c @@ -141,6 +141,7 @@ static void ProcessLocalDeviceInfo(void) info.stateVersion++; LnnSaveLocalDeviceInfo(&info); } + LNN_LOGI(LNN_LEDGER, "load local deviceInfo stateVersion=%{public}d", info.stateVersion); if (LnnSetLocalNumInfo(NUM_KEY_STATE_VERSION, info.stateVersion) != SOFTBUS_OK) { LNN_LOGE(LNN_LEDGER, "set state version fail"); } @@ -151,6 +152,7 @@ static void ProcessLocalDeviceInfo(void) LnnNotifyLocalNetworkIdChanged(); if (info.networkIdTimestamp != 0) { LnnUpdateLocalNetworkIdTime(info.networkIdTimestamp); + LNN_LOGD(LNN_LEDGER, "update networkIdTimestamp=%" PRId64, info.networkIdTimestamp); } }