diff --git a/bundle.json b/bundle.json index 80310ebc..b73b9aa6 100644 --- a/bundle.json +++ b/bundle.json @@ -26,8 +26,9 @@ "components": [ "cJSON", "c_utils", - "config_policy", "common_event_service", + "config_policy", + "ffrt", "hisysevent", "hilog", "ipc", diff --git a/common/include/constants/distributed_device_profile_constants.h b/common/include/constants/distributed_device_profile_constants.h index 9e9022e9..e7ee9df0 100644 --- a/common/include/constants/distributed_device_profile_constants.h +++ b/common/include/constants/distributed_device_profile_constants.h @@ -132,16 +132,7 @@ constexpr int32_t MAX_INTERFACE_SIZE = 20; constexpr int32_t MAX_SUBSCRIBE_INFO_SIZE = 500; constexpr int32_t MAX_SYNC_RESULTS_SIZE = 50; constexpr int32_t MAX_STATIC_CAPABILITY_SIZE = 100; -<<<<<<< HEAD -const std::string SEPARATOR = "#"; -const std::string DEV_PREFIX = "dev"; -const std::string SVR_PREFIX = "svr"; -const std::string CHAR_PREFIX = "char"; -const std::string USER_ID = "user_id"; -const std::string IS_MULTI_USER = "is_muilt_user"; -const std::string TOKEN_ID = "token_id"; -const std::string ALL_PROC = "all"; -======= +extern const std::string IS_MULTI_USER; extern const std::string SEPARATOR; extern const std::string DEV_PREFIX; extern const std::string SVR_PREFIX; @@ -149,11 +140,12 @@ extern const std::string CHAR_PREFIX; extern const std::string USER_ID; extern const std::string TOKEN_ID; extern const std::string ALL_PROC; ->>>>>>> dc018b8 (update) constexpr int32_t NUM_1 = 1; constexpr int32_t NUM_2 = 2; constexpr int32_t NUM_3 = 3; constexpr int32_t NUM_4 = 4; +constexpr int32_t NUM_5 = 5; +constexpr int32_t NUM_6 = 6; constexpr int32_t DEFAULT_USER_ID = -1; constexpr uint32_t NUM_1U = 1; constexpr uint32_t NUM_8U = 8; diff --git a/common/include/constants/distributed_device_profile_errors.h b/common/include/constants/distributed_device_profile_errors.h index 20015580..64c689a2 100644 --- a/common/include/constants/distributed_device_profile_errors.h +++ b/common/include/constants/distributed_device_profile_errors.h @@ -151,7 +151,14 @@ constexpr int32_t DP_NULLPTR = 98566273; constexpr int32_t DP_SUBSCRIBE_INITED_FALI = 98566274; constexpr int32_t DP_GET_DEVICE_ENTRIES_FAIL = 98566275; constexpr int32_t DP_RDB_DATABASE_RESTORE_FAIL = 98566276; + +// multi-user constexpr int32_t DP_GET_FOREGROUND_ID_FAIL = 98566277; +constexpr int32_t DP_GET_MULTI_USER_PROFILE_PARAMS_INVALID = 98566278; +constexpr int32_t DP_GET_LOCAL_PROFILE_IS_NOT_FOREGROUND_ID = 98566279; +constexpr int32_t DP_GET_USER_ID_IS_NOT_TRUSTED = 98566280; +constexpr int32_t DP_MULTI_USER_MANAGER_INIT_FAIL = 98566281; +constexpr int32_t DP_MULTI_USER_MANAGER_UNINIT_FAIL = 98566282; } // namespace DistributedDeviceProfile } // namespace OHOS #endif // OHOS_DP_DISTRIBUTED_DEVICE_PROFILE_ERRORS_H diff --git a/common/include/interfaces/i_distributed_device_profile.h b/common/include/interfaces/i_distributed_device_profile.h index a762820a..c7604157 100644 --- a/common/include/interfaces/i_distributed_device_profile.h +++ b/common/include/interfaces/i_distributed_device_profile.h @@ -52,16 +52,10 @@ public: virtual int32_t GetServiceProfile(const std::string& deviceId, const std::string& serviceName, ServiceProfile& serviceProfile, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) = 0; virtual int32_t GetCharacteristicProfile(const std::string& deviceId, const std::string& serviceName, -<<<<<<< HEAD - const std::string& characteristicId, CharacteristicProfile& charProfile) = 0; - virtual int32_t DeleteServiceProfile(const std::string& deviceId, const std::string& serviceName, - bool isMuitUser = false, int32_t userId = -1) = 0; -======= const std::string& characteristicId, CharacteristicProfile& charProfile, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) = 0; virtual int32_t DeleteServiceProfile(const std::string& deviceId, const std::string& serviceName, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) = 0; ->>>>>>> 6cd545d (编译通过,修改检视意见) virtual int32_t DeleteCharacteristicProfile(const std::string& deviceId, const std::string& serviceName, const std::string& characteristicId, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) = 0; virtual int32_t SubscribeDeviceProfile(const SubscribeInfo& subscribeInfo) = 0; diff --git a/common/include/utils/profile_utils.h b/common/include/utils/profile_utils.h index 4109ef7b..fb323d60 100644 --- a/common/include/utils/profile_utils.h +++ b/common/include/utils/profile_utils.h @@ -26,6 +26,7 @@ #include "access_control_profile.h" #include "characteristic_profile.h" #include "device_profile.h" +#include "distributed_device_profile_constants.h" #include "service_profile.h" #include "trust_device_profile.h" @@ -37,6 +38,7 @@ class ProfileUtils { public: static std::string GetDbKeyAnonyString(const std::string& value); static std::string GetAnonyString(const std::string& value); + static std::string GetAnonyInt32(const int32_t value); static std::vector GetOnlineDevices(); static std::string GetLocalUdidFromDM(); static bool FilterAndGroupOnlineDevices(const std::vector& deviceList, @@ -82,7 +84,7 @@ public: static int32_t EntriesToServiceProfile(std::map values, ServiceProfile& profile); static int32_t EntriesToCharProfile(std::map values, CharacteristicProfile& profile); static std::string GenerateDBKey(const std::string& profileKey, const std::string& profileProperty, - int32_t userId = -1); + int32_t userId = DEFAULT_USER_ID); static std::string GetProfileKey(const std::string& dbKey); static std::string GetDeviceIdByDBKey(const std::string& dbKey); static std::string GetServiceNameByDBKey(const std::string& dbKey); @@ -94,21 +96,9 @@ public: static std::string GetDbKeyByProfile(const CharacteristicProfile& profile); static int32_t SplitString(const std::string& str, const std::string& splits, std::vector& res); static std::string JoinString(const std::vector& strs, const std::string& delimiter); -<<<<<<< HEAD - static std::string GetProfileProperty(const std::string& dbKey); -<<<<<<< HEAD - static std::map GetProfilePropertiesMap(std::map dbEntries); -======= - static std::map GetProfilePropertiesMap( - const std::map& dbEntries, int32_t userId = DEFAULT_USER_ID); - static void GetProfilePropertiesMap(const std::map& dbEntries, - std::map& propertiesMap); ->>>>>>> fdcd212 (修改检视意见) -======= static std::string GetProfileProperty(const std::string& dbKey, int32_t userId = DEFAULT_USER_ID); static std::map GetProfilePropertiesMap(std::map dbEntries, int32_t userId = DEFAULT_USER_ID); ->>>>>>> 1d65cf1 (fix codecheck) static std::string toString(const std::u16string& str16); static bool IsPropertyValid(const std::map& propertyMap, const std::string& property, int32_t maxValue); @@ -120,24 +110,13 @@ public: static bool GetUdidByNetworkId(const std::string& networkId, std::string& udid); static bool GetUuidByNetworkId(const std::string& networkId, std::string& uuid); static bool IsNumStr(const std::string& inString); -<<<<<<< HEAD -======= static int32_t GetUserIdFromDbKey(const std::string& dbKey); static std::string RemoveUserIdFromDbKey(const std::string& dbKey); static int32_t GenerateServiceDBkeys(const std::string& deviceId, const std::string& serviceName, std::vector& dbKeys, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID); static int32_t GenerateCharacteristicDBkeys(const std::string& deviceId, const std::string& serviceName, -<<<<<<< HEAD - const std::string& characteristicKey, std::vector& dbKeys, bool isMuiltUser = false, -<<<<<<< HEAD - int32_t userId = -1); ->>>>>>> 507ffd4 (KV Delete接口适配多用户) -======= -======= const std::string& characteristicKey, std::vector& dbKeys, bool isMultiUser = false, ->>>>>>> fdcd212 (修改检视意见) int32_t userId = DEFAULT_USER_ID); ->>>>>>> 6cd545d (编译通过,修改检视意见) }; } // namespace DistributedDeviceProfile } // namespace OHOS diff --git a/common/src/interfaces/device_profile.cpp b/common/src/interfaces/device_profile.cpp index 25e53e7c..dbd7ed0a 100644 --- a/common/src/interfaces/device_profile.cpp +++ b/common/src/interfaces/device_profile.cpp @@ -224,17 +224,9 @@ std::string DeviceProfile::dump() const cJSON_AddNumberToObject(json, OS_API_LEVEL.c_str(), osApiLevel_); cJSON_AddStringToObject(json, OS_VERSION.c_str(), osVersion_.c_str()); cJSON_AddNumberToObject(json, OS_TYPE.c_str(), osType_); -<<<<<<< HEAD - cJSON_AddBoolToObject(json, IS_MULTI_USER.c_str(), isMuitUser_); -<<<<<<< HEAD - cJSON_AddNumberToObject(json, USER_ID.c_str(), userId_); -======= -======= cJSON_AddBoolToObject(json, IS_MULTI_USER.c_str(), isMultiUser_); ->>>>>>> 6cd545d (编译通过,修改检视意见) cJSON_AddStringToObject(json, USER_ID.c_str(), ProfileUtils::GetAnonyString(std::to_string(userId_)).c_str()); ->>>>>>> 776ed34 (虚函数添加默认参数,userId匿名dump) char* jsonChars = cJSON_PrintUnformatted(json); if (jsonChars == NULL) { cJSON_Delete(json); diff --git a/common/src/interfaces/dp_subscribe_info.cpp b/common/src/interfaces/dp_subscribe_info.cpp index f4884eec..19ba7b96 100644 --- a/common/src/interfaces/dp_subscribe_info.cpp +++ b/common/src/interfaces/dp_subscribe_info.cpp @@ -28,12 +28,12 @@ namespace { } SubscribeInfo::SubscribeInfo(int32_t saId, const std::string& subscribeKey, std::unordered_set subscribeChangeTypes, sptr profileChangeListener, - int32_t userId = DEFAULT_USER_ID) + int32_t userId) { this->saId_ = saId; this->subscribeKey_ = subscribeKey; if (userId != DEFAULT_USER_ID) { - this->subscribeKey_ = this->subscribeKey_ + SEPARATOR + userId; + this->subscribeKey_ = this->subscribeKey_ + SEPARATOR + std::to_string(userId); } this->subscribeChangeTypes_ = subscribeChangeTypes; if (profileChangeListener == nullptr) { @@ -66,29 +66,29 @@ void SubscribeInfo::SetSaId(int32_t saId) } void SubscribeInfo::SetSubscribeKey(const std::string& deviceId, const std::string& deviceAttribute, - int32_t userId = DEFAULT_USER_ID) + int32_t userId) { subscribeKey_ = DEV_PREFIX + SEPARATOR + deviceId + SEPARATOR + deviceAttribute; if (userId != DEFAULT_USER_ID) { - subscribeKey_ = subscribeKey_ + SEPARATOR + userId; + subscribeKey_ = subscribeKey_ + SEPARATOR + std::to_string(userId); } } void SubscribeInfo::SetSubscribeKey(const std::string& deviceId, const std::string& serviceName, - const std::string& serviceAttribute, int32_t userId = DEFAULT_USER_ID) + const std::string& serviceAttribute, int32_t userId) { subscribeKey_ = SVR_PREFIX + SEPARATOR + deviceId + SEPARATOR + serviceName + SEPARATOR + serviceAttribute; if (userId != DEFAULT_USER_ID) { - subscribeKey_ = subscribeKey_ + SEPARATOR + userId; + subscribeKey_ = subscribeKey_ + SEPARATOR + std::to_string(userId); } } void SubscribeInfo::SetSubscribeKey(const std::string& deviceId, const std::string& serviceName, - const std::string& characteristicKey, const std::string& characteristicAttribute, int32_t userId = DEFAULT_USER_ID) + const std::string& characteristicKey, const std::string& characteristicAttribute, int32_t userId) { subscribeKey_ = CHAR_PREFIX + SEPARATOR + deviceId + SEPARATOR + serviceName + SEPARATOR + characteristicKey + SEPARATOR + characteristicAttribute; if (userId != DEFAULT_USER_ID) { - subscribeKey_ = subscribeKey_ + SEPARATOR + userId; + subscribeKey_ = subscribeKey_ + SEPARATOR + std::to_string(userId); } } @@ -97,7 +97,7 @@ std::string SubscribeInfo::GetSubscribeKey() const return subscribeKey_; } -void SubscribeInfo::SetSubscribeKey(const std::string& subscribeKey) +void SubscribeInfo::SetSubscribeKey(const std::string& subscribeKey, int32_t userId) { subscribeKey_ = subscribeKey; } diff --git a/common/src/interfaces/service_profile.cpp b/common/src/interfaces/service_profile.cpp index b24f476b..987f72c8 100644 --- a/common/src/interfaces/service_profile.cpp +++ b/common/src/interfaces/service_profile.cpp @@ -150,4 +150,4 @@ std::string ServiceProfile::dump() const return jsonStr; } } // namespace DistributedDeviceProfile -} // namespace OHOS +} // namespace OHOS \ No newline at end of file diff --git a/common/src/utils/profile_utils.cpp b/common/src/utils/profile_utils.cpp index 62d0e9b8..886a3967 100644 --- a/common/src/utils/profile_utils.cpp +++ b/common/src/utils/profile_utils.cpp @@ -80,6 +80,26 @@ std::string ProfileUtils::GetAnonyString(const std::string& value) return res; } +std::string ProfileUtils::GetAnonyInt32(const int32_t value) +{ + constexpr int32_t INT32_STRING_LENGTH = 40; + char tempBuffer[INT32_STRING_LENGTH] = ""; + int32_t secRet = sprintf_s(tempBuffer, INT32_STRING_LENGTH, "%d", value); + size_t length = strlen(tempBuffer); + if (secRet <= 0 || length == 0) { + std::string nullString(""); + return nullString; + } + for (size_t i = 1; i <= length - 1; ++i) { + tempBuffer[i] = '*'; + } + if (length == 0x01) { + tempBuffer[0] = '*'; + } + std::string tempBufferStr(tempBuffer); + return tempBufferStr; +} + std::vector ProfileUtils::GetOnlineDevices() { std::vector targetDevices; @@ -647,7 +667,7 @@ int32_t ProfileUtils::EntriesToDeviceProfile(std::map HILOGI("Entries size is invalid!size: %{public}zu!", values.size()); return DP_INVALID_PARAMS; } - auto propertiesMap = GetProfilePropertiesMap(values); + auto propertiesMap = GetProfilePropertiesMap(values, profile.GetUserId()); if (IsPropertyValid(propertiesMap, OS_SYS_CAPACITY, MAX_STRING_LEN)) { profile.SetOsSysCap(propertiesMap[OS_SYS_CAPACITY]); } @@ -676,7 +696,7 @@ int32_t ProfileUtils::EntriesToServiceProfile(std::map } auto iter = values.begin(); profile.SetDeviceId(GetDeviceIdByDBKey(iter->first)); - auto propertiesMap = GetProfilePropertiesMap(values); + auto propertiesMap = GetProfilePropertiesMap(values, profile.GetUserId()); if (propertiesMap.count(SERVICE_NAME) != 0 && 0 < propertiesMap[SERVICE_NAME].length() && propertiesMap[SERVICE_NAME].length() < MAX_STRING_LEN) { profile.SetServiceName(CheckAndRemoveOhSuffix(propertiesMap[SERVICE_NAME])); @@ -697,7 +717,7 @@ int32_t ProfileUtils::EntriesToCharProfile(std::map va auto iter = values.begin(); profile.SetDeviceId(GetDeviceIdByDBKey(iter->first)); profile.SetServiceName(GetNonOhSuffixServiceNameByDBKey(iter->first)); - auto propertiesMap = GetProfilePropertiesMap(values); + auto propertiesMap = GetProfilePropertiesMap(values, profile.GetUserId()); if (propertiesMap.count(CHARACTERISTIC_KEY) != 0 && 0 < propertiesMap[CHARACTERISTIC_KEY].length() && propertiesMap[CHARACTERISTIC_KEY].length() < MAX_STRING_LEN) { profile.SetCharacteristicKey(propertiesMap[CHARACTERISTIC_KEY]); @@ -721,44 +741,12 @@ std::string ProfileUtils::GenerateDBKey(const std::string& profileKey, const std return DBKey; } -<<<<<<< HEAD -<<<<<<< HEAD - -======= ->>>>>>> fdcd212 (修改检视意见) -std::string ProfileUtils::GetProfileProperty(const std::string& dbKey) -======= std::string ProfileUtils::GetProfileProperty(const std::string& dbKey, int32_t userId) ->>>>>>> 1d65cf1 (fix codecheck) { if (dbKey.length() == 0 || dbKey.length() > MAX_STRING_LEN || (userId <= 0 && userId != DEFAULT_USER_ID)) { return ""; } -<<<<<<< HEAD -<<<<<<< HEAD - std::size_t pos = dbKey.find_last_of("#"); - if (pos == std::string::npos) { - return ""; - } - return dbKey.substr(pos + 1); -} - -std::map ProfileUtils::GetProfilePropertiesMap(std::map dbEntries) -{ - std::map propertiesMap; - for (const auto& item : dbEntries) { - std::string profileProperty = GetProfileProperty(item.first); - if (profileProperty.empty()) { - HILOGE("GetProfileProperty fail, %{public}s!", GetDbKeyAnonyString(item.first).c_str()); - continue; - } - propertiesMap[profileProperty] = item.second; - } - return propertiesMap; -======= -======= int32_t getUserId = GetUserIdFromDbKey(dbKey); ->>>>>>> 1d65cf1 (fix codecheck) std::vector splitKeys; if (SplitString(dbKey, SEPARATOR, splitKeys) != DP_SUCCESS || splitKeys.size() < NUM_3) { HILOGE("GetProfileProperty SplitString fail"); @@ -766,36 +754,11 @@ std::map ProfileUtils::GetProfilePropertiesMap(std::ma } if (splitKeys[0] == DEV_PREFIX) { -<<<<<<< HEAD -<<<<<<< HEAD - if ((userId == DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID) || - (userId == DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID)) { - return splitKeys[NUM_2]; - } - return (userId == getUserId) ? splitKeys[NUM_2] : ""; - } - if (splitKeys[0] == SVR_PREFIX && splitKeys.size() >= NUM_4) { - if ((userId == DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID) || - (userId == DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID)) { - return splitKeys[NUM_3]; - } - return (userId == getUserId) ? splitKeys[NUM_3] : ""; - } - if (splitKeys[0] == CHAR_PREFIX && splitKeys.size() >= NUM_5) { - if ((userId == DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID) || - (userId == DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID)) { - return splitKeys[NUM_4]; - } - return (userId == getUserId) ? splitKeys[NUM_4] : ""; -======= - return splitKeys[NUM_2]; -======= if ((userId == DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID) || (userId != DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID)) { return splitKeys[NUM_2]; } return (userId == getUserId) ? splitKeys[NUM_2] : ""; ->>>>>>> 66a9bff (Revert "转换dbEnties到Profile") } if (splitKeys[0] == SVR_PREFIX && splitKeys.size() >= NUM_4) { if ((userId == DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID) || @@ -804,18 +767,12 @@ std::map ProfileUtils::GetProfilePropertiesMap(std::ma } return (userId == getUserId) ? splitKeys[NUM_3] : ""; } -<<<<<<< HEAD - if (splitKeys[0] == CHAR_PREFIX && splitKeys.size() > NUM_4) { - return splitKeys[NUM_4]; ->>>>>>> f19f01a (转换dbEnties到Profile) -======= if (splitKeys[0] == CHAR_PREFIX && splitKeys.size() >= NUM_5) { if ((userId == DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID) || (userId != DEFAULT_USER_ID && getUserId == DEFAULT_USER_ID)) { return splitKeys[NUM_4]; } return (userId == getUserId) ? splitKeys[NUM_4] : ""; ->>>>>>> 66a9bff (Revert "转换dbEnties到Profile") } HILOGE("dbKey has wrong prefix"); @@ -843,9 +800,6 @@ std::map ProfileUtils::GetProfilePropertiesMap(std::ma } propertiesWithUserId[profileProperty] = item.second; } -<<<<<<< HEAD ->>>>>>> fdcd212 (修改检视意见) -======= if (userId != DEFAULT_USER_ID && !propertiesWithUserId.empty()) { HILOGI("GetProfile with multi-user"); @@ -856,7 +810,6 @@ std::map ProfileUtils::GetProfilePropertiesMap(std::ma //2. Get profile with multi-user, but remote device without multi-user; //3. Get profile with multi-user, but can't find in DB; return propertiesWithoutUserId; ->>>>>>> 1d65cf1 (fix codecheck) } std::string ProfileUtils::toString(const std::u16string& str16) @@ -953,8 +906,6 @@ std::string ProfileUtils::GetDbKeyByProfile(const CharacteristicProfile& profile SEPARATOR + profile.GetCharacteristicKey() + SEPARATOR + CHARACTERISTIC_VALUE; return dbKey; } -<<<<<<< HEAD -======= int32_t ProfileUtils::GetUserIdFromDbKey(const std::string& dbKey) { @@ -964,16 +915,6 @@ int32_t ProfileUtils::GetUserIdFromDbKey(const std::string& dbKey) HILOGE("SplitString fail"); return userId; } -<<<<<<< HEAD - if(splitKeys[0] == DEV_PREFIX && splitKeys.size() == NUM_4 && IsNumStr(splitKeys[NUM_3])) { - userId = std::atoi(splitKeys[NUM_3]); - } - if(splitKeys[0] == SVR_PREFIX && splitKeys.size() == NUM_5 && IsNumStr(splitKeys[NUM_4])) { - userId = std::atoi(splitKeys[NUM_4]); - } - if(splitKeys[0] == CHAR_PREFIX && splitKeys.size() == NUM_6 && IsNumStr(splitKeys[NUM_5])) { - userId = std::atoi(splitKeys[NUM_5]); -======= if (splitKeys[0] == DEV_PREFIX && splitKeys.size() > NUM_3 && IsNumStr(splitKeys[NUM_3])) { userId = std::atoi(splitKeys[NUM_3].c_str()); } @@ -982,7 +923,6 @@ int32_t ProfileUtils::GetUserIdFromDbKey(const std::string& dbKey) } if (splitKeys[0] == CHAR_PREFIX && splitKeys.size() > NUM_5 && IsNumStr(splitKeys[NUM_5])) { userId = std::atoi(splitKeys[NUM_5].c_str()); ->>>>>>> 86ce8ca (切换用户时当前用户数据覆盖上一个用户数据) } return userId; } @@ -1041,6 +981,5 @@ int32_t ProfileUtils::GenerateCharacteristicDBkeys(const std::string& deviceId, } return DP_SUCCESS; } ->>>>>>> 507ffd4 (KV Delete接口适配多用户) } // namespace DistributedDeviceProfile } // namespace OHOS diff --git a/old/services/core/BUILD.gn b/old/services/core/BUILD.gn index d41e56fd..b713e978 100644 --- a/old/services/core/BUILD.gn +++ b/old/services/core/BUILD.gn @@ -40,6 +40,7 @@ config("device_info_manager_config") { "${device_profile_service}/include/permissionmanager", "${device_profile_service}/include/persistenceadapter/kvadapter", "${device_profile_service}/include/persistenceadapter/rdbadapter", + "${device_profile_service}/include/publishcommonevent", "${device_profile_service}/include/subscribeprofilemanager", "${device_profile_service}/include/trustprofilemanager", "${device_profile_service}/include/utils", diff --git a/old/services/core/include/distributed_device_profile_service.h b/old/services/core/include/distributed_device_profile_service.h index 9d3652bf..3661c813 100644 --- a/old/services/core/include/distributed_device_profile_service.h +++ b/old/services/core/include/distributed_device_profile_service.h @@ -68,7 +68,8 @@ private: std::unordered_set depSaIds_ { SOFTBUS_SERVER_SA_ID, DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID, - DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID + DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID, + SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN }; }; } // namespace DeviceProfile diff --git a/old/services/core/src/distributed_device_profile_service.cpp b/old/services/core/src/distributed_device_profile_service.cpp index 07c8fa2b..345ba48e 100644 --- a/old/services/core/src/distributed_device_profile_service.cpp +++ b/old/services/core/src/distributed_device_profile_service.cpp @@ -263,6 +263,7 @@ void DistributedDeviceProfileService::OnStart(const SystemAbilityOnDemandReason& AddSystemAbilityListener(SOFTBUS_SERVER_SA_ID); AddSystemAbilityListener(DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID); AddSystemAbilityListener(DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID); + AddSystemAbilityListener(SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN); if (!Publish(this)) { HILOGE("publish SA failed"); return; diff --git a/services/core/BUILD.gn b/services/core/BUILD.gn index 43241853..0a79847c 100644 --- a/services/core/BUILD.gn +++ b/services/core/BUILD.gn @@ -116,6 +116,7 @@ ohos_shared_library("distributed_device_profile_svr") { "device_manager:devicemanagersdk", "dmsfwk:common_sdk", "eventhandler:libeventhandler", + "ffrt:libffrt", "hilog:libhilog", "hisysevent:libhisysevent", "hitrace:hitrace_meter", diff --git a/services/core/include/deviceprofilemanager/device_profile_manager.h b/services/core/include/deviceprofilemanager/device_profile_manager.h index 607652fa..8ed7f2cd 100644 --- a/services/core/include/deviceprofilemanager/device_profile_manager.h +++ b/services/core/include/deviceprofilemanager/device_profile_manager.h @@ -74,6 +74,7 @@ public: void OnDeviceOnline(const DistributedHardware::DmDeviceInfo deviceInfo); void OnDeviceTrustChange(const std::string& peerUdid, const std::string& peerUuid, const DistributedHardware::DmAuthForm authform); + void OnUserChange(int32_t lastUserId, int32_t curUserId); private: bool LoadDpSyncAdapter(); @@ -98,7 +99,12 @@ private: void NotifyNotOHBaseOnline(const DistributedHardware::DmDeviceInfo deviceInfo); void E2ESyncDynamicProfile(const DistributedHardware::DmDeviceInfo deviceInfo); void ClearDataWithPeerLogout(const std::string& peerUdid, const std::string& peerUuid); + int32_t SaveBatchByKeys(const std::map& entries); void FixDiffProfiles(); + template + int32_t IsMultiUserValid(const T& profile); + bool IsSameAccount(const std::string deviceId, const int32_t userId); + bool HasTrustP2PRelation(const std::string deviceId, const int32_t userId); bool isAdapterSoLoaded_ = false; std::mutex isAdapterLoadLock_; std::mutex dynamicStoreMutex_; diff --git a/services/core/include/distributed_device_profile_service_new.h b/services/core/include/distributed_device_profile_service_new.h index ca4d1a7f..b37ac16e 100644 --- a/services/core/include/distributed_device_profile_service_new.h +++ b/services/core/include/distributed_device_profile_service_new.h @@ -21,6 +21,7 @@ #include #include #include "distributed_device_profile_stub_new.h" +#include "dp_account_common_event.h" #include "i_dp_inited_callback.h" #include "event_handler.h" #include "event_runner.h" @@ -82,6 +83,7 @@ protected: void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; private: + void AccountCommonEventCallback(int32_t userId, const std::string commonEventType); int32_t CreateUnloadHandler(); int32_t DestroyUnloadHandler(); int32_t AddSvrProfilesToCache(const std::vector& serviceProfiles); @@ -89,10 +91,12 @@ private: int32_t SaveSwitchProfilesFromTempCache(); int32_t SaveDynamicProfilesFromTempCache(); int32_t NotifyDeviceProfileInited(); + void SubscribeAccountCommonEvent(); void GetDynamicProfilesFromTempCache(std::map& entries); void ClearProfileCache(); private: + std::shared_ptr accountCommonEventManager_; std::shared_ptr unloadHandler_; std::mutex unloadMutex_; std::atomic isInited_{false}; @@ -106,7 +110,8 @@ private: std::unordered_set depSaIds_ { SOFTBUS_SERVER_SA_ID, DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID, - DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID + DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID, + SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN }; }; } // namespace DeviceProfile diff --git a/services/core/include/multiusermanager/multi_user_manager.h b/services/core/include/multiusermanager/multi_user_manager.h index 3c312087..f33a17fd 100644 --- a/services/core/include/multiusermanager/multi_user_manager.h +++ b/services/core/include/multiusermanager/multi_user_manager.h @@ -37,6 +37,8 @@ public: void SetCurrentForegroundUserID(int32_t userId); + int32_t GetForegroundUserIDFromOs(); + private: int32_t foregroundUserId_ = -1; std::mutex foregroundUserIdLock_; diff --git a/services/core/include/utils/profile_cache.h b/services/core/include/utils/profile_cache.h index 4a4e6031..f78040dc 100644 --- a/services/core/include/utils/profile_cache.h +++ b/services/core/include/utils/profile_cache.h @@ -95,11 +95,6 @@ private: int32_t RefreshStaticProfileCache(const std::unordered_map& staticProfiles); private: -<<<<<<< HEAD - std:mutex foregroundIdMutex_; - int32_t foregroundId_ = -1; -======= ->>>>>>> 8f3393c (删除cache中不必要的代码) std::string localNetworkId_; std::mutex switchMutex_; uint32_t curLocalSwitch_ = 0x0000; diff --git a/services/core/src/deviceprofilemanager/device_profile_manager.cpp b/services/core/src/deviceprofilemanager/device_profile_manager.cpp index 0482c5a9..46f18fc0 100644 --- a/services/core/src/deviceprofilemanager/device_profile_manager.cpp +++ b/services/core/src/deviceprofilemanager/device_profile_manager.cpp @@ -25,6 +25,7 @@ #include "content_sensor_manager_utils.h" #include "distributed_device_profile_errors.h" +#include "distributed_device_profile_enums.h" #include "distributed_device_profile_log.h" #include "event_handler_factory.h" #include "i_sync_completed_callback.h" @@ -35,6 +36,7 @@ #include "profile_control_utils.h" #include "profile_utils.h" #include "static_profile_manager.h" +#include "trust_profile_manager.h" namespace OHOS { namespace DistributedDeviceProfile { @@ -295,16 +297,6 @@ int32_t DeviceProfileManager::PutCharacteristicProfileBatch(const std::vector>>>>>> f7ce896 (get接口添加默认参数) } - if (deviceProfile.GetIsMuitUser()) { - HILOGI("this profile support multi-user, userId: %{public}s", - ProfileUtils::GetAnonyString(std::to_string(deviceProfile.GetUserId()).c_str()).c_str()); - } - HILOGI("this profile not support multi-user"); - ->>>>>>> 6468278 (解冲突) - int32_t res = 0; { std::lock_guard lock(dynamicStoreMutex_); res = ProfileControlUtils::GetDeviceProfile(deviceProfileStore_, deviceId, deviceProfile); @@ -337,16 +320,6 @@ int32_t DeviceProfileManager::GetDeviceProfile(const std::string& deviceId, Devi int32_t DeviceProfileManager::GetServiceProfile(const std::string& deviceId, const std::string& serviceName, ServiceProfile& serviceProfile, bool isMultiUser, int32_t userId) { -<<<<<<< HEAD - HILOGD("call!"); -======= -<<<<<<< HEAD - if ((serviceProfile.GetIsMuitUser() && serviceProfile.GetUserId() <= 0) || - (!serviceProfile.GetIsMuitUser() && serviceProfile.GetUserId() != DEFAULT_USER_ID)) { - HILOGE("multi-user params are invalid, isMultiUser: %{public}d, userId: %{public}s", - serviceProfile.GetIsMuitUser(), - ProfileUtils::GetAnonyString(std::to_string(serviceProfile.GetUserId()).c_str()).c_str()); -======= serviceProfile.SetDeviceId(deviceId); serviceProfile.SetIsMultiUser(isMultiUser); serviceProfile.SetUserId(userId); @@ -354,16 +327,7 @@ int32_t DeviceProfileManager::GetServiceProfile(const std::string& deviceId, con if (res != DP_SUCCESS) { HILOGE("GetServiceProfile IsMultiUserValid failed, res: %{public}d", res); return res; ->>>>>>> f7ce896 (get接口添加默认参数) } - if (serviceProfile.GetIsMuitUser()) { - HILOGI("this profile support multi-user, userId: %{public}s", - ProfileUtils::GetAnonyString(std::to_string(serviceProfile.GetUserId()).c_str()).c_str()); - } - HILOGI("this profile not support multi-user"); - ->>>>>>> 6468278 (解冲突) - int32_t res = 0; { std::lock_guard lock(dynamicStoreMutex_); res = ProfileControlUtils::GetServiceProfile(deviceProfileStore_, deviceId, serviceName, @@ -380,16 +344,6 @@ int32_t DeviceProfileManager::GetServiceProfile(const std::string& deviceId, con int32_t DeviceProfileManager::GetCharacteristicProfile(const std::string& deviceId, const std::string& serviceName, const std::string& characteristicKey, CharacteristicProfile& charProfile, bool isMultiUser, int32_t userId) { -<<<<<<< HEAD - HILOGD("call!"); -======= -<<<<<<< HEAD - if ((charProfile.GetIsMuitUser() && charProfile.GetUserId() <= 0) || - (!charProfile.GetIsMuitUser() && charProfile.GetUserId() != DEFAULT_USER_ID)) { - HILOGE("multi-user params are invalid, isMultiUser: %{public}d, userId: %{public}s", - charProfile.GetIsMuitUser(), - ProfileUtils::GetAnonyString(std::to_string(charProfile.GetUserId()).c_str()).c_str()); -======= charProfile.SetDeviceId(deviceId); charProfile.SetIsMultiUser(isMultiUser); charProfile.SetUserId(userId); @@ -397,16 +351,7 @@ int32_t DeviceProfileManager::GetCharacteristicProfile(const std::string& device if (res != DP_SUCCESS) { HILOGE("GetCharacteristicProfile IsMultiUserValid failed, res: %{public}d", res); return res; ->>>>>>> f7ce896 (get接口添加默认参数) } - if (charProfile.GetIsMuitUser()) { - HILOGI("this profile support multi-user, userId: %{public}s", - ProfileUtils::GetAnonyString(std::to_string(charProfile.GetUserId()).c_str()).c_str()); - } - HILOGI("this profile not support multi-user"); - ->>>>>>> 6468278 (解冲突) - int32_t res = 0; { std::lock_guard lock(dynamicStoreMutex_); res = ProfileControlUtils::GetCharacteristicProfile(deviceProfileStore_, deviceId, serviceName, @@ -1120,8 +1065,6 @@ void DeviceProfileManager::FixDiffProfiles() } return; } -<<<<<<< HEAD -======= void DeviceProfileManager::OnUserChange(int32_t lastUserId, int32_t curUserId) { @@ -1193,11 +1136,6 @@ int32_t DeviceProfileManager::SaveBatchByKeys(const std::map>>>>>> 86ce8ca (切换用户时当前用户数据覆盖上一个用户数据) -======= -<<<<<<< HEAD -======= template int32_t DeviceProfileManager::IsMultiUserValid(const T& profile) @@ -1289,7 +1227,5 @@ bool DeviceProfileManager::HasTrustP2PRelation(const std::string deviceId, const return false; } ->>>>>>> ad8db23 (update) ->>>>>>> 6468278 (解冲突) } // namespace DeviceProfile } // namespace OHOS diff --git a/services/core/src/deviceprofilemanager/listener/kv_data_change_listener.cpp b/services/core/src/deviceprofilemanager/listener/kv_data_change_listener.cpp index 4dc19487..3b417a28 100644 --- a/services/core/src/deviceprofilemanager/listener/kv_data_change_listener.cpp +++ b/services/core/src/deviceprofilemanager/listener/kv_data_change_listener.cpp @@ -134,7 +134,7 @@ void KvDataChangeListener::FilterEntries(const std::vector HILOGW("%{public}s is invalid dbKey", ProfileUtils::GetDbKeyAnonyString(dbKey).c_str()); continue; } - if (res[0] == CHAR_PREFIX && res.size() > NUM_3 && res[NUM_3] == CHARACTERISTIC_KEY) { + if (res[0] == CHAR_PREFIX && res.size() > NUM_4 && res[NUM_4] == CHARACTERISTIC_KEY) { HILOGD("%{public}s is charProfileKey", ProfileUtils::GetDbKeyAnonyString(dbKey).c_str()); continue; } diff --git a/services/core/src/distributed_device_profile_service_new.cpp b/services/core/src/distributed_device_profile_service_new.cpp index 5cecd06e..d8cb92f4 100644 --- a/services/core/src/distributed_device_profile_service_new.cpp +++ b/services/core/src/distributed_device_profile_service_new.cpp @@ -24,6 +24,7 @@ #include "iservice_registry.h" #include "sa_profiles.h" +#include "common_event_support.h" #include "content_sensor_manager.h" #include "device_profile_dumper.h" #include "distributed_device_profile_constants.h" @@ -32,6 +33,7 @@ #include "device_profile_manager.h" #include "dp_radar_helper.h" #include "event_handler_factory.h" +#include "multi_user_manager.h" #include "permission_manager.h" #include "profile_cache.h" #include "static_profile_manager.h" @@ -115,6 +117,10 @@ int32_t DistributedDeviceProfileServiceNew::PostInit() HILOGE("ContentSensorManager init failed"); return DP_CONTENT_SENSOR_MANAGER_INIT_FAIL; } + if (MultiUserManager::GetInstance().Init() != DP_SUCCESS) { + HILOGE("MultiUserManager init failed"); + return DP_MULTI_USER_MANAGER_INIT_FAIL; + } SaveSwitchProfilesFromTempCache(); SaveDynamicProfilesFromTempCache(); isInited_ = true; @@ -578,6 +584,7 @@ void DistributedDeviceProfileServiceNew::OnStart(const SystemAbilityOnDemandReas AddSystemAbilityListener(SOFTBUS_SERVER_SA_ID); AddSystemAbilityListener(DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID); AddSystemAbilityListener(DISTRIBUTED_HARDWARE_DEVICEMANAGER_SA_ID); + AddSystemAbilityListener(SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN); if (!Publish(this)) { HILOGE("publish SA failed"); return; @@ -615,9 +622,47 @@ void DistributedDeviceProfileServiceNew::OnAddSystemAbility(int32_t systemAbilit return; } } + if (systemAbilityId == SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN) { + SubscribeAccountCommonEvent(); + } PostInit(); } +void DistributedDeviceProfileServiceNew::SubscribeAccountCommonEvent() +{ + HILOGI("Start"); + if (accountCommonEventManager_ == nullptr) { + accountCommonEventManager_ = std::make_shared(); + } + AccountEventCallback callback = [=](const auto &arg1, const auto &arg2) { + this->AccountCommonEventCallback(arg1, arg2); + }; + std::vector AccountCommonEventVec; + AccountCommonEventVec.emplace_back(EventFwk::CommonEventSupport::COMMON_EVENT_USER_SWITCHED); + AccountCommonEventVec.emplace_back(EventFwk::CommonEventSupport::COMMON_EVENT_USER_REMOVED); + AccountCommonEventVec.emplace_back(EventFwk::CommonEventSupport::COMMON_EVENT_HWID_LOGOUT); + AccountCommonEventVec.emplace_back(EventFwk::CommonEventSupport::COMMON_EVENT_HWID_LOGIN); + if (accountCommonEventManager_->SubscribeAccountCommonEvent(AccountCommonEventVec, callback)) { + HILOGI("Success"); + } + return; +} + +void DistributedDeviceProfileServiceNew::AccountCommonEventCallback(int32_t userId, const std::string commonEventType) +{ + HILOGI("CommonEventType: %{public}s, userId: %{public}d", commonEventType.c_str(), userId); + if (commonEventType == EventFwk::CommonEventSupport::COMMON_EVENT_USER_SWITCHED) { + // swithed + MultiUserManager::GetInstance().SetCurrentForegroundUserID(userId); + } else if (commonEventType == EventFwk::CommonEventSupport::COMMON_EVENT_HWID_LOGIN) { + } else if (commonEventType == EventFwk::CommonEventSupport::COMMON_EVENT_HWID_LOGOUT) { + } else if (commonEventType == EventFwk::CommonEventSupport::COMMON_EVENT_USER_REMOVED) { + } else { + HILOGE("Invalied account common event."); + } + return; +} + int32_t DistributedDeviceProfileServiceNew::AddSvrProfilesToCache(const std::vector& serviceProfiles) { if (serviceProfiles.empty()) { diff --git a/services/core/src/multiusermanager/multi_user_manager.cpp b/services/core/src/multiusermanager/multi_user_manager.cpp index d3715842..ba9dffce 100644 --- a/services/core/src/multiusermanager/multi_user_manager.cpp +++ b/services/core/src/multiusermanager/multi_user_manager.cpp @@ -16,8 +16,10 @@ #include "multi_user_manager.h" #include "device_profile_manager.h" +#include "distributed_device_profile_constants.h" #include "distributed_device_profile_errors.h" #include "distributed_device_profile_log.h" +#include "profile_utils.h" #include "account_info.h" #include "ohos_account_kits.h" @@ -34,12 +36,12 @@ namespace { int32_t MultiUserManager::Init() { HILOGI("Init"); - int32_t foregroundId; + int32_t foregroundId = DEFAULT_USER_ID; int32_t res = OHOS::AccountSA::OsAccountManager::GetForegroundOsAccountLocalId(foregroundId); - if (res != DP_SUCCESS) { + if (res != DP_SUCCESS || foregroundId == DEFAULT_USER_ID) { HILOGD("GetForegroundId failed, res:%{public}d", res); } - HILOGI("current foregroundId = %{public}d", foregroundId); + HILOGI("current foregroundId = %{public}s", ProfileUtils::GetAnonyInt32(foregroundId).c_str()); SetCurrentForegroundUserID(foregroundId); return DP_SUCCESS; @@ -63,5 +65,17 @@ int32_t MultiUserManager::GetCurrentForegroundUserID() return foregroundUserId_; } +int32_t MultiUserManager::GetForegroundUserIDFromOs() +{ + int32_t foregroundId = DEFAULT_USER_ID; + int32_t res = OHOS::AccountSA::OsAccountManager::GetForegroundOsAccountLocalId(foregroundId); + if (res != DP_SUCCESS || foregroundId == DEFAULT_USER_ID) { + HILOGD("GetForegroundId failed, res:%{public}d", res); + return DP_GET_FOREGROUND_ID_FAIL; + } + HILOGI("GetForegroundUserIDFromOs foregroundId = %{public}s", ProfileUtils::GetAnonyInt32(foregroundId).c_str()); + return foregroundId; +} + } // namespace DistributedHardware } // namespace OHOS diff --git a/services/core/src/publishcommonevent/dp_account_common_event.cpp b/services/core/src/publishcommonevent/dp_account_common_event.cpp index 46ae4946..17d323f2 100644 --- a/services/core/src/publishcommonevent/dp_account_common_event.cpp +++ b/services/core/src/publishcommonevent/dp_account_common_event.cpp @@ -21,6 +21,7 @@ #include "common_event_support.h" #include "distributed_device_profile_errors.h" #include "distributed_device_profile_log.h" +#include "ffrt.h" #include "iservice_registry.h" #include "multi_user_manager.h" #include "system_ability_definition.h" @@ -150,6 +151,7 @@ void DpAccountEventSubscriber::OnReceiveEvent(const CommonEventData &data) HILOGE("Invalied account type event."); return; } + ffrt::submit([=]() { callback_(userId, receiveEvent); }); } void DpAccountCommonEventManager::SystemAbilityStatusChangeListener::OnAddSystemAbility( @@ -168,14 +170,6 @@ void DpAccountCommonEventManager::SystemAbilityStatusChangeListener::OnAddSystem if (!CommonEventManager::SubscribeCommonEvent(changeSubscriber_)) { HILOGE("failed to subscribe account commom event: %{public}zu", eventNameVec.size()); } - // int32_t userId = MultipleUserConnector::GetCurrentAccountUserID(); - // std::string accountId = MultipleUserConnector::GetOhosAccountId(); - // HILOGI("after subscribe account event accountId: %{public}s, userId: %{public}s", - // GetAnonyString(accountId).c_str(), GetAnonyInt32(userId).c_str()); - // if (userId > 0) { - // MultipleUserConnector::SetSwitchOldUserId(userId); - // MultipleUserConnector::SetSwitchOldAccountId(accountId); - // } } void DpAccountCommonEventManager::SystemAbilityStatusChangeListener::OnRemoveSystemAbility( diff --git a/services/core/src/utils/profile_cache.cpp b/services/core/src/utils/profile_cache.cpp index 9d3490a7..269479e7 100644 --- a/services/core/src/utils/profile_cache.cpp +++ b/services/core/src/utils/profile_cache.cpp @@ -51,16 +51,6 @@ int32_t ProfileCache::Init() HILOGW("GetTrustedDeviceList failed, res: %{public}d", res); return DP_SUCCESS; } -<<<<<<< HEAD - { - std::lock_guard lock(foregroundIdMutex_); - foregroundId_ = GetForegroundId(); - if (foregroundId_ == DP_GET_FOREGROUND_ID_FAIL) { - LOGE("GetForegroundId id failed, ForegroundId: %{public}d", foregroundId_); - } - } -======= ->>>>>>> 8f3393c (删除cache中不必要的代码) std::string udid = EMPTY_STRING; std::lock_guard lock(onlineDeviceLock_); @@ -843,21 +833,5 @@ std::string ProfileCache::GetLocalUuid() localUuid_ = localUuid; return localUuid; } -<<<<<<< HEAD - -int32_t ProfileCache::GetForegroundId() -{ - int32_t foregroundId; - int32_t res = OHOS::AccountSA::OsAccountManager::GetForegroundOsAccountLocalId(foregroundId); - if (res != DP_SUCCESS) { - LOGE("GetForegroundId failed, res:%{public}d", res); - return DP_GET_FOREGROUND_ID_FAIL; - } - LOGI("current foregroundId = %{public}d", foregroundId); - return foregroundId; -} - -======= ->>>>>>> 8f3393c (删除cache中不必要的代码) } // namespace DeviceProfile } // namespace OHOS diff --git a/services/core/test/unittest/distributed_device_profile_stub_new_test.cpp b/services/core/test/unittest/distributed_device_profile_stub_new_test.cpp index 00b80ffe..10c72ea3 100644 --- a/services/core/test/unittest/distributed_device_profile_stub_new_test.cpp +++ b/services/core/test/unittest/distributed_device_profile_stub_new_test.cpp @@ -51,19 +51,12 @@ class MockDistributedDeviceProfileStubNew : public DistributedDeviceProfileStubN int32_t GetServiceProfile(const std::string& deviceId, const std::string& serviceName, ServiceProfile& serviceProfile, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) override; int32_t GetCharacteristicProfile(const std::string& deviceId, const std::string& serviceName, -<<<<<<< HEAD - const std::string& characteristicId, CharacteristicProfile& charProfile) override; - int32_t DeleteServiceProfile(const std::string& deviceId, const std::string& serviceName) override; - int32_t DeleteCharacteristicProfile(const std::string& deviceId, const std::string& serviceName, - const std::string& characteristicId) override; -======= const std::string& characteristicId, CharacteristicProfile& charProfile, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) override; int32_t DeleteServiceProfile(const std::string& deviceId, const std::string& serviceName, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) override; int32_t DeleteCharacteristicProfile(const std::string& deviceId, const std::string& serviceName, const std::string& characteristicId, bool isMultiUser = false, int32_t userId = DEFAULT_USER_ID) override; ->>>>>>> 6cd545d (编译通过,修改检视意见) int32_t SubscribeDeviceProfile(const SubscribeInfo& subscribeInfo) override; int32_t UnSubscribeDeviceProfile(const SubscribeInfo& subscribeInfo) override; int32_t SubscribeDeviceProfileInited(int32_t saId, sptr dpInitedCallback) override; @@ -197,16 +190,6 @@ int32_t MockDistributedDeviceProfileStubNew::GetCharacteristicProfile(const std: return 0; } int32_t MockDistributedDeviceProfileStubNew::DeleteServiceProfile(const std::string& deviceId, -<<<<<<< HEAD - const std::string& serviceName) -{ - (void)deviceId; - (void)serviceName; - return 0; -} -int32_t MockDistributedDeviceProfileStubNew::DeleteCharacteristicProfile(const std::string& deviceId, - const std::string& serviceName, const std::string& characteristicId) -======= const std::string& serviceName, bool isMultiUser, int32_t userId) { (void)deviceId; @@ -217,16 +200,12 @@ int32_t MockDistributedDeviceProfileStubNew::DeleteCharacteristicProfile(const s } int32_t MockDistributedDeviceProfileStubNew::DeleteCharacteristicProfile(const std::string& deviceId, const std::string& serviceName, const std::string& characteristicId, bool isMultiUser, int32_t userId) ->>>>>>> 6cd545d (编译通过,修改检视意见) { (void)deviceId; (void)serviceName; (void)characteristicId; -<<<<<<< HEAD -======= (void)isMultiUser; (void)userId; ->>>>>>> 6cd545d (编译通过,修改检视意见) return 0; } int32_t MockDistributedDeviceProfileStubNew::SubscribeDeviceProfile(const SubscribeInfo& subscribeInfo)