From 7f67f17fae8a29e6087d42d6a156a739c969c856 Mon Sep 17 00:00:00 2001 From: chensi10 Date: Tue, 14 Sep 2021 22:24:17 +0800 Subject: [PATCH] test Signed-off-by: chensi10 --- .../appexecfwk_base/include/ability_info.h | 11 +-- .../include/application_info.h | 1 + .../include/bundle_constants.h | 3 + .../appexecfwk_base/include/hap_module_info.h | 1 + .../src/compatible_ability_info.cpp | 89 ++++++++++++++++++- .../src/compatible_application_info.cpp | 8 +- .../appexecfwk_base/src/hap_module_info.cpp | 2 + .../fmskit/native/src/form_host_client.cpp | 11 ++- .../libeventhandler/include/event_handler.h | 42 ++++----- kits/appkit/napi/bundlemgr/bundle_mgr.cpp | 77 +++++----------- kits/appkit/napi/bundlemgr/native_module.cpp | 6 +- services/bundlemgr/include/common_profile.h | 1 + .../bundlemgr/include/inner_bundle_info.h | 1 + .../bundlemgr/src/base_bundle_installer.cpp | 2 +- services/bundlemgr/src/bundle_profile.cpp | 10 +++ services/bundlemgr/src/inner_bundle_info.cpp | 13 ++- .../formmgr/include/form_ability_connection.h | 2 +- .../formmgr/src/form_ability_connection.cpp | 6 +- .../formmgr/src/form_acquire_connection.cpp | 6 +- .../formmgr/src/form_cast_temp_connection.cpp | 6 +- services/formmgr/src/form_data_mgr.cpp | 11 ++- services/formmgr/src/form_db_cache.cpp | 18 ++-- .../formmgr/src/form_delete_connection.cpp | 6 +- services/formmgr/src/form_host_callback.cpp | 6 +- services/formmgr/src/form_mgr_adapter.cpp | 76 ++++++++-------- .../formmgr/src/form_msg_event_connection.cpp | 6 +- services/formmgr/src/form_provider_mgr.cpp | 17 ++-- .../formmgr/src/form_refresh_connection.cpp | 6 +- services/formmgr/src/form_refresh_limiter.cpp | 9 +- services/formmgr/src/form_storage_mgr.cpp | 8 +- services/formmgr/src/form_supply_callback.cpp | 6 +- .../formmgr/src/form_sys_event_receiver.cpp | 13 +-- services/formmgr/src/form_task_mgr.cpp | 5 +- services/formmgr/src/form_timer_mgr.cpp | 14 +-- services/formmgr/src/form_util.cpp | 7 +- 35 files changed, 318 insertions(+), 188 deletions(-) diff --git a/interfaces/innerkits/appexecfwk_base/include/ability_info.h b/interfaces/innerkits/appexecfwk_base/include/ability_info.h index 9919a80bcd..781e7c2909 100644 --- a/interfaces/innerkits/appexecfwk_base/include/ability_info.h +++ b/interfaces/innerkits/appexecfwk_base/include/ability_info.h @@ -193,21 +193,22 @@ struct AbilityInfo : public Parcelable { std::string libPath; // ability library path without name, libPath->libDir // element that does not exist for a while + std::string originalBundleName; std::string appName; std::string privacyUrl; std::string privacyName; std::string downloadUrl; std::string versionName; + std::string className; + std::string originalClassName; + std::string uriPermissionMode; + std::string uriPermissionPath; uint32_t backgroundModes = 0; uint32_t packageSize = 0; bool multiUserShared = false; - AbilitySubType subType = AbilitySubType::UNSPECIFIED; bool grantPermission = false; - std::string uriPermissionMode; - std::string uriPermissionPath; bool directLaunch = true; - std::string className; - std::string originalClassName; + AbilitySubType subType = AbilitySubType::UNSPECIFIED; bool ReadFromParcel(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; diff --git a/interfaces/innerkits/appexecfwk_base/include/application_info.h b/interfaces/innerkits/appexecfwk_base/include/application_info.h index 537991cdfa..96168d4626 100644 --- a/interfaces/innerkits/appexecfwk_base/include/application_info.h +++ b/interfaces/innerkits/appexecfwk_base/include/application_info.h @@ -92,6 +92,7 @@ struct ApplicationInfo : public Parcelable { bool enabled = false; // element that does not exist for a while + std::string entryModuleName; std::string icon; std::string cpuAbi; bool isCompressNativeLibs = true; diff --git a/interfaces/innerkits/appexecfwk_base/include/bundle_constants.h b/interfaces/innerkits/appexecfwk_base/include/bundle_constants.h index 48e25adcfe..0a5a4207d8 100755 --- a/interfaces/innerkits/appexecfwk_base/include/bundle_constants.h +++ b/interfaces/innerkits/appexecfwk_base/include/bundle_constants.h @@ -123,6 +123,9 @@ const int32_t MAX_LIMIT_SIZE = 4; const std::string DATA_ABILITY_URI_PREFIX = "dataability://"; const char DATA_ABILITY_URI_SEPARATOR = '/'; +const int MAX_DIMENSION_SIZE = 10; +const int MAX_DEVICETYPE_SIZE = 50; + } // namespace Constants } // namespace AppExecFwk } // namespace OHOS diff --git a/interfaces/innerkits/appexecfwk_base/include/hap_module_info.h b/interfaces/innerkits/appexecfwk_base/include/hap_module_info.h index 29568df009..7f058ec5d7 100644 --- a/interfaces/innerkits/appexecfwk_base/include/hap_module_info.h +++ b/interfaces/innerkits/appexecfwk_base/include/hap_module_info.h @@ -38,6 +38,7 @@ struct HapModuleInfo : public Parcelable { std::string iconPath; std::string label; std::string backgroundImg; + std::string mainAbility; int supportedModes = 0; std::vector reqCapabilities; diff --git a/interfaces/innerkits/appexecfwk_base/src/compatible_ability_info.cpp b/interfaces/innerkits/appexecfwk_base/src/compatible_ability_info.cpp index 91162ab811..addc09f024 100644 --- a/interfaces/innerkits/appexecfwk_base/src/compatible_ability_info.cpp +++ b/interfaces/innerkits/appexecfwk_base/src/compatible_ability_info.cpp @@ -63,6 +63,51 @@ bool CompatibleAbilityInfo::ReadFromParcel(Parcel& parcel) READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, launchModeData); launchMode = static_cast(launchModeData); + int32_t permissionsSize; + READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, permissionsSize); + if (permissionsSize > Constants::MAX_LIMIT_SIZE) { + APP_LOGE("permissions size is overflow"); + return false; + } + for (int32_t i = 0; i < permissionsSize; i++) { + std::string permission = Str16ToStr8(parcel.ReadString16()); + if (permission.empty()) { + APP_LOGE("ReadParcelable failed"); + return false; + } + permissions.emplace_back(permission); + } + + int32_t deviceTypeSize; + READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, deviceTypeSize); + if (deviceTypeSize > Constants::MAX_DEVICETYPE_SIZE) { + APP_LOGE("device type size is overflow"); + return false; + } + for (auto i = 0; i < deviceTypeSize; i++) { + std::string deviceType = Str16ToStr8(parcel.ReadString16()); + if (deviceType.empty()) { + APP_LOGE("ReadParcelable failed"); + return false; + } + deviceTypes.emplace_back(deviceType); + } + + int32_t deviceCapabilitySize; + READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, deviceCapabilitySize); + if (deviceCapabilitySize > Constants::MAX_LIMIT_SIZE) { + APP_LOGE("device capability size is overflow"); + return false; + } + for (auto i = 0; i < deviceCapabilitySize; i++) { + std::string deviceCapability = Str16ToStr8(parcel.ReadString16()); + if (deviceCapability.empty()) { + APP_LOGE("ReadParcelable failed"); + return false; + } + deviceCapabilities.emplace_back(deviceCapability); + } + supportPipMode = parcel.ReadBool(); grantPermission = parcel.ReadBool(); readPermission = Str16ToStr8(parcel.ReadString16()); @@ -73,6 +118,12 @@ bool CompatibleAbilityInfo::ReadFromParcel(Parcel& parcel) bundleName = Str16ToStr8(parcel.ReadString16()); className = Str16ToStr8(parcel.ReadString16()); deviceId = Str16ToStr8(parcel.ReadString16()); + std::unique_ptr appInfo(parcel.ReadParcelable()); + if (!appInfo) { + APP_LOGE("ReadParcelable failed"); + return false; + } + applicationInfo = *appInfo; formEntity = parcel.ReadInt32(); minFormHeight = parcel.ReadInt32(); defaultFormHeight = parcel.ReadInt32(); @@ -123,6 +174,21 @@ bool CompatibleAbilityInfo::Marshalling(Parcel& parcel) const WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast(type)); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast(orientation)); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, static_cast(launchMode)); + const auto permissionsSize = static_cast(permissions.size()); + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, permissionsSize); + for (auto i = 0; i < permissionsSize; i++) { + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(permissions[i])); + } + const auto deviceTypeSize = static_cast(deviceTypes.size()); + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, deviceTypeSize); + for (auto i = 0; i < deviceTypeSize; i++) { + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(deviceTypes[i])); + } + const auto deviceCapabilitySize = static_cast(deviceCapabilities.size()); + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, deviceCapabilitySize); + for (auto i = 0; i < deviceCapabilitySize; i++) { + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(deviceCapabilities[i])); + } WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, supportPipMode); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, grantPermission); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(readPermission)); @@ -134,6 +200,9 @@ bool CompatibleAbilityInfo::Marshalling(Parcel& parcel) const WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(className)); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(deviceId)); APP_LOGE("CompatibleAbilityInfo::Marshalling start to write application info."); + if (!parcel.WriteParcelable(&applicationInfo)) { + return false; + } WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, formEntity); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, minFormHeight); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, defaultFormHeight); @@ -158,17 +227,33 @@ void CompatibleAbilityInfo::ConvertToAbilityInfo(AbilityInfo& abilityInfo) const abilityInfo.moduleName = moduleName; abilityInfo.process = process; abilityInfo.targetAbility = targetAbility; + abilityInfo.appName = appName; + abilityInfo.privacyUrl = privacyUrl; + abilityInfo.privacyName = privacyName; + abilityInfo.downloadUrl = downloadUrl; + abilityInfo.versionName = versionName; + abilityInfo.backgroundModes = backgroundModes; + abilityInfo.packageSize = packageSize; abilityInfo.visible = visible; + abilityInfo.formEnabled = formEnabled; + abilityInfo.multiUserShared = multiUserShared; abilityInfo.type = type; + abilityInfo.subType = subType; abilityInfo.orientation = orientation; abilityInfo.launchMode = launchMode; abilityInfo.permissions = permissions; abilityInfo.deviceTypes = deviceTypes; abilityInfo.deviceCapabilities = deviceCapabilities; abilityInfo.supportPipMode = supportPipMode; + abilityInfo.grantPermission = grantPermission; abilityInfo.readPermission = readPermission; abilityInfo.writePermission = writePermission; + abilityInfo.uriPermissionMode = uriPermissionMode; + abilityInfo.uriPermissionPath = uriPermissionPath; + abilityInfo.directLaunch = directLaunch; abilityInfo.bundleName = bundleName; + abilityInfo.className = className; + abilityInfo.originalClassName = originalClassName; abilityInfo.deviceId = deviceId; ApplicationInfo convertedApplicationInfo; applicationInfo.ConvertToApplicationInfo(convertedApplicationInfo); @@ -182,6 +267,8 @@ void CompatibleAbilityInfo::ConvertToAbilityInfo(AbilityInfo& abilityInfo) const abilityInfo.labelId = labelId; abilityInfo.descriptionId = descriptionId; abilityInfo.enabled = enabled; + abilityInfo.originalBundleName = bundleName; + } } // namespace AppExecFwk -} // namespace OHOS +} // namespace OHOS \ No newline at end of file diff --git a/interfaces/innerkits/appexecfwk_base/src/compatible_application_info.cpp b/interfaces/innerkits/appexecfwk_base/src/compatible_application_info.cpp index ec8bab4822..f2dbafedab 100644 --- a/interfaces/innerkits/appexecfwk_base/src/compatible_application_info.cpp +++ b/interfaces/innerkits/appexecfwk_base/src/compatible_application_info.cpp @@ -137,10 +137,13 @@ void CompatibleApplicationInfo::ConvertToApplicationInfo(ApplicationInfo& applic { APP_LOGD("CompatibleApplicationInfo::ConvertToApplicationInfo called"); applicationInfo.name = name; + applicationInfo.icon = icon; applicationInfo.label = label; applicationInfo.description = description; + applicationInfo.cpuAbi = cpuAbi; applicationInfo.process = process; - applicationInfo.isSystemApp = systemApp; + applicationInfo.systemApp = systemApp; + applicationInfo.isCompressNativeLibs = isCompressNativeLibs; applicationInfo.iconId = iconId; applicationInfo.labelId = labelId; applicationInfo.descriptionId = descriptionId; @@ -148,6 +151,7 @@ void CompatibleApplicationInfo::ConvertToApplicationInfo(ApplicationInfo& applic applicationInfo.moduleInfos = moduleInfos; applicationInfo.supportedModes = supportedModes; applicationInfo.enabled = debug; + applicationInfo.entryModuleName = ""; } } // namespace AppExecFwk -} // namespace OHOS +} // namespace OHOS \ No newline at end of file diff --git a/interfaces/innerkits/appexecfwk_base/src/hap_module_info.cpp b/interfaces/innerkits/appexecfwk_base/src/hap_module_info.cpp index e1437ccd52..55c0184a3c 100644 --- a/interfaces/innerkits/appexecfwk_base/src/hap_module_info.cpp +++ b/interfaces/innerkits/appexecfwk_base/src/hap_module_info.cpp @@ -32,6 +32,7 @@ bool HapModuleInfo::ReadFromParcel(Parcel &parcel) iconPath = Str16ToStr8(parcel.ReadString16()); label = Str16ToStr8(parcel.ReadString16()); backgroundImg = Str16ToStr8(parcel.ReadString16()); + mainAbility = Str16ToStr8(parcel.ReadString16()); supportedModes = parcel.ReadInt32(); int32_t reqCapabilitiesSize; @@ -81,6 +82,7 @@ bool HapModuleInfo::Marshalling(Parcel &parcel) const WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(iconPath)); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(label)); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(backgroundImg)); + WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String16, parcel, Str8ToStr16(mainAbility)); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, supportedModes); WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, reqCapabilities.size()); for (auto &reqCapability : reqCapabilities) { diff --git a/interfaces/innerkits/fmskit/native/src/form_host_client.cpp b/interfaces/innerkits/fmskit/native/src/form_host_client.cpp index b7db400d37..2187e886b6 100755 --- a/interfaces/innerkits/fmskit/native/src/form_host_client.cpp +++ b/interfaces/innerkits/fmskit/native/src/form_host_client.cpp @@ -12,6 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include "app_log_wrapper.h" #include "form_host_client.h" @@ -161,10 +164,10 @@ void FormHostClient::OnAcquired(const FormJsInfo &formJsInfo) } std::shared_ptr targetCallback = FindTargetCallback(formId); if (targetCallback == nullptr) { - // APP_LOGE("%{public}s error, can't find target callback. formId: %{public}lld.", __func__, formId); + APP_LOGE("%{public}s error, can't find target callback. formId: %{public}" PRId64 ".", __func__, formId); return; } - // APP_LOGI("%{public}s, formId: %{public}lld, data: %{public}s", __func__, formId, formJsInfo.formData.c_str()); + APP_LOGI("%{public}s, formId: %{public}" PRId64 ", data: %{public}s", __func__, formId, formJsInfo.formData.c_str()); targetCallback->ProcessFormUpdate(formJsInfo); } @@ -184,7 +187,7 @@ void FormHostClient::OnUpdate(const FormJsInfo &formJsInfo) } std::shared_ptr targetCallback = FindTargetCallback(formId); if (targetCallback == nullptr) { - // APP_LOGE("%{public}s error, can't find target callback. formId: %{public}lld.", __func__, formId); + APP_LOGE("%{public}s error, can't find target callback. formId: %{public}" PRId64 ".", __func__, formId); return; } targetCallback->ProcessFormUpdate(formJsInfo); @@ -210,7 +213,7 @@ void FormHostClient::OnUninstall(const std::vector &formIds) } std::shared_ptr targetCallback = FindTargetCallback(formId); if (targetCallback == nullptr) { - // APP_LOGE("%{public}s error, can't find target callback. formId: %{public}lld.", __func__, formId); + APP_LOGE("%{public}s error, can't find target callback. formId: %{public}" PRId64 ".", __func__, formId); continue; } targetCallback->ProcessFormUninstall(formId); diff --git a/interfaces/innerkits/libeventhandler/include/event_handler.h b/interfaces/innerkits/libeventhandler/include/event_handler.h index 013c5067ef..d232a1a195 100644 --- a/interfaces/innerkits/libeventhandler/include/event_handler.h +++ b/interfaces/innerkits/libeventhandler/include/event_handler.h @@ -27,7 +27,7 @@ enum class EventType { TIMING_EVENT = 2, }; -template +template class ThreadLocalData; class EventHandler : public std::enable_shared_from_this { @@ -154,7 +154,7 @@ public: * @param delayTime Process the event after 'delayTime' milliseconds. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendEvent(uint32_t innerEventId, const std::shared_ptr &object, int64_t delayTime = 0) { return SendEvent(InnerEvent::Get(innerEventId, object), delayTime); @@ -168,7 +168,7 @@ public: * @param delayTime Process the event after 'delayTime' milliseconds. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendEvent(uint32_t innerEventId, const std::weak_ptr &object, int64_t delayTime = 0) { return SendEvent(InnerEvent::Get(innerEventId, object), delayTime); @@ -182,7 +182,7 @@ public: * @param delayTime Process the event after 'delayTime' milliseconds. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendEvent(uint32_t innerEventId, std::unique_ptr &object, int64_t delayTime = 0) { return SendEvent(InnerEvent::Get(innerEventId, object), delayTime); @@ -196,7 +196,7 @@ public: * @param delayTime Process the event after 'delayTime' milliseconds. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendEvent(uint32_t innerEventId, std::unique_ptr &&object, int64_t delayTime = 0) { return SendEvent(InnerEvent::Get(innerEventId, object), delayTime); @@ -243,7 +243,7 @@ public: * @param object Shared pointer of object. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendImmediateEvent(uint32_t innerEventId, const std::shared_ptr &object) { return SendImmediateEvent(InnerEvent::Get(innerEventId, object)); @@ -256,7 +256,7 @@ public: * @param object Weak pointer of object. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendImmediateEvent(uint32_t innerEventId, const std::weak_ptr &object) { return SendImmediateEvent(InnerEvent::Get(innerEventId, object)); @@ -269,7 +269,7 @@ public: * @param object Unique pointer of object. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendImmediateEvent(uint32_t innerEventId, std::unique_ptr &object) { return SendImmediateEvent(InnerEvent::Get(innerEventId, object)); @@ -282,7 +282,7 @@ public: * @param object Unique pointer of object. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendImmediateEvent(uint32_t innerEventId, std::unique_ptr &&object) { return SendImmediateEvent(InnerEvent::Get(innerEventId, object)); @@ -333,7 +333,7 @@ public: * @param delayTime Process the event after 'delayTime' milliseconds. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendHighPriorityEvent(uint32_t innerEventId, const std::shared_ptr &object, int64_t delayTime = 0) { return SendHighPriorityEvent(InnerEvent::Get(innerEventId, object), delayTime); @@ -347,7 +347,7 @@ public: * @param delayTime Process the event after 'delayTime' milliseconds. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendHighPriorityEvent(uint32_t innerEventId, const std::weak_ptr &object, int64_t delayTime = 0) { return SendHighPriorityEvent(InnerEvent::Get(innerEventId, object), delayTime); @@ -361,7 +361,7 @@ public: * @param delayTime Process the event after 'delayTime' milliseconds. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendHighPriorityEvent(uint32_t innerEventId, std::unique_ptr &object, int64_t delayTime = 0) { return SendHighPriorityEvent(InnerEvent::Get(innerEventId, object), delayTime); @@ -375,7 +375,7 @@ public: * @param delayTime Process the event after 'delayTime' milliseconds. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendHighPriorityEvent(uint32_t innerEventId, std::unique_ptr &&object, int64_t delayTime = 0) { return SendHighPriorityEvent(InnerEvent::Get(innerEventId, object), delayTime); @@ -539,7 +539,7 @@ public: * @param priority Priority of the event queue for this event, IDLE is not permitted for sync event. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendSyncEvent( uint32_t innerEventId, const std::shared_ptr &object, Priority priority = Priority::LOW) { @@ -554,7 +554,7 @@ public: * @param priority Priority of the event queue for this event, IDLE is not permitted for sync event. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendSyncEvent(uint32_t innerEventId, const std::weak_ptr &object, Priority priority = Priority::LOW) { return SendSyncEvent(InnerEvent::Get(innerEventId, object), priority); @@ -568,7 +568,7 @@ public: * @param priority Priority of the event queue for this event, IDLE is not permitted for sync event. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendSyncEvent(uint32_t innerEventId, std::unique_ptr &object, Priority priority = Priority::LOW) { return SendSyncEvent(InnerEvent::Get(innerEventId, object), priority); @@ -582,7 +582,7 @@ public: * @param priority Priority of the event queue for this event, IDLE is not permitted for sync event. * @return Returns true if event has been sent successfully. */ - template + template inline bool SendSyncEvent(uint32_t innerEventId, std::unique_ptr &&object, Priority priority = Priority::LOW) { return SendSyncEvent(InnerEvent::Get(innerEventId, object), priority); @@ -686,7 +686,7 @@ public: * @param priority Priority of the event queue for this event * @return Returns true if event has been sent successfully. */ - template + template inline bool SendTimingEvent( uint32_t innerEventId, const std::shared_ptr &object, int64_t taskTime, Priority priority = Priority::LOW) { @@ -702,7 +702,7 @@ public: * @param priority Priority of the event queue for this event * @return Returns true if event has been sent successfully. */ - template + template inline bool SendTimingEvent( uint32_t innerEventId, const std::weak_ptr &object, int64_t taskTime, Priority priority = Priority::LOW) { @@ -718,7 +718,7 @@ public: * @param priority Priority of the event queue for this event * @return Returns true if event has been sent successfully. */ - template + template inline bool SendTimingEvent( uint32_t innerEventId, std::unique_ptr &object, int64_t taskTime, Priority priority = Priority::LOW) { @@ -734,7 +734,7 @@ public: * @param priority Priority of the event queue for this event * @return Returns true if event has been sent successfully. */ - template + template inline bool SendTimingEvent( uint32_t innerEventId, std::unique_ptr &&object, int64_t taskTime, Priority priority = Priority::LOW) { diff --git a/kits/appkit/napi/bundlemgr/bundle_mgr.cpp b/kits/appkit/napi/bundlemgr/bundle_mgr.cpp index ca96c6210f..9564744499 100644 --- a/kits/appkit/napi/bundlemgr/bundle_mgr.cpp +++ b/kits/appkit/napi/bundlemgr/bundle_mgr.cpp @@ -314,8 +314,7 @@ static void ConvertAbilityInfo(napi_env env, napi_value objAbilityInfo, const Ab NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, objAbilityInfo, "icon", nIconPath)); napi_value nsrcPath; - NAPI_CALL_RETURN_VOID( - env, napi_create_string_utf8(env, abilityInfo.srcPath.c_str(), NAPI_AUTO_LENGTH, &nsrcPath)); + NAPI_CALL_RETURN_VOID(env, napi_create_string_utf8(env, abilityInfo.srcPath.c_str(), NAPI_AUTO_LENGTH, &nsrcPath)); NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, objAbilityInfo, "srcPath", nsrcPath)); napi_value nLaunguage; @@ -528,7 +527,7 @@ static void ConvertBundleInfo(napi_env env, napi_value objBundleInfo, const Bund ConvertAbilityInfo(env, objAbilityInfo, bundleInfo.abilityInfos[idx]); NAPI_CALL_RETURN_VOID(env, napi_set_element(env, nAbilityInfos, idx, objAbilityInfo)); } - NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, objBundleInfo, "abilityInfos", nAbilityInfos)); + NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, objBundleInfo, "abilityInfo", nAbilityInfos)); napi_value nReqPermissions; NAPI_CALL_RETURN_VOID(env, napi_create_array(env, &nReqPermissions)); @@ -1072,43 +1071,6 @@ static napi_value ParseWant(napi_env env, Want &want, napi_value args) return result; } -static napi_value ParseQueryParameter(napi_env env, QueryParameter &queryParameter, napi_value args) -{ - napi_status status; - napi_valuetype valueType; - NAPI_CALL(env, napi_typeof(env, args, &valueType)); - NAPI_ASSERT(env, valueType == napi_object, "param type mismatch!"); - HILOG_INFO("-----ParseQueryParameter type-----"); - napi_value queryProp = nullptr; - status = napi_get_named_property(env, args, "params", &queryProp); - NAPI_ASSERT(env, status == napi_ok, "property name incorrect!"); - napi_typeof(env, queryProp, &valueType); - NAPI_ASSERT(env, valueType == napi_object, "property type mismatch!"); - HILOG_INFO("-----ParseQueryParameter QueryParameter-----"); - - napi_value property = nullptr; - status = napi_get_named_property(env, queryProp, "flags", &property); - NAPI_ASSERT(env, status == napi_ok, "property flags incorrect!"); - napi_typeof(env, property, &valueType); - NAPI_ASSERT(env, valueType == napi_number, "property type mismatch!"); - int flags = 0; - NAPI_CALL(env, napi_get_value_int32(env, property, &flags)); - queryParameter.flags = flags; - HILOG_INFO("ParseQueryParameter flags=%{public}d.", queryParameter.flags); - - property = nullptr; - status = napi_get_named_property(env, queryProp, "userId", &property); - NAPI_CALL(env, napi_typeof(env, property, &valueType)); - NAPI_ASSERT(env, valueType == napi_string, "Wrong argument type. String expected."); - queryParameter.userId = GetStringFromNAPI(env, property); - HILOG_INFO("ParseQueryParameter userId=%{public}s.", queryParameter.userId.c_str()); - // create result code - napi_value result; - status = napi_create_int32(env, NAPI_RETURN_ONE, &result); - NAPI_ASSERT(env, status == napi_ok, "napi_create_int32 error!"); - return result; -} - /** * Promise and async callback */ @@ -1116,8 +1078,8 @@ napi_value QueryAbilityInfo(napi_env env, napi_callback_info info) { HILOG_INFO("QueryAbilityInfo called"); - size_t argc = ARGS_SIZE_THREE; - napi_value argv[ARGS_SIZE_THREE] = {nullptr}; + size_t argc = ARGS_SIZE_FOUR; + napi_value argv[ARGS_SIZE_FOUR] = {nullptr}; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL)); HILOG_INFO("argc = [%{public}zu]", argc); Want want; @@ -1125,17 +1087,21 @@ napi_value QueryAbilityInfo(napi_env env, napi_callback_info info) HILOG_INFO("After ParseWant action=%{public}s.", want.GetAction().c_str()); HILOG_INFO("After ParseWant bundleName=%{public}s.", want.GetElement().GetBundleName().c_str()); HILOG_INFO("After ParseWant abilityName=%{public}s.", want.GetElement().GetAbilityName().c_str()); - QueryParameter queryParameter; - ParseQueryParameter(env, queryParameter, argv[PARAM1]); + int bundleFlags; + int userId; + ParseInt(env, bundleFlags, argv[PARAM1]); + ParseInt(env, userId, argv[PARAM2]); + AsyncAbilityInfoCallbackInfo *asyncCallbackInfo = new AsyncAbilityInfoCallbackInfo{.env = env, .asyncWork = nullptr, .deferred = nullptr, .want = want}; - if (argc > (ARGS_SIZE_THREE - CALLBACK_SIZE)) { + if (argc > (ARGS_SIZE_FOUR - CALLBACK_SIZE)) { HILOG_INFO("QueryAbilityInfo asyncCallback."); napi_valuetype valuetype = napi_undefined; - napi_typeof(env, argv[ARGS_SIZE_TWO], &valuetype); + napi_typeof(env, argv[ARGS_SIZE_THREE], &valuetype); NAPI_ASSERT(env, valuetype == napi_function, "Wrong argument type. Function expected."); - NAPI_CALL(env, napi_create_reference(env, argv[ARGS_SIZE_TWO], NAPI_RETURN_ONE, &asyncCallbackInfo->callback)); + NAPI_CALL( + env, napi_create_reference(env, argv[ARGS_SIZE_THREE], NAPI_RETURN_ONE, &asyncCallbackInfo->callback)); napi_value resourceName; napi_create_string_latin1(env, "QueryAbilityInfo", NAPI_AUTO_LENGTH, &resourceName); @@ -1283,7 +1249,8 @@ napi_value GetApplicationInfo(napi_env env, napi_callback_info info) napi_valuetype valuetype = napi_undefined; napi_typeof(env, argv[ARGS_SIZE_THREE], &valuetype); NAPI_ASSERT(env, valuetype == napi_function, "Wrong argument type. Function expected."); - NAPI_CALL(env, napi_create_reference(env, argv[ARGS_SIZE_THREE], NAPI_RETURN_ONE, &asyncCallbackInfo->callback)); + NAPI_CALL( + env, napi_create_reference(env, argv[ARGS_SIZE_THREE], NAPI_RETURN_ONE, &asyncCallbackInfo->callback)); napi_value resourceName; napi_create_string_latin1(env, "NAPI_GetApplicationInfoCallBack", NAPI_AUTO_LENGTH, &resourceName); @@ -2130,14 +2097,14 @@ static napi_value ParseInstallParam(napi_env env, InstallParam &installParam, na HILOG_INFO("ParseInstallParam userId=%{public}d.", installParam.userId); property = nullptr; - status = napi_get_named_property(env, installProp, "noCheckSignature", &property); - NAPI_ASSERT(env, status == napi_ok, "property noCheckSignature incorrect!"); + status = napi_get_named_property(env, installProp, "installFlag", &property); + NAPI_ASSERT(env, status == napi_ok, "property installFlag incorrect!"); napi_typeof(env, property, &valueType); - NAPI_ASSERT(env, valueType == napi_boolean, "property type mismatch!"); - bool noCheckSignature = false; - NAPI_CALL(env, napi_get_value_bool(env, property, &noCheckSignature)); - installParam.noCheckSignature = noCheckSignature; - HILOG_INFO("ParseInstallParam noCheckSignature=%{public}d.", installParam.noCheckSignature); + NAPI_ASSERT(env, valueType == napi_number, "property type mismatch!"); + int installFlag = 0; + NAPI_CALL(env, napi_get_value_int32(env, property, &installFlag)); + installParam.installFlag = static_cast(installFlag); + HILOG_INFO("ParseInstallParam installFlag=%{public}d.", installParam.installFlag); property = nullptr; status = napi_get_named_property(env, installProp, "isKeepData", &property); diff --git a/kits/appkit/napi/bundlemgr/native_module.cpp b/kits/appkit/napi/bundlemgr/native_module.cpp index 0fbea0b8bf..e89d6b8f2c 100644 --- a/kits/appkit/napi/bundlemgr/native_module.cpp +++ b/kits/appkit/napi/bundlemgr/native_module.cpp @@ -82,9 +82,9 @@ static napi_value Init(napi_env env, napi_value exports) * Propertise define */ napi_property_descriptor desc[] = { - DECLARE_NAPI_FUNCTION("getApplicationInfos", GetApplicationInfos), + DECLARE_NAPI_FUNCTION("getAllApplicationInfo", GetApplicationInfos), DECLARE_NAPI_FUNCTION("getApplicationInfo", GetApplicationInfo), - DECLARE_NAPI_FUNCTION("getBundleInfos", GetBundleInfos), + DECLARE_NAPI_FUNCTION("getAllBundleInfo", GetBundleInfos), DECLARE_NAPI_FUNCTION("getBundleInfo", GetBundleInfo), DECLARE_NAPI_FUNCTION("getBundleArchiveInfo", GetBundleArchiveInfo), DECLARE_NAPI_FUNCTION("getPermissionDef", GetPermissionDef), @@ -93,7 +93,7 @@ static napi_value Init(napi_env env, napi_value exports) DECLARE_NAPI_FUNCTION("getFormsInfoByModule", GetFormsInfoByModule), DECLARE_NAPI_FUNCTION("getFormsInfo", GetFormsInfoByApp), DECLARE_NAPI_FUNCTION("getAllFormsInfo", GetAllFormsInfo), - DECLARE_NAPI_FUNCTION("getShortcutInfos", GetShortcutInfos), + DECLARE_NAPI_FUNCTION("getAllShortcutInfo", GetShortcutInfos), DECLARE_NAPI_FUNCTION("getModuleUsageRecords", GetModuleUsageRecords), DECLARE_NAPI_FUNCTION("on", RegisterAllPermissionsChanged), DECLARE_NAPI_FUNCTION("off", UnregisterPermissionsChanged), diff --git a/services/bundlemgr/include/common_profile.h b/services/bundlemgr/include/common_profile.h index 98624b7cf3..b061ba67a2 100644 --- a/services/bundlemgr/include/common_profile.h +++ b/services/bundlemgr/include/common_profile.h @@ -119,6 +119,7 @@ const std::string BUNDLE_MODULE_PROFILE_KEY_REQ_PERMISSIONS_WHEN = "when"; const std::string BUNDLE_MODULE_PROFILE_KEY_REQ_PERMISSIONS_WHEN_INUSE = "inuse"; const std::string BUNDLE_MODULE_PROFILE_KEY_REQ_PERMISSIONS_WHEN_ALWAYS = "always"; const std::string BUNDLE_MODULE_PROFILE_KEY_CUSTOMIZE_DATA = "customizeData"; +const std::string BUNDLE_MODULE_PROFILE_KEY_MAIN_ABILITY = "mainAbility"; // sub BUNDLE_MODULE_PROFILE_KEY_DISTRO const std::string BUNDLE_MODULE_PROFILE_KEY_DELIVERY_WITH_INSTALL = "deliveryWithInstall"; const std::string BUNDLE_MODULE_PROFILE_KEY_MODULE_NAME = "moduleName"; diff --git a/services/bundlemgr/include/inner_bundle_info.h b/services/bundlemgr/include/inner_bundle_info.h index f1c6749a20..838a37b8dd 100644 --- a/services/bundlemgr/include/inner_bundle_info.h +++ b/services/bundlemgr/include/inner_bundle_info.h @@ -71,6 +71,7 @@ struct InnerModuleInfo { int32_t labelId = 0; std::string description; int32_t descriptionId = 0; + std::string mainAbility; bool isEntry; bool installationFree; MetaData metaData; diff --git a/services/bundlemgr/src/base_bundle_installer.cpp b/services/bundlemgr/src/base_bundle_installer.cpp index 023be8c65e..31d8536dd8 100755 --- a/services/bundlemgr/src/base_bundle_installer.cpp +++ b/services/bundlemgr/src/base_bundle_installer.cpp @@ -700,7 +700,7 @@ bool BaseBundleInstaller::ModifyInstallDirByHapType(InnerBundleInfo &info) bool BaseBundleInstaller::UpdateBundlePaths(InnerBundleInfo &info, const std::string baseDataPath) const { info.SetBaseDataDir(baseDataPath); - info.SetAppDataDir(baseDataPath + Constants::PATH_SEPARATOR + Constants::DATA_DIR); + info.SetAppDataDir(baseDataPath); info.SetAppDataBaseDir(baseDataPath + Constants::PATH_SEPARATOR + Constants::DATA_BASE_DIR); info.SetAppCacheDir(baseDataPath + Constants::PATH_SEPARATOR + Constants::CACHE_DIR); return true; diff --git a/services/bundlemgr/src/bundle_profile.cpp b/services/bundlemgr/src/bundle_profile.cpp index 1f53df16c4..952bcdf57e 100644 --- a/services/bundlemgr/src/bundle_profile.cpp +++ b/services/bundlemgr/src/bundle_profile.cpp @@ -273,6 +273,7 @@ struct Module { std::vector shortcuts; std::vector defPermissions; std::vector reqPermissions; + std::string mainAbility; }; // config.json @@ -1626,6 +1627,14 @@ void from_json(const nlohmann::json &jsonObject, Module &module) false, parseResult, ArrayType::OBJECT); + GetValueIfFindKey(jsonObject, + jsonObjectEnd, + BUNDLE_MODULE_PROFILE_KEY_MAIN_ABILITY, + module.mainAbility, + JsonType::STRING, + false, + parseResult, + ArrayType::NOT_ARRAY); } void from_json(const nlohmann::json &jsonObject, ConfigJson &configJson) @@ -1886,6 +1895,7 @@ bool TransformToInfo(const ProfileReader::ConfigJson &configJson, InnerModuleInf innerModuleInfo.reqCapabilities = configJson.module.reqCapabilities; innerModuleInfo.defPermissions = configJson.module.defPermissions; innerModuleInfo.reqPermissions = configJson.module.reqPermissions; + innerModuleInfo.mainAbility = configJson.module.mainAbility; return true; } diff --git a/services/bundlemgr/src/inner_bundle_info.cpp b/services/bundlemgr/src/inner_bundle_info.cpp index 5e6bd27c98..0d2f7a1556 100644 --- a/services/bundlemgr/src/inner_bundle_info.cpp +++ b/services/bundlemgr/src/inner_bundle_info.cpp @@ -58,6 +58,7 @@ const std::string MODULE_ABILITY_KEYS = "abilityKeys"; const std::string MODULE_SKILL_KEYS = "skillKeys"; const std::string MODULE_FORMS = "formInfos"; const std::string MODULE_SHORTCUT = "shortcutInfos"; +const std::string MODULE_MAIN_ABILITY = "mainAbility"; } // namespace @@ -132,7 +133,8 @@ void to_json(nlohmann::json &jsonObject, const InnerModuleInfo &info) {MODULE_REQ_PERMS, info.reqPermissions}, {MODULE_DEF_PERMS, info.defPermissions}, {MODULE_ABILITY_KEYS, info.abilityKeys}, - {MODULE_SKILL_KEYS, info.skillKeys} + {MODULE_SKILL_KEYS, info.skillKeys}, + {MODULE_MAIN_ABILITY, info.mainAbility} }; } @@ -286,6 +288,14 @@ void from_json(const nlohmann::json &jsonObject, InnerModuleInfo &info) false, ProfileReader::parseResult, ArrayType::NOT_ARRAY); + GetValueIfFindKey(jsonObject, + jsonObjectEnd, + MODULE_MAIN_ABILITY, + info.mainAbility, + JsonType::STRING, + false, + ProfileReader::parseResult, + ArrayType::NOT_ARRAY); GetValueIfFindKey(jsonObject, jsonObjectEnd, MODULE_DESCRIPTION_INSTALLATION_FREE, @@ -742,6 +752,7 @@ std::optional InnerBundleInfo::FindHapModuleInfo(const std::strin hapInfo.supportedModes = baseApplicationInfo_.supportedModes; hapInfo.reqCapabilities = it->second.reqCapabilities; hapInfo.colorMode = it->second.colorMode; + hapInfo.mainAbility = it->second.mainAbility; bool first = false; for (auto &ability : baseAbilityInfos_) { if (ability.first.find(modulePackage) != std::string::npos) { diff --git a/services/formmgr/include/form_ability_connection.h b/services/formmgr/include/form_ability_connection.h index 8e1542ad60..8794c9ffa7 100644 --- a/services/formmgr/include/form_ability_connection.h +++ b/services/formmgr/include/form_ability_connection.h @@ -71,7 +71,7 @@ public: // std::string GetProviderKey(); private: - //int64_t formId_; + int64_t formId_; std::string deviceId_; std::string bundleName_; std::string abilityName_; diff --git a/services/formmgr/src/form_ability_connection.cpp b/services/formmgr/src/form_ability_connection.cpp index 8a246648ce..2550f42fb4 100644 --- a/services/formmgr/src/form_ability_connection.cpp +++ b/services/formmgr/src/form_ability_connection.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_ability_connection.h" @@ -35,8 +37,8 @@ void FormAbilityConnection::OnAbilityConnectDone( const AppExecFwk::ElementName &element, const sptr &remoteObject, int resultCode) { if (resultCode != ERR_OK) { - // APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}lld, resultCode:%{public}d", - // __func__, element.GetAbilityName().c_str(), formId_, resultCode); + APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}" PRId64 ", resultCode:%{public}d", + __func__, element.GetAbilityName().c_str(), formId_, resultCode); return; } // deviceId_ = element.GetDeviceID(); diff --git a/services/formmgr/src/form_acquire_connection.cpp b/services/formmgr/src/form_acquire_connection.cpp index 896350a3cc..282dd320de 100644 --- a/services/formmgr/src/form_acquire_connection.cpp +++ b/services/formmgr/src/form_acquire_connection.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_acquire_connection.h" @@ -45,8 +47,8 @@ void FormAcquireConnection::OnAbilityConnectDone( { APP_LOGI("%{public}s called.", __func__); if (resultCode != ERR_OK) { - //APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}lld, resultCode:%{public}d", - // __func__, element.GetAbilityName().c_str(), formId_, resultCode); + APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}" PRId64 ", resultCode:%{public}d", + __func__, element.GetAbilityName().c_str(), formId_, resultCode); return; } FormSupplyCallback::GetInstance()->AddConnection(this); diff --git a/services/formmgr/src/form_cast_temp_connection.cpp b/services/formmgr/src/form_cast_temp_connection.cpp index ea4cb82ceb..32b833d530 100644 --- a/services/formmgr/src/form_cast_temp_connection.cpp +++ b/services/formmgr/src/form_cast_temp_connection.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_cast_temp_connection.h" @@ -40,8 +42,8 @@ void FormCastTempConnection::OnAbilityConnectDone( { APP_LOGI("%{public}s called.", __func__); if (resultCode != ERR_OK) { - //APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}lld, resultCode:%{public}d", - // __func__, element.GetAbilityName().c_str(), formId_, resultCode); + APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}" PRId64 ", resultCode:%{public}d", + __func__, element.GetAbilityName().c_str(), formId_, resultCode); return; } FormSupplyCallback::GetInstance()->AddConnection(this); diff --git a/services/formmgr/src/form_data_mgr.cpp b/services/formmgr/src/form_data_mgr.cpp index a68cbe655c..de464fcadd 100644 --- a/services/formmgr/src/form_data_mgr.cpp +++ b/services/formmgr/src/form_data_mgr.cpp @@ -12,6 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_cache_mgr.h" @@ -914,14 +917,14 @@ const bool flag, std::vector &refreshForms) if (callerToken == itHostRecord->GetClientStub()) { for (const int64_t formId : formIds) { if (formId <= 0) { - //APP_LOGW("%{public}s, formId %{public}lld is less than 0", __func__, formId); + APP_LOGW("%{public}s, formId %{public}" PRId64 " is less than 0", __func__, formId); continue; } int64_t matchedFormId = FindMatchedFormId(formId); if (!itHostRecord->Contains(matchedFormId)) { - // APP_LOGW("%{public}s, form %{public}lld is not owned by this client, don't need to update flag", - // __func__, formId); + APP_LOGW("%{public}s, form %{public}" PRId64 " is not owned by this client, don't need to update flag", + __func__, formId); continue; } @@ -939,7 +942,7 @@ const bool flag, std::vector &refreshForms) continue; } } else { - //APP_LOGW("%{public}s, not exist such form:%{public}lld", __func__, matchedFormId); + APP_LOGW("%{public}s, not exist such form:%{public}" PRId64 "", __func__, matchedFormId); continue; } diff --git a/services/formmgr/src/form_db_cache.cpp b/services/formmgr/src/form_db_cache.cpp index 02fd0bba24..a866048f6f 100644 --- a/services/formmgr/src/form_db_cache.cpp +++ b/services/formmgr/src/form_db_cache.cpp @@ -69,17 +69,17 @@ void FormDbCache::Start() */ ErrCode FormDbCache::SaveFormInfo(const FormDBInfo &formDBInfo) { - //APP_LOGI("%{public}s called, formId:%{public}lld", __func__, formDBInfo.formId); + APP_LOGI("%{public}s called, formId:%{public}" PRId64 "", __func__, formDBInfo.formId); std::lock_guard lock(formDBInfosMutex_); auto iter = find(formDBInfos_.begin(), formDBInfos_.end(), formDBInfo); if (iter != formDBInfos_.end()) { if (iter->Compare(formDBInfo) == false) { - //APP_LOGW("%{public}s, need update, formId[%{public}lld].", __func__, formDBInfo.formId); + APP_LOGW("%{public}s, need update, formId[%{public}" PRId64 "].", __func__, formDBInfo.formId); *iter = formDBInfo; InnerFormInfo innerFormInfo(formDBInfo); return dataStorage_->ModifyStorageFormInfo(innerFormInfo); } else { - //APP_LOGW("%{public}s, already exist, formId[%{public}lld].", __func__, formDBInfo.formId); + APP_LOGW("%{public}s, already exist, formId[%{public}" PRId64 "].", __func__, formDBInfo.formId); return ERR_OK; } } else { @@ -96,16 +96,16 @@ ErrCode FormDbCache::SaveFormInfo(const FormDBInfo &formDBInfo) */ ErrCode FormDbCache::SaveFormInfoNolock(const FormDBInfo &formDBInfo) { - //APP_LOGI("%{public}s called, formId:%{public}lld", __func__, formDBInfo.formId); + APP_LOGI("%{public}s called, formId:%{public}" PRId64 "", __func__, formDBInfo.formId); auto iter = find(formDBInfos_.begin(), formDBInfos_.end(), formDBInfo); if (iter != formDBInfos_.end()) { if (iter->Compare(formDBInfo) == false) { - //APP_LOGW("%{public}s, need update, formId[%{public}lld].", __func__, formDBInfo.formId); + APP_LOGW("%{public}s, need update, formId[%{public}" PRId64 "].", __func__, formDBInfo.formId); *iter = formDBInfo; InnerFormInfo innerFormInfo(formDBInfo); return dataStorage_->ModifyStorageFormInfo(innerFormInfo); } else { - //APP_LOGW("%{public}s, already exist, formId[%{public}lld].", __func__, formDBInfo.formId); + APP_LOGW("%{public}s, already exist, formId[%{public}" PRId64 "].", __func__, formDBInfo.formId); return ERR_OK; } } else { @@ -127,7 +127,7 @@ ErrCode FormDbCache::DeleteFormInfo(int64_t formId) tmpForm.formId = formId; auto iter = find(formDBInfos_.begin(), formDBInfos_.end(), tmpForm); if (iter == formDBInfos_.end()) { - //APP_LOGW("%{public}s, not find formId[%{public}lld]", __func__, formId); + APP_LOGW("%{public}s, not find formId[%{public}" PRId64 "]", __func__, formId); } else { formDBInfos_.erase(iter); } @@ -207,7 +207,7 @@ ErrCode FormDbCache::GetDBRecord(const int64_t formId, FormRecord &record) const return ERR_OK; } } - //APP_LOGE("%{public}s, not find formId[%{public}lld]", __func__, formId); + APP_LOGE("%{public}s, not find formId[%{public}" PRId64 "]", __func__, formId); return ERR_APPEXECFWK_FORM_DBCACHE_FIND_FAIL; } /** @@ -225,7 +225,7 @@ ErrCode FormDbCache::GetDBRecord(const int64_t formId, FormDBInfo &record) const return ERR_OK; } } - // APP_LOGE("%{public}s, not find formId[%{public}lld]", __func__, formId); + APP_LOGE("%{public}s, not find formId[%{public}" PRId64 "]", __func__, formId); return ERR_APPEXECFWK_FORM_DBCACHE_FIND_FAIL; } /** diff --git a/services/formmgr/src/form_delete_connection.cpp b/services/formmgr/src/form_delete_connection.cpp index c453d9a534..40312f1bee 100755 --- a/services/formmgr/src/form_delete_connection.cpp +++ b/services/formmgr/src/form_delete_connection.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_constants.h" @@ -41,8 +43,8 @@ void FormDeleteConnection::OnAbilityConnectDone( { APP_LOGI("%{public}s called.", __func__); if (resultCode != ERR_OK) { - //APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}lld, resultCode:%{public}d", - // __func__, element.GetAbilityName().c_str(), formId_, resultCode); + APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}" PRId64 ", resultCode:%{public}d", + __func__, element.GetAbilityName().c_str(), formId_, resultCode); return; } FormSupplyCallback::GetInstance()->AddConnection(this); diff --git a/services/formmgr/src/form_host_callback.cpp b/services/formmgr/src/form_host_callback.cpp index 6e2fe42a34..2bcae1eb59 100644 --- a/services/formmgr/src/form_host_callback.cpp +++ b/services/formmgr/src/form_host_callback.cpp @@ -13,6 +13,8 @@ * limitations under the License. */ +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_host_callback.h" @@ -32,7 +34,7 @@ namespace AppExecFwk { void FormHostCallback::OnAcquired(const int64_t formId, const FormRecord& record, const sptr &callerToken) { - //APP_LOGD("FormHostCallback OnAcquired, formId:%{public}lld", formId); + APP_LOGD("FormHostCallback OnAcquired, formId:%{public}" PRId64 "", formId); FormTaskMgr::GetInstance().PostAcquireTaskToHost(formId, record, callerToken); } @@ -50,7 +52,7 @@ void FormHostCallback::OnUpdate(const int64_t formId, const FormRecord &record, // check formId if (formId < 0) { - //APP_LOGE("%{public}s: OnUpdate invalid param, formId:%{public}lld.", __func__, formId); + APP_LOGE("%{public}s: OnUpdate invalid param, formId:%{public}" PRId64 ".", __func__, formId); return; } diff --git a/services/formmgr/src/form_mgr_adapter.cpp b/services/formmgr/src/form_mgr_adapter.cpp index 6d8df294d6..e04e546bc9 100644 --- a/services/formmgr/src/form_mgr_adapter.cpp +++ b/services/formmgr/src/form_mgr_adapter.cpp @@ -13,6 +13,8 @@ * limitations under the License. */ +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_acquire_connection.h" @@ -80,7 +82,7 @@ FormJsInfo &formInfo) int checkCode; if (tempFormFlag) { if (formId > 0) { - //APP_LOGE("%{public}s fail, temp form id is invalid, formId:%{public}lld", __func__, formId); + APP_LOGE("%{public}s fail, temp form id is invalid, formId:%{public}" PRId64 "", __func__, formId); return ERR_APPEXECFWK_FORM_INVALID_PARAM; } checkCode = FormDataMgr::GetInstance().CheckTempEnoughForm(); @@ -188,7 +190,7 @@ ErrCode FormMgrAdapter::HandleReleaseForm(const int64_t formId, const sptr int64_t matchedFormId = FormDataMgr::GetInstance().FindMatchedFormId(formId); if (!FormDataMgr::GetInstance().ExistFormRecord(matchedFormId)) { - //APP_LOGE("%{public}s fail, not exist such formId:%{public}lld.", __func__, matchedFormId); + APP_LOGE("%{public}s fail, not exist such formId:%{public}" PRId64 ".", __func__, matchedFormId); return ERR_NOT_EXIST_ID; } @@ -486,27 +488,27 @@ const sptr &callerToken, std::map> eventMaps; for (int64_t formId : formIds) { if (formId <= 0) { - //APP_LOGW("%{public}s, formId %{public}lld is less than 0", __func__, formId); + APP_LOGW("%{public}s, formId %{public}" PRId64 " is less than 0", __func__, formId); continue; } matchedFormId = FormDataMgr::GetInstance().FindMatchedFormId(formId); FormRecord formRecord; if (!FormDataMgr::GetInstance().GetFormRecord(matchedFormId, formRecord)) { - //APP_LOGW("%{public}s fail, not exist such form, formId:%{public}lld.", __func__, matchedFormId); + APP_LOGW("%{public}s fail, not exist such form, formId:%{public}" PRId64 ".", __func__, matchedFormId); continue; } FormHostRecord formHostRecord; bool hasFormHostRecord = FormDataMgr::GetInstance().GetMatchedHostClient(callerToken, formHostRecord); if (!(hasFormHostRecord && formHostRecord.Contains(matchedFormId))) { - //APP_LOGW("%{public}s fail, form is not belong to self, formId:%{public}lld.", __func__, matchedFormId); + APP_LOGW("%{public}s fail, form is not belong to self, formId:%{public}" PRId64 ".", __func__, matchedFormId); continue; } formRecord.formVisibleNotifyState = formVisibleType; if (!FormDataMgr::GetInstance().UpdateFormRecord(matchedFormId, formRecord)) { - //APP_LOGW("%{public}s fail, set formVisibleNotifyState error, formId:%{public}lld.", - //__func__, matchedFormId); + APP_LOGW("%{public}s fail, set formVisibleNotifyState error, formId:%{public}" PRId64 ".", + __func__, matchedFormId); continue; } @@ -526,7 +528,7 @@ const sptr &callerToken, if (iBundleMgr->GetBundleInfo(formRecord.bundleName, BundleFlag::GET_BUNDLE_DEFAULT, bundleInfo)) { APP_LOGD("%{public}s, get bundle uid success", __func__); if (!iBundleMgr->CheckIsSystemAppByUid(bundleInfo.uid)) { - //APP_LOGW("%{public}s fail, form provider is not system app, formId:%{public}lld.", __func__, matchedFormId); + APP_LOGW("%{public}s fail, form provider is not system app, formId:%{public}" PRId64 ".", __func__, matchedFormId); continue; } } else { @@ -534,8 +536,8 @@ const sptr &callerToken, continue; } if (!formRecord.formVisibleNotify) { - //APP_LOGW("%{public}s fail, the config item 'formVisibleNotify' is false, formId:%{public}lld.", - //__func__, matchedFormId); + APP_LOGW("%{public}s fail, the config item 'formVisibleNotify' is false, formId:%{public}" PRId64 ".", + __func__, matchedFormId); continue; } @@ -573,27 +575,27 @@ int FormMgrAdapter::CastTempForm(const int64_t formId, const sptr int64_t matchedFormId = FormDataMgr::GetInstance().FindMatchedFormId(formId); if (!FormDataMgr::GetInstance().ExistFormRecord(matchedFormId) || !FormDataMgr::GetInstance().ExistTempForm(matchedFormId)) { - //APP_LOGE("%{public}s, not exist such temp form:%{public}lld", __func__, matchedFormId); + APP_LOGE("%{public}s, not exist such temp form:%{public}" PRId64 "", __func__, matchedFormId); return ERR_NOT_EXIST_ID; } FormHostRecord record; bool hasHostRec = FormDataMgr::GetInstance().GetFormHostRecord(matchedFormId, record); if (!hasHostRec || !record.Contains(matchedFormId)) { - //APP_LOGE("%{public}s, not self form:%{public}lld", __func__, matchedFormId); + APP_LOGE("%{public}s, not self form:%{public}" PRId64 "", __func__, matchedFormId); return ERR_OPERATION_FORM_NOT_SELF; } int callingUid = IPCSkeleton::GetCallingUid(); int checkCode = FormDataMgr::GetInstance().CheckEnoughForm(callingUid); if (checkCode != 0) { - //APP_LOGE("%{public}s, %{public}lld failed,because if too mush forms", __func__, matchedFormId); + APP_LOGE("%{public}s, %{public}" PRId64 " failed,because if too mush forms", __func__, matchedFormId); return checkCode; } FormRecord formRecord; if (!FormDataMgr::GetInstance().GetFormRecord(matchedFormId, formRecord)) { - //APP_LOGE("%{public}s fail, not exist such form:%{public}lld.", __func__, matchedFormId); + APP_LOGE("%{public}s fail, not exist such form:%{public}" PRId64 ".", __func__, matchedFormId); return ERR_NOT_EXIST_ID; } int bindSupplierCheckCode = HandleCastTempForm(matchedFormId, formRecord); @@ -603,15 +605,15 @@ int FormMgrAdapter::CastTempForm(const int64_t formId, const sptr } if (!FormDataMgr::GetInstance().DeleteTempForm(matchedFormId)) { - //APP_LOGE("%{public}s fail, delete temp form error, formId:%{public}lld.", __func__, matchedFormId); + APP_LOGE("%{public}s fail, delete temp form error, formId:%{public}" PRId64 ".", __func__, matchedFormId); return ERR_APPEXECFWK_FORM_INFO_NOT_EXIST; } if (!FormDataMgr::GetInstance().ModifyFormTempFlg(matchedFormId, false)) { - //APP_LOGE("%{public}s fail, modify form temp flag error, formId:%{public}lld.", __func__, matchedFormId); + APP_LOGE("%{public}s fail, modify form temp flag error, formId:%{public}" PRId64 ".", __func__, matchedFormId); return ERR_APPEXECFWK_FORM_INFO_NOT_EXIST; } if (!FormDataMgr::GetInstance().AddFormUserUid(matchedFormId, callingUid)) { - //APP_LOGE("%{public}s fail, add form user uid error, formId:%{public}lld.", __func__, matchedFormId); + APP_LOGE("%{public}s fail, add form user uid error, formId:%{public}" PRId64 ".", __func__, matchedFormId); return ERR_APPEXECFWK_FORM_INFO_NOT_EXIST; } if (std::find(formRecord.formUserUids.begin(), formRecord.formUserUids.end(), @@ -619,7 +621,7 @@ int FormMgrAdapter::CastTempForm(const int64_t formId, const sptr formRecord.formUserUids.emplace_back(callingUid); } if (ErrCode errorCode = FormDbCache::GetInstance().UpdateDBRecord(matchedFormId, formRecord); errorCode != ERR_OK) { - //APP_LOGE("%{public}s fail, update db record error, formId:%{public}lld.", __func__, matchedFormId); + APP_LOGE("%{public}s fail, update db record error, formId:%{public}" PRId64 ".", __func__, matchedFormId); return errorCode; } @@ -760,7 +762,7 @@ const WantParams &wantParams, FormJsInfo &formInfo) if (hasRecord && FormDataMgr::GetInstance().IsCallingUidValid(record.formUserUids)) { if (!info.IsMatch(record)) { - //APP_LOGE("%{public}s, formId and item info not match:%{public}lld", __func__, formId); + APP_LOGE("%{public}s, formId and item info not match:%{public}" PRId64 "", __func__, formId); return ERR_CFG_NOT_MATCH_ID; } return AddExistFormRecord(info, callerToken, record, formId, wantParams); @@ -773,7 +775,7 @@ const WantParams &wantParams, FormJsInfo &formInfo) return AddNewFormRecord(info, formId, callerToken, wantParams, formInfo); } - //APP_LOGI("%{public}s, addForm no such form %{public}lld", __func__, formId); + APP_LOGI("%{public}s, addForm no such form %{public}" PRId64 "", __func__, formId); // delete form data in provider FormRecord delRecord; @@ -794,7 +796,7 @@ int64_t FormMgrAdapter::PaddingUDIDHash(const int64_t formId) const ErrCode FormMgrAdapter::AddExistFormRecord(const FormItemInfo &info, const sptr &callerToken, const FormRecord &record, const int64_t formId, const WantParams &wantParams) { - //APP_LOGI("%{public}s call, formId:%{public}lld", __func__, formId); + APP_LOGI("%{public}s call, formId:%{public}" PRId64 "", __func__, formId); // allot form host record int callingUid = IPCSkeleton::GetCallingUid(); bool isCreated = FormDataMgr::GetInstance().AllotFormHostRecord(info, callerToken, formId, callingUid); @@ -849,7 +851,7 @@ const WantParams &wantParams, FormJsInfo &formInfo) APP_LOGE("%{public}s fail, generateFormId no invalid formId", __func__); return ERR_APPEXECFWK_FORM_COMMON_CODE; } - //APP_LOGD("newFormId:%{public}lld", newFormId); + APP_LOGD("newFormId:%{public}" PRId64 "", newFormId); return AddNewFormRecord(info, newFormId, callerToken, wantParams, formInfo); } @@ -1182,7 +1184,7 @@ FormItemInfo &itemInfo) itemInfo.SetAbilityModuleName(abilityInfo.moduleName); } } - //APP_LOGI("%{public}s moduleInfos size: %{public}d", __func__, bundleInfo.applicationInfo.moduleInfos.size()); + APP_LOGI("%{public}s moduleInfos size: %{public}zu", __func__, bundleInfo.applicationInfo.moduleInfos.size()); for (const auto &item : bundleInfo.applicationInfo.moduleInfos) { APP_LOGI("%{public}s moduleInfos, moduleName: %{public}s, moduleSourceDir: %{public}s", __func__, item.moduleName.c_str(), item.moduleSourceDir.c_str()); if (formInfo.moduleName == item.moduleName) { @@ -1201,7 +1203,7 @@ FormItemInfo &itemInfo) */ int FormMgrAdapter::SetNextRefreshTime(const int64_t formId, const int64_t nextTime) { - //APP_LOGI("%{public}s begin here, formId:%{public}lld,nextTime:%{public}lld", __func__, formId, nextTime); + APP_LOGI("%{public}s begin here, formId:%{public}" PRId64 ",nextTime:%{public}" PRId64 "", __func__, formId, nextTime); if (formId <= 0) { APP_LOGE("%{public}s form formId or bundleName is invalid", __func__); return ERR_FORM_INVALID_PARAM; @@ -1345,7 +1347,7 @@ int FormMgrAdapter::MessageEvent(const int64_t formId, const Want &want, const s FormRecord record; bool bGetRecord = FormDataMgr::GetInstance().GetFormRecord(matchedFormId, record); if (!bGetRecord) { - //APP_LOGE("%{public}s fail, not exist such form:%{public}lld", __func__, matchedFormId); + APP_LOGE("%{public}s fail, not exist such form:%{public}" PRId64 "", __func__, matchedFormId); return ERR_APPEXECFWK_FORM_INFO_NOT_EXIST; } @@ -1377,7 +1379,7 @@ bool flag) int errCode = FormDataMgr::GetInstance().UpdateHostFormFlag(formIds, callerToken, flag, refreshForms); if (errCode == ERR_OK && refreshForms.size() > 0) { for (const int64_t id : refreshForms) { - //APP_LOGI("%{public}s, formRecord need refresh: %{public}lld", __func__, id); + APP_LOGI("%{public}s, formRecord need refresh: %{public}" PRId64 "", __func__, id); Want want; FormProviderMgr::GetInstance().RefreshForm(id, want); } diff --git a/services/formmgr/src/form_msg_event_connection.cpp b/services/formmgr/src/form_msg_event_connection.cpp index 802ad191aa..3b3c13dc41 100644 --- a/services/formmgr/src/form_msg_event_connection.cpp +++ b/services/formmgr/src/form_msg_event_connection.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_constants.h" @@ -45,8 +47,8 @@ void FormMsgEventConnection::OnAbilityConnectDone( APP_LOGI("%{public}s called.", __func__); if (resultCode != ERR_OK) { - // APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}lld, resultCode:%{public}d", - // __func__, element.GetAbilityName().c_str(), formId_, resultCode); + APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}" PRId64 ", resultCode:%{public}d", + __func__, element.GetAbilityName().c_str(), formId_, resultCode); return; } FormSupplyCallback::GetInstance()->AddConnection(this); diff --git a/services/formmgr/src/form_provider_mgr.cpp b/services/formmgr/src/form_provider_mgr.cpp index c93cc3f36f..129597ad6d 100644 --- a/services/formmgr/src/form_provider_mgr.cpp +++ b/services/formmgr/src/form_provider_mgr.cpp @@ -12,6 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_ams_helper.h" @@ -39,7 +42,7 @@ FormProviderMgr::~FormProviderMgr(){} */ ErrCode FormProviderMgr::AcquireForm(const int64_t formId, const FormProviderInfo &formProviderInfo) { - //APP_LOGD("%{public}s start, formId:%{public}lld", __func__, formId); + APP_LOGD("%{public}s start, formId:%{public}" PRId64 "", __func__, formId); if (formId <= 0) { APP_LOGE("%{public}s fail, formId should be greater than 0", __func__); @@ -49,7 +52,7 @@ ErrCode FormProviderMgr::AcquireForm(const int64_t formId, const FormProviderInf FormRecord formRecord; bool isGetFormRecord = FormDataMgr::GetInstance().GetFormRecord(formId, formRecord); if (!isGetFormRecord) { - //APP_LOGE("%{public}s fail, not exist such form, formId:%{public}lld", __func__, formId); + APP_LOGE("%{public}s fail, not exist such form, formId:%{public}" PRId64 "", __func__, formId); return ERR_APPEXECFWK_FORM_INFO_NOT_EXIST; } @@ -100,11 +103,11 @@ ErrCode FormProviderMgr::AcquireForm(const int64_t formId, const FormProviderInf */ ErrCode FormProviderMgr::RefreshForm(const int64_t formId, const Want &want) { - //APP_LOGI("%{public}s called, formId:%{public}lld.", __func__, formId); + APP_LOGI("%{public}s called, formId:%{public}" PRId64 ".", __func__, formId); FormRecord record; bool bGetRecord = FormDataMgr::GetInstance().GetFormRecord(formId, record); if (!bGetRecord) { - //APP_LOGE("%{public}s fail, not exist such form:%{public}lld", __func__, formId); + APP_LOGE("%{public}s fail, not exist such form:%{public}" PRId64 "", __func__, formId); return ERR_APPEXECFWK_FORM_INFO_NOT_EXIST; } @@ -250,7 +253,7 @@ ErrCode FormProviderMgr::UpdateForm(const int64_t formId, const FormProviderInfo // check exist and get the formRecord FormRecord formRecord; if (!FormDataMgr::GetInstance().GetFormRecord(formId, formRecord)) { - //APP_LOGE("%{public}s error, not exist such form:%{public}lld.", __func__, formId); + APP_LOGE("%{public}s error, not exist such form:%{public}" PRId64 ".", __func__, formId); return ERR_NOT_EXIST_ID; } return UpdateForm(formId, formRecord, formProviderInfo.GetFormData()); @@ -309,7 +312,7 @@ const FormProviderData &formProviderData) */ int FormProviderMgr::MessageEvent(const int64_t formId, const FormRecord &record, const Want &want) { - //APP_LOGI("%{public}s called, formId:%{public}lld.", __func__, formId); + APP_LOGI("%{public}s called, formId:%{public}" PRId64 ".", __func__, formId); bool screenOnFlag = PowerMgr::PowerMgrClient::GetInstance().IsScreenOn(); if (!screenOnFlag) { @@ -340,7 +343,7 @@ void FormProviderMgr::IncreaseTimerRefreshCount(const int64_t formId) { FormRecord record; if (FormDataMgr::GetInstance().GetFormRecord(formId, record)) { - //APP_LOGE("%{public}s failed, not exist such form:%{public}lld.", __func__, formId); + APP_LOGE("%{public}s failed, not exist such form:%{public}" PRId64 ".", __func__, formId); return; } diff --git a/services/formmgr/src/form_refresh_connection.cpp b/services/formmgr/src/form_refresh_connection.cpp index 362da9f41e..8c676b204b 100644 --- a/services/formmgr/src/form_refresh_connection.cpp +++ b/services/formmgr/src/form_refresh_connection.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_constants.h" @@ -45,8 +47,8 @@ void FormRefreshConnection::OnAbilityConnectDone( APP_LOGI("%{public}s called.", __func__); if (resultCode != ERR_OK) { - // APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}lld, resultCode:%{public}d", - // __func__, element.GetAbilityName().c_str(), formId_, resultCode); + APP_LOGE("%{public}s, abilityName:%{public}s, formId:%{public}" PRId64 ", resultCode:%{public}d", + __func__, element.GetAbilityName().c_str(), formId_, resultCode); return; } FormSupplyCallback::GetInstance()->AddConnection(this); diff --git a/services/formmgr/src/form_refresh_limiter.cpp b/services/formmgr/src/form_refresh_limiter.cpp index e5208a1370..b0c8143501 100644 --- a/services/formmgr/src/form_refresh_limiter.cpp +++ b/services/formmgr/src/form_refresh_limiter.cpp @@ -12,6 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include "app_log_wrapper.h" #include "form_constants.h" #include "form_refresh_limiter.h" @@ -85,7 +88,7 @@ bool FormRefreshLimiter::IsEnableRefresh(const int64_t formId) if (info->second.refreshCount == Constants::LIMIT_COUNT && !info->second.isReported) { info->second.isReported = true; - //APP_LOGI("report refresh to 50 count,formId:%{public}lld", formId); + APP_LOGI("report refresh to 50 count,formId:%{public}" PRId64 "", formId); } } APP_LOGI("%{public}s end", __func__); @@ -120,10 +123,10 @@ void FormRefreshLimiter::Increase(const int64_t formId) auto info = limiterMap_.find(formId); if (info != limiterMap_.end()) { info->second.refreshCount++; - //APP_LOGI("increase,formId:%{public}lld, count:%{public}d", formId, info->second.refreshCount); + APP_LOGI("increase,formId:%{public}" PRId64 ", count:%{public}d", formId, info->second.refreshCount); if (info->second.refreshCount == Constants::LIMIT_COUNT && !info->second.isReported) { info->second.isReported = true; - // APP_LOGI("report refresh to 50 count,formId:%{public}lld", formId); + APP_LOGI("report refresh to 50 count,formId:%{public}" PRId64 "", formId); } } APP_LOGI("%{public}s end", __func__); diff --git a/services/formmgr/src/form_storage_mgr.cpp b/services/formmgr/src/form_storage_mgr.cpp index 1aeecc4086..6f329ff712 100644 --- a/services/formmgr/src/form_storage_mgr.cpp +++ b/services/formmgr/src/form_storage_mgr.cpp @@ -13,6 +13,8 @@ * limitations under the License. */ +#include + #include #include #include @@ -212,7 +214,7 @@ ErrCode FormStorageMgr::GetStorageFormInfoById(const std::string &formId, InnerF */ ErrCode FormStorageMgr::SaveStorageFormInfo(const InnerFormInfo &innerFormInfo) const { - //APP_LOGI("%{public}s called, formId[%{public}lld]", __func__, innerFormInfo.GetFormId()); + APP_LOGI("%{public}s called, formId[%{public}" PRId64 "]", __func__, innerFormInfo.GetFormId()); ErrCode ret = ERR_OK; std::string formId = std::to_string(innerFormInfo.GetFormId()); @@ -269,9 +271,9 @@ ErrCode FormStorageMgr::SaveStorageFormInfo(const InnerFormInfo &innerFormInfo) */ ErrCode FormStorageMgr::ModifyStorageFormInfo(const InnerFormInfo &innerFormInfo) const { - //APP_LOGI("%{public}s called, formId[%{public}lld]", __func__, innerFormInfo.GetFormId()); + APP_LOGI("%{public}s called, formId[%{public}" PRId64 "]", __func__, innerFormInfo.GetFormId()); char fileNamePath[FORM_DB_DATA_BASE_FILE_PATH_LEN] = {0}; - //sprintf(fileNamePath, "%s/%lld.json", FORM_DB_DATA_BASE_FILE_DIR, innerFormInfo.GetFormId()); + sprintf(fileNamePath, "%s/%" PRId64 ".json", FORM_DB_DATA_BASE_FILE_DIR, innerFormInfo.GetFormId()); std::ofstream o(fileNamePath, std::ios_base::trunc | std::ios_base::out); if (!o.is_open()) { diff --git a/services/formmgr/src/form_supply_callback.cpp b/services/formmgr/src/form_supply_callback.cpp index 83383e4085..9a240bf1d5 100644 --- a/services/formmgr/src/form_supply_callback.cpp +++ b/services/formmgr/src/form_supply_callback.cpp @@ -13,6 +13,8 @@ * limitations under the License. */ +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "form_ams_helper.h" @@ -55,8 +57,8 @@ int FormSupplyCallback::OnAcquire(const FormProviderInfo &formProviderInfo, cons int64_t formId = formProviderInfo.GetFormId(); int type = want.GetIntParam(Constants::ACQUIRE_TYPE, 0); - // APP_LOGD("%{public}s come: %{public}lld, %{public}ld, %{public}d", __func__, - // formId, connectId, type); + APP_LOGD("%{public}s come: %{public}" PRId64 ", %{public}ld, %{public}d", __func__, + formId, connectId, type); RemoveConnection(connectId); switch (type) { diff --git a/services/formmgr/src/form_sys_event_receiver.cpp b/services/formmgr/src/form_sys_event_receiver.cpp index e3cc46ee1e..33f9405380 100644 --- a/services/formmgr/src/form_sys_event_receiver.cpp +++ b/services/formmgr/src/form_sys_event_receiver.cpp @@ -12,6 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "bundle_info.h" @@ -244,7 +247,7 @@ void FormSysEventReceiver::ClearFormDBRecordData(const int uid, std::map 0) { BatchDeleteNoHostDBForms(uid, noHostFormDbMap, foundFormsMap); } @@ -258,7 +261,7 @@ void FormSysEventReceiver::ClearTempFormRecordData(const int uid, std::map foundFormsMap; std::map> noHostTempFormsMap; FormDataMgr::GetInstance().GetNoHostTempForms(uid, noHostTempFormsMap, foundFormsMap); - //APP_LOGD("%{public}s, noHostTempFormsMap size:%{public}d", __func__, noHostTempFormsMap.size()); + APP_LOGD("%{public}s, noHostTempFormsMap size:%{public}zu", __func__, noHostTempFormsMap.size()); if (noHostTempFormsMap.size() > 0) { BatchDeleteNoHostTempForms(uid, noHostTempFormsMap, foundFormsMap); } @@ -343,12 +346,12 @@ std::set> &noHostTempFormsMap, std::map &foundFormsMap) } void FormSysEventReceiver::ReCreateForm(const int64_t formId) { - //APP_LOGI("%{public}s start, formId:%{public}lld", __func__, formId); + APP_LOGI("%{public}s start, formId:%{public}" PRId64 "", __func__, formId); FormRecord reCreateRecord; FormRecord record; bool isGetForm = FormDataMgr::GetInstance().GetFormRecord(formId, record); if (!isGetForm) { - //APP_LOGE("%{public}s error, not exist such form:%{public}lld", __func__, formId); + APP_LOGE("%{public}s error, not exist such form:%{public}" PRId64 "", __func__, formId); return; } FormCacheMgr::GetInstance().DeleteData(formId); @@ -443,7 +446,7 @@ const FormTimerCfg &timerCfg) FormDataMgr::GetInstance().SetUpdateInfo(formId, true, timerCfg.updateDuration, timerCfg.updateAtHour, timerCfg.updateAtMin); if (timerCfg.updateDuration > 0) { - //APP_LOGI("%{public}s, add interval timer:%{public}lld", __func__, timerCfg.updateDuration); + APP_LOGI("%{public}s, add interval timer:%{public}" PRId64 "", __func__, timerCfg.updateDuration); FormTimerMgr::GetInstance().AddFormTimer(formId, timerCfg.updateDuration); } else { APP_LOGI("%{public}s, add at timer:%{public}d, %{public}d", __func__, timerCfg.updateAtHour, diff --git a/services/formmgr/src/form_task_mgr.cpp b/services/formmgr/src/form_task_mgr.cpp index bc103d8b00..bcd4376d94 100644 --- a/services/formmgr/src/form_task_mgr.cpp +++ b/services/formmgr/src/form_task_mgr.cpp @@ -12,6 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#include + #include "app_log_wrapper.h" #include "form_constants.h" #include "form_data_mgr.h" @@ -421,7 +424,7 @@ void FormTaskMgr::NotifyCastTemp(const int64_t formId, const Want &want, const s void FormTaskMgr::AcquireTaskToHost(const int64_t formId, const FormRecord &record, const sptr &remoteObject) { - //APP_LOGI("FormTaskMgr AcquireTaskToHost, formId:%{public}lld", formId); + APP_LOGI("FormTaskMgr AcquireTaskToHost, formId:%{public}" PRId64 "", formId); sptr remoteFormHost = iface_cast(remoteObject); if (remoteFormHost == nullptr) { diff --git a/services/formmgr/src/form_timer_mgr.cpp b/services/formmgr/src/form_timer_mgr.cpp index 02b6715e93..9d13f7c2e1 100644 --- a/services/formmgr/src/form_timer_mgr.cpp +++ b/services/formmgr/src/form_timer_mgr.cpp @@ -13,6 +13,8 @@ * limitations under the License. */ +#include + #include "appexecfwk_errors.h" #include "app_log_wrapper.h" #include "common_event_manager.h" @@ -41,7 +43,7 @@ FormTimerMgr::~FormTimerMgr() */ bool FormTimerMgr::AddFormTimer(const FormTimer &task) { - //APP_LOGI("%{public}s, formId: %{public}lld", __func__, task.formId); + APP_LOGI("%{public}s, formId: %{public}" PRId64 "", __func__, task.formId); if (task.isUpdateAt) { if (task.hour >= Constants::MIN_TIME && task.hour <= Constants::MAX_HOUR && task.min >= Constants::MIN_TIME && task.min <= Constants::MAX_MININUTE) { @@ -90,7 +92,7 @@ bool FormTimerMgr::AddFormTimer(const int64_t formId, const long updateAtHour, c */ bool FormTimerMgr::RemoveFormTimer(const int64_t formId) { - //APP_LOGI("%{public}s, task: %{public}lld", __func__, formId); + APP_LOGI("%{public}s, task: %{public}" PRId64 "", __func__, formId); if (!DeleteIntervalTimer(formId)) { DeleteUpdateAtTimer(formId); @@ -336,7 +338,7 @@ void FormTimerMgr::SetEnableFlag(int64_t formId, bool flag) auto iter = intervalTimerTasks_.find(formId); if (iter != intervalTimerTasks_.end()) { iter->second.isEnable = flag; - //APP_LOGI("%{public}s, formId:%{public}lld, isEnable:%{public}d", __func__, formId, flag ? 1 : 0); + APP_LOGI("%{public}s, formId:%{public}" PRId64 ", isEnable:%{public}d", __func__, formId, flag ? 1 : 0); return; } } @@ -371,7 +373,7 @@ bool FormTimerMgr::AddUpdateAtTimer(const FormTimer &task) std::lock_guard lock(updateAtMutex_); for (auto &updateAtTimer : updateAtTimerTasks_) { if (updateAtTimer.refreshTask.formId == task.formId) { - //APP_LOGW("%{public}s, already exist formTimer, formId:%{public}lld task", __func__, task.formId); + APP_LOGW("%{public}s, already exist formTimer, formId:%{public}" PRId64 " task", __func__, task.formId); return true; } } @@ -402,7 +404,7 @@ bool FormTimerMgr::AddIntervalTimer(const FormTimer &task) std::lock_guard lock(intervalMutex_); EnsureInitIntervalTimer(); if (intervalTimerTasks_.find(task.formId) != intervalTimerTasks_.end()) { - //APP_LOGW("%{public}s, already exist formTimer, formId:%{public}lld task", __func__, task.formId); + APP_LOGW("%{public}s, already exist formTimer, formId:%{public}" PRId64 " task", __func__, task.formId); return true; } intervalTimerTasks_.emplace(task.formId, task); @@ -570,7 +572,7 @@ void FormTimerMgr::SetIntervalEnableFlag(int64_t formId, bool flag) auto refreshTask = intervalTimerTasks_.find(formId); if (refreshTask != intervalTimerTasks_.end()) { refreshTask->second.isEnable = flag; - //APP_LOGI("%{public}s, formId:%{public}lld, isEnable:%{public}d", __func__, formId, flag ? 1 : 0); + APP_LOGI("%{public}s, formId:%{public}" PRId64 ", isEnable:%{public}d", __func__, formId, flag ? 1 : 0); return; } } diff --git a/services/formmgr/src/form_util.cpp b/services/formmgr/src/form_util.cpp index fcf2eaaecb..a4d3d30f76 100644 --- a/services/formmgr/src/form_util.cpp +++ b/services/formmgr/src/form_util.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#include #include #include // #include @@ -91,7 +92,7 @@ int64_t FormUtil::GenerateFormId(int64_t udidHash) size_t elapsedHash = std::hash()(std::to_string(elapsedTime)); APP_LOGI("%{public}s, GenerateFormId generate elapsed hash %{public}zu", __func__, elapsedHash); int64_t formId = udidHash | (int32_t)(elapsedHash & 0x000000007fffffffL); - //APP_LOGI("%{public}s, GenerateFormId generate formId %{public}lld", __func__, formId); + APP_LOGI("%{public}s, GenerateFormId generate formId %{public}" PRId64 "", __func__, formId); return formId; } @@ -117,7 +118,7 @@ int64_t FormUtil::PaddingUDIDHash(int64_t formId, int64_t udidHash) */ bool FormUtil::GenerateUdidHash(int64_t &udidHash) { - //APP_LOGI("%{public}s start, udidHash: %{public}lld", __func__, udidHash); + APP_LOGI("%{public}s start, udidHash: %{public}" PRId64 "", __func__, udidHash); if (udidHash != INVALID_UDID_HASH) { return true; } @@ -135,7 +136,7 @@ bool FormUtil::GenerateUdidHash(int64_t &udidHash) if(udidHash < 0) { udidHash = 0L; } - //APP_LOGI("%{public}s, FormAdapter generate hash %{public}lld", __func__, udidHash); + APP_LOGI("%{public}s, FormAdapter generate hash %{public}" PRId64 "", __func__, udidHash); return true; } -- Gitee