diff --git a/frameworks/ans/native/src/reminder_request.cpp b/frameworks/ans/native/src/reminder_request.cpp index 6e22958b5d28caec73d5f7ac5f109b9ee39b1af9..17390bd8c244b26eaab70b52da53e7f5c32d4d67 100644 --- a/frameworks/ans/native/src/reminder_request.cpp +++ b/frameworks/ans/native/src/reminder_request.cpp @@ -28,7 +28,7 @@ namespace OHOS { namespace Notification { namespace { -const int BASE_YEAR = 1900; +const int32_t BASE_YEAR = 1900; } int32_t ReminderRequest::GLOBAL_ID = 0; @@ -206,7 +206,7 @@ void ReminderRequest::InitReminderId() ANSR_LOGI("reminderId_=%{public}d", reminderId_); } -void ReminderRequest::InitUserId(const int &userId) +void ReminderRequest::InitUserId(const int32_t &userId) { userId_ = userId; } @@ -290,8 +290,8 @@ bool ReminderRequest::HandleTimeZoneChange( if (isExpired_) { return false; } - ANSR_LOGD("Handle timezone change, oldZoneTriggerTime:%{public}llu, newZoneTriggerTime:%{public}llu", - (unsigned long long)oldZoneTriggerTime, (unsigned long long)newZoneTriggerTime); + ANSR_LOGD("Handle timezone change, oldZoneTriggerTime:%{public}" PRIu64 "\ + , newZoneTriggerTime:%{public}" PRIu64 "", oldZoneTriggerTime, newZoneTriggerTime); if (oldZoneTriggerTime == newZoneTriggerTime) { return false; } @@ -428,7 +428,7 @@ int64_t ReminderRequest::RecoverInt64FromDb(const std::shared_ptrGetInt(ReminderStore::GetColumnIndex(columnName), value); return static_cast(value); } @@ -466,7 +466,7 @@ void ReminderRequest::RecoverFromDb(const std::shared_ptrGetInt(ReminderStore::GetColumnIndex(UID), uid_); // reminderType - int reminderType; + int32_t reminderType; resultSet->GetInt(ReminderStore::GetColumnIndex(REMINDER_TYPE), reminderType); reminderType_ = ReminderType(reminderType); @@ -507,7 +507,7 @@ void ReminderRequest::RecoverFromDb(const std::shared_ptrGetInt(ReminderStore::GetColumnIndex(SLOT_ID), slotType); slotType_ = NotificationConstant::SlotType(slotType); @@ -651,8 +651,8 @@ ReminderRequest& ReminderRequest::SetTimeInterval(const uint64_t timeIntervalInS } else { uint64_t timeIntervalInMilli = timeIntervalInSeconds * MILLI_SECONDS; if (timeIntervalInMilli > 0 && timeIntervalInMilli < MIN_TIME_INTERVAL_IN_MILLI) { - ANSR_LOGW("SetTimeInterval, replace to set %{public}u, for the given is 0<%{public}llu<%{public}u", - MIN_TIME_INTERVAL_IN_MILLI / MILLI_SECONDS, (unsigned long long)timeIntervalInSeconds, + ANSR_LOGW("SetTimeInterval, replace to set %{public}u, for the given is 0<%{public}" PRIu64 "<%{public}u", + MIN_TIME_INTERVAL_IN_MILLI / MILLI_SECONDS, timeIntervalInSeconds, MIN_TIME_INTERVAL_IN_MILLI / MILLI_SECONDS); timeIntervalInMilli_ = MIN_TIME_INTERVAL_IN_MILLI; } else { @@ -793,7 +793,7 @@ uint64_t ReminderRequest::GetTriggerTimeInMilli() const return triggerTimeInMilli_; } -int ReminderRequest::GetUserId() const +int32_t ReminderRequest::GetUserId() const { return userId_; } @@ -1089,7 +1089,7 @@ bool ReminderRequest::ReadFromParcel(Parcel &parcel) ANSR_LOGE("Failed to read buttonMapSize"); return false; } - for (int i = 0; i < buttonMapSize; i++) { + for (int32_t i = 0; i < buttonMapSize; i++) { uint8_t buttonType = static_cast(ActionButtonType::INVALID); if (!parcel.ReadUint8(buttonType)) { ANSR_LOGE("Failed to read buttonType"); @@ -1246,7 +1246,7 @@ std::string ReminderRequest::GetState(const uint8_t state) const void ReminderRequest::AddActionButtons(const bool includeSnooze) { - int requestCode = 10; + int32_t requestCode = 10; std::vector flags; flags.push_back(AbilityRuntime::WantAgent::WantAgentConstant::Flags::UPDATE_PRESENT_FLAG); for (auto button : actionButtonMap_) { @@ -1290,7 +1290,7 @@ void ReminderRequest::AddActionButtons(const bool includeSnooze) void ReminderRequest::AddRemovalWantAgent() { - int requestCode = 10; + int32_t requestCode = 10; std::vector flags; flags.push_back(AbilityRuntime::WantAgent::WantAgentConstant::Flags::UPDATE_PRESENT_FLAG); auto want = std::make_shared(); @@ -1317,7 +1317,7 @@ void ReminderRequest::AddRemovalWantAgent() std::shared_ptr ReminderRequest::CreateWantAgent( AppExecFwk::ElementName &element) const { - int requestCode = 10; + int32_t requestCode = 10; std::vector flags; flags.push_back(AbilityRuntime::WantAgent::WantAgentConstant::Flags::UPDATE_PRESENT_FLAG); auto want = std::make_shared(); @@ -1491,7 +1491,7 @@ void ReminderRequest::UpdateNotificationStateForSnooze() UpdateActionButtons(true); } -int ReminderRequest::GetActualTime(const TimeTransferType &type, int cTime) +int32_t ReminderRequest::GetActualTime(const TimeTransferType &type, int32_t cTime) { switch (type) { case (TimeTransferType::YEAR): // year @@ -1499,7 +1499,7 @@ int ReminderRequest::GetActualTime(const TimeTransferType &type, int cTime) case (TimeTransferType::MONTH): // month return 1 + cTime; case (TimeTransferType::WEEK): { // week - int sunDay = 7; + int32_t sunDay = 7; if (cTime == 0) { return sunDay; } else { @@ -1511,7 +1511,7 @@ int ReminderRequest::GetActualTime(const TimeTransferType &type, int cTime) } } -int ReminderRequest::GetCTime(const TimeTransferType &type, int actualTime) +int32_t ReminderRequest::GetCTime(const TimeTransferType &type, int32_t actualTime) { switch (type) { case (TimeTransferType::YEAR): // year @@ -1519,7 +1519,7 @@ int ReminderRequest::GetCTime(const TimeTransferType &type, int actualTime) case (TimeTransferType::MONTH): // month return actualTime - 1; case (TimeTransferType::WEEK): { // week - int sunDay = 7; + int32_t sunDay = 7; if (actualTime == sunDay) { return 0; } else { @@ -1531,7 +1531,7 @@ int ReminderRequest::GetCTime(const TimeTransferType &type, int actualTime) } } -int32_t ReminderRequest::GetUid(const int &userId, const std::string &bundleName) +int32_t ReminderRequest::GetUid(const int32_t &userId, const std::string &bundleName) { AppExecFwk::ApplicationInfo info; sptr systemAbilityManager @@ -1542,15 +1542,14 @@ int32_t ReminderRequest::GetUid(const int &userId, const std::string &bundleName } sptr remoteObject = systemAbilityManager->GetSystemAbility(BUNDLE_MGR_SERVICE_SYS_ABILITY_ID); sptr bundleMgr = iface_cast(remoteObject); - bundleMgr->GetApplicationInfo(bundleName, AppExecFwk::ApplicationFlag::GET_BASIC_APPLICATION_INFO, - static_cast(userId), info); + bundleMgr->GetApplicationInfo(bundleName, AppExecFwk::ApplicationFlag::GET_BASIC_APPLICATION_INFO, userId, info); ANSR_LOGD("uid=%{public}d", info.uid); return static_cast(info.uid); } -int ReminderRequest::GetUserId(const int &uid) +int32_t ReminderRequest::GetUserId(const int32_t &uid) { - int userId = -1; + int32_t userId = -1; AccountSA::OsAccountManager::GetOsAccountLocalIdFromUid(uid, userId); ANSR_LOGD("userId=%{public}d", userId); return userId; @@ -1564,7 +1563,7 @@ void ReminderRequest::AppendValuesBucket(const sptr &reminder, values.PutInt(USER_ID, reminder->GetUserId()); values.PutInt(UID, reminder->GetUid()); values.PutString(APP_LABEL, ""); // no use, compatible with old version. - values.PutInt(REMINDER_TYPE, static_cast(reminder->GetReminderType())); + values.PutInt(REMINDER_TYPE, static_cast(reminder->GetReminderType())); values.PutLong(REMINDER_TIME, reminder->GetReminderTimeInMilli()); values.PutLong(TRIGGER_TIME, reminder->GetTriggerTimeInMilli()); values.PutLong( diff --git a/frameworks/ans/native/src/reminder_request_alarm.cpp b/frameworks/ans/native/src/reminder_request_alarm.cpp index 50ce312e24ba7c6aaf0851521645c188a2ede4d2..61cd41d68cd407f98405a7803895e5ace274531f 100644 --- a/frameworks/ans/native/src/reminder_request_alarm.cpp +++ b/frameworks/ans/native/src/reminder_request_alarm.cpp @@ -165,10 +165,10 @@ int8_t ReminderRequestAlarm::GetNextAlarm(const time_t now, const time_t target) ANSR_LOGE("Failed to get next alarm due to gmtime return null."); return 0; } - int today = GetActualTime(TimeTransferType::WEEK, nowTime->tm_wday); - int dayCount = now >= target ? 1 : 0; + int32_t today = GetActualTime(TimeTransferType::WEEK, nowTime->tm_wday); + int32_t dayCount = now >= target ? 1 : 0; for (; dayCount <= DAYS_PER_WEEK; dayCount++) { - int day = (today + dayCount) % DAYS_PER_WEEK; + int32_t day = (today + dayCount) % DAYS_PER_WEEK; day = (day == 0) ? SUNDAY : day; if (IsRepeatDay(day)) { break; @@ -178,17 +178,17 @@ int8_t ReminderRequestAlarm::GetNextAlarm(const time_t now, const time_t target) return dayCount; } -bool ReminderRequestAlarm::IsRepeatDay(int day) const +bool ReminderRequestAlarm::IsRepeatDay(int32_t day) const { return (repeatDays_ & (1 << (day - 1))) > 0; } -std::vector ReminderRequestAlarm::GetDaysOfWeek() const +std::vector ReminderRequestAlarm::GetDaysOfWeek() const { - std::vector repeatDays; - int days[] = {1, 2, 3, 4, 5, 6, 7}; - int len = sizeof(days) / sizeof(int); - for (int i = 0; i < len; i++) { + std::vector repeatDays; + int32_t days[] = {1, 2, 3, 4, 5, 6, 7}; + int32_t len = sizeof(days) / sizeof(int32_t); + for (int32_t i = 0; i < len; i++) { if (IsRepeatDay(days[i])) { repeatDays.push_back(days[i]); } diff --git a/frameworks/ans/native/src/reminder_request_calendar.cpp b/frameworks/ans/native/src/reminder_request_calendar.cpp index 8acb45fd12974eb9a9882bfcf7b2abcbe9f3edbc..7cc3a58099b57d4458055dd7317073edea00e282 100644 --- a/frameworks/ans/native/src/reminder_request_calendar.cpp +++ b/frameworks/ans/native/src/reminder_request_calendar.cpp @@ -322,7 +322,7 @@ void ReminderRequestCalendar::SetRepeatDaysOfMonth(const std::vector &r std::vector ReminderRequestCalendar::GetRepeatMonths() const { std::vector repeatMonths; - for (int i = 0; i < MAX_MONTHS_OF_YEAR; i++) { + for (int32_t i = 0; i < MAX_MONTHS_OF_YEAR; i++) { if (IsRepeatMonth(i + 1)) { repeatMonths.push_back(i + 1); } @@ -333,7 +333,7 @@ std::vector ReminderRequestCalendar::GetRepeatMonths() const std::vector ReminderRequestCalendar::GetRepeatDays() const { std::vector repeatDays; - for (int i = 0; i < MAX_DAYS_OF_MONTH; i++) { + for (int32_t i = 0; i < MAX_DAYS_OF_MONTH; i++) { if (IsRepeatDay(i + 1)) { repeatDays.push_back(i + 1); } diff --git a/interfaces/innerkits/ans/native/include/reminder_request.h b/interfaces/innerkits/ans/native/include/reminder_request.h index cc6455989b536c87441782487f8df9231dc86d03..a032d6f666efc89acf6385a2601e19d5e2ebc747 100644 --- a/interfaces/innerkits/ans/native/include/reminder_request.h +++ b/interfaces/innerkits/ans/native/include/reminder_request.h @@ -268,7 +268,7 @@ public: */ uint64_t GetTriggerTimeInMilli() const; - int GetUserId() const; + int32_t GetUserId() const; int32_t GetUid() const; /** @@ -293,7 +293,7 @@ public: * * @param userId Indicates the userId which the reminder belong to. */ - void InitUserId(const int &userId); + void InitUserId(const int32_t &userId); /** * @brief Inites reminder uid when publish reminder success. @@ -559,11 +559,11 @@ public: */ void UpdateNotificationRequest(UpdateNotificationType type, std::string extra); - static int GetActualTime(const TimeTransferType &type, int cTime); - static int GetCTime(const TimeTransferType &type, int actualTime); + static int32_t GetActualTime(const TimeTransferType &type, int32_t cTime); + static int32_t GetCTime(const TimeTransferType &type, int32_t actualTime); static uint64_t GetDurationSinceEpochInMilli(const time_t target); - static int32_t GetUid(const int &userId, const std::string &bundleName); - static int GetUserId(const int &uid); + static int32_t GetUid(const int32_t &userId, const std::string &bundleName); + static int32_t GetUserId(const int32_t &uid); static void AppendValuesBucket(const sptr &reminder, const sptr &bundleOption, NativeRdb::ValuesBucket &values); @@ -724,7 +724,7 @@ private: uint8_t state_ {0}; int32_t notificationId_ {0}; int32_t reminderId_ {-1}; - int userId_ {-1}; + int32_t userId_ {-1}; int32_t uid_ {-1}; // Indicates the reminder has been shown in the past time. diff --git a/interfaces/innerkits/ans/native/include/reminder_request_alarm.h b/interfaces/innerkits/ans/native/include/reminder_request_alarm.h index 705dbf0a03945b6e2c1cbb4773573dcfb991881e..e0dd931f72fc1880a97dd912c3c26411d202a68d 100644 --- a/interfaces/innerkits/ans/native/include/reminder_request_alarm.h +++ b/interfaces/innerkits/ans/native/include/reminder_request_alarm.h @@ -62,7 +62,7 @@ public: * * @return vector of repeat days. */ - std::vector GetDaysOfWeek() const; + std::vector GetDaysOfWeek() const; /** * @brief Obtains the setted {@link hour_}. @@ -137,7 +137,7 @@ private: * @param day Indicates the day of week. * @return true if it is a repeat day. */ - bool IsRepeatDay(int day) const; + bool IsRepeatDay(int32_t day) const; bool IsRepeatReminder() const; void SetDaysOfWeek(bool set, std::vector daysOfWeek); diff --git a/interfaces/kits/napi/ans/src/reminder/publish.cpp b/interfaces/kits/napi/ans/src/reminder/publish.cpp index dc5792815366bbd4640a952f182c476602bf641c..7c332d7a99cac34d64590c238c4b8773ddbbce0b 100644 --- a/interfaces/kits/napi/ans/src/reminder/publish.cpp +++ b/interfaces/kits/napi/ans/src/reminder/publish.cpp @@ -299,7 +299,7 @@ void ParseReminderAlarm(const napi_env &env, ReminderRequest &reminder, napi_val // daysOfWeek napi_create_array(env, &value); napi_set_named_property(env, result, ALARM_DAYS_OF_WEEK, value); - int count = 0; + int32_t count = 0; for (auto day : alarm.GetDaysOfWeek()) { if (day) { napi_value napiDay = nullptr; @@ -335,7 +335,7 @@ void ParseReminderCalendar(const napi_env &env, ReminderRequest &reminder, napi_ // repeatMonths napi_create_array(env, &value); napi_set_named_property(env, result, CALENDAR_REPEAT_MONTHS, value); - int count = 0; + int32_t count = 0; for (auto month : calendar.GetRepeatMonths()) { napi_value napiDay = nullptr; napi_create_int32(env, month, &napiDay); @@ -385,7 +385,7 @@ void ParseActionButtons(const napi_env &env, ReminderRequest &reminder, napi_val napi_value array = nullptr; napi_create_array(env, &array); napi_set_named_property(env, result, ACTION_BUTTON, array); - int index = 0; + int32_t index = 0; for (std::map::iterator it = actionButtonsMap.begin(); it != actionButtonsMap.end(); ++it) { // create obj @@ -499,7 +499,7 @@ napi_value SetValidReminder(const napi_env &env, ReminderRequest &reminder, napi void GetValidRemindersInner(napi_env env, std::vector>& validReminders, napi_value& arr) { - int count = 0; + int32_t count = 0; napi_create_array(env, &arr); for (auto reminder : validReminders) { if (reminder == nullptr) { diff --git a/services/ans/include/reminder_data_manager.h b/services/ans/include/reminder_data_manager.h index bb5cc0d0b9869842dd76193eec564bbaeeaead96..e9a727ecde015174b685668f20eebb782b313885 100644 --- a/services/ans/include/reminder_data_manager.h +++ b/services/ans/include/reminder_data_manager.h @@ -44,7 +44,7 @@ public: * @param packageName Indicates the package name. * @param userId Indicates the user id which the bundle belong to. */ - void CancelAllReminders(const std::string &packageName, const int &userId); + void CancelAllReminders(const std::string &packageName, const int32_t &userId); /** * @brief Cancels the target reminder relative to the reminder id and bundle option. @@ -97,11 +97,11 @@ public: void InitUserId(); - void OnUserRemove(const int& userId); + void OnUserRemove(const int32_t& userId); void OnServiceStart(); - void OnUserSwitch(const int& userId); + void OnUserSwitch(const int32_t& userId); /** * @brief Triggered when third party application died. @@ -193,7 +193,7 @@ private: */ void AddToShowedReminders(const sptr &reminder); - void CancelAllReminders(const int &userId); + void CancelAllReminders(const int32_t &userId); /** * @brief Cancels all the reminders of the target bundle or user. @@ -201,7 +201,7 @@ private: * @param packageName Indicates the packageName need to cancel. * @param userId Indicates the userId to cancel. */ - void CancelRemindersImplLocked(const std::string &packageName, const int &userId); + void CancelRemindersImplLocked(const std::string &packageName, const int32_t &userId); /** * Cancels the notification relative to the reminder. @@ -305,7 +305,7 @@ private: * @param userId Indicates the user id. * @return true If the reminder is matched with the bundleOption or userId. */ - bool IsMatched(const sptr &reminder, const std::string &packageName, const int &userId) const; + bool IsMatched(const sptr &reminder, const std::string &packageName, const int32_t &userId) const; bool IsAllowedNotify(const sptr &reminder) const; diff --git a/services/ans/src/reminder_data_manager.cpp b/services/ans/src/reminder_data_manager.cpp index 0a00d2b70f5f7fe812bbf880e9c9f90f39473bcd..a74441c54bf12da8bac47f77d1c05884caec6dc5 100644 --- a/services/ans/src/reminder_data_manager.cpp +++ b/services/ans/src/reminder_data_manager.cpp @@ -29,7 +29,7 @@ namespace OHOS { namespace Notification { namespace { const std::string ALL_PACKAGES = "allPackages"; -const int MAIN_USER_ID = 100; +const int32_t MAIN_USER_ID = 100; } const int16_t ReminderDataManager::MAX_NUM_REMINDER_LIMIT_SYSTEM = 2000; @@ -75,7 +75,7 @@ void ReminderDataManager::CancelReminder( StartRecentReminder(); } -void ReminderDataManager::CancelAllReminders(const std::string &packageName, const int &userId) +void ReminderDataManager::CancelAllReminders(const std::string &packageName, const int32_t &userId) { ANSR_LOGD("CancelAllReminders, userId=%{public}d, pkgName=%{public}s", userId, packageName.c_str()); @@ -102,13 +102,13 @@ void ReminderDataManager::GetValidReminders( } } -void ReminderDataManager::CancelAllReminders(const int &userId) +void ReminderDataManager::CancelAllReminders(const int32_t &userId) { ANSR_LOGD("CancelAllReminders, userId=%{public}d", userId); CancelRemindersImplLocked(ALL_PACKAGES, userId); } -void ReminderDataManager::CancelRemindersImplLocked(const std::string &packageName, const int &userId) +void ReminderDataManager::CancelRemindersImplLocked(const std::string &packageName, const int32_t &userId) { MUTEX.lock(); if (activeReminderId_ != -1 && IsMatched(activeReminder_, packageName, userId)) { @@ -148,7 +148,7 @@ void ReminderDataManager::CancelRemindersImplLocked(const std::string &packageNa } bool ReminderDataManager::IsMatched(const sptr &reminder, - const std::string &packageName, const int &userId) const + const std::string &packageName, const int32_t &userId) const { auto mit = notificationBundleOptionMap_.find(reminder->GetReminderId()); if (mit == notificationBundleOptionMap_.end()) { @@ -231,7 +231,7 @@ void ReminderDataManager::AddToShowedReminders(const sptr &remi showedReminderVector_.push_back(reminder); } -void ReminderDataManager::OnUserRemove(const int& userId) +void ReminderDataManager::OnUserRemove(const int32_t& userId) { ANSR_LOGD("Remove user id: %{public}d", userId); if (!IsReminderAgentReady()) { @@ -250,7 +250,7 @@ void ReminderDataManager::OnServiceStart() StartRecentReminder(); } -void ReminderDataManager::OnUserSwitch(const int& userId) +void ReminderDataManager::OnUserSwitch(const int32_t& userId) { ANSR_LOGD("Switch user id from %{public}d to %{public}d", currentUserId_, userId); currentUserId_ = userId; @@ -302,12 +302,12 @@ std::shared_ptr ReminderDataManager::CreateTimerInfo(TimerTyp } uint8_t timerTypeWakeup = static_cast(sharedTimerInfo->TIMER_TYPE_WAKEUP); uint8_t timerTypeExact = static_cast(sharedTimerInfo->TIMER_TYPE_EXACT); - int timerType = static_cast(timerTypeWakeup | timerTypeExact); + int32_t timerType = static_cast(timerTypeWakeup | timerTypeExact); sharedTimerInfo->SetType(timerType); sharedTimerInfo->SetRepeat(false); sharedTimerInfo->SetInterval(0); - int requestCode = 10; + int32_t requestCode = 10; std::vector flags; flags.push_back(AbilityRuntime::WantAgent::WantAgentConstant::Flags::UPDATE_PRESENT_FLAG); @@ -547,7 +547,7 @@ bool ReminderDataManager::ShouldAlert(const sptr &reminder) con ANSR_LOGD("The reminder (reminderId=%{public}d) is silent", reminderId); return false; } - int userId = ReminderRequest::GetUserId(bundleOption->GetUid()); + int32_t userId = ReminderRequest::GetUserId(bundleOption->GetUid()); if (currentUserId_ != userId) { ANSR_LOGD("The reminder (reminderId=%{public}d) is silent for not in active user, " \ "current user id: %{public}d, reminder user id: %{public}d", reminderId, currentUserId_, userId); @@ -987,7 +987,7 @@ void ReminderDataManager::Init(bool isFromBootComplete) void ReminderDataManager::InitUserId() { - std::vector activeUserId; + std::vector activeUserId; AccountSA::OsAccountManager::QueryActiveOsAccountIds(activeUserId); if (activeUserId.size() > 0) { currentUserId_ = activeUserId[0]; @@ -1040,8 +1040,8 @@ bool ReminderDataManager::IsReminderAgentReady() const bool ReminderDataManager::IsBelongToSameApp(const sptr &bundleOption, const sptr &other) const { - int userIdSrc = ReminderRequest::GetUserId(bundleOption->GetUid()); - int userIdTar = ReminderRequest::GetUserId(other->GetUid()); + int32_t userIdSrc = ReminderRequest::GetUserId(bundleOption->GetUid()); + int32_t userIdTar = ReminderRequest::GetUserId(other->GetUid()); return ((bundleOption->GetBundleName() == other->GetBundleName()) && (userIdSrc == userIdTar)) ? true : false; } @@ -1231,7 +1231,7 @@ void ReminderDataManager::StartTimer(const sptr &reminderReques timerId_ = timer->CreateTimer(REMINDER_DATA_MANAGER->CreateTimerInfo(type)); triggerTime = reminderRequest->GetTriggerTimeInMilli(); timer->StartTimer(timerId_, triggerTime); - ANSR_LOGD("Start timing (next triggerTime), timerId=%{public}llu", (unsigned long long)timerId_); + ANSR_LOGD("Start timing (next triggerTime), timerId=%{public}" PRIu64 "", timerId_); break; } case TimerType::ALERTING_TIMER: { @@ -1244,7 +1244,7 @@ void ReminderDataManager::StartTimer(const sptr &reminderReques timerIdAlerting_ = timer->CreateTimer(REMINDER_DATA_MANAGER->CreateTimerInfo(type)); timer->StartTimer(timerIdAlerting_, triggerTime); ANSR_LOGD( - "Start timing (alerting time out), timerId=%{public}llu", (unsigned long long)timerIdAlerting_); + "Start timing (alerting time out), timerId=%{public}" PRIu64 "", timerIdAlerting_); break; } default: { @@ -1255,9 +1255,8 @@ void ReminderDataManager::StartTimer(const sptr &reminderReques if (triggerTime == 0) { ANSR_LOGW("Start timer fail"); } else { - ANSR_LOGD("Timing info: now:(%{public}llu), tar:(%{public}llu)", - (unsigned long long)(ReminderRequest::GetDurationSinceEpochInMilli(now)), - (unsigned long long)(triggerTime)); + ANSR_LOGD("Timing info: now:(%{public}" PRIu64 "), tar:(%{public}" PRIu64 ")", + ReminderRequest::GetDurationSinceEpochInMilli(now), triggerTime); } } @@ -1295,7 +1294,7 @@ void ReminderDataManager::StopTimer(TimerType type) ANSR_LOGD("Timer is not running"); return; } - ANSR_LOGD("Stop timer id=%{public}llu", (unsigned long long)timerId); + ANSR_LOGD("Stop timer id=%{public}" PRIu64 "", timerId); timer->StopTimer(timerId); ResetStates(type); } diff --git a/services/ans/src/reminder_event_manager.cpp b/services/ans/src/reminder_event_manager.cpp index 69fae061494607e2a4f8953f561c750b5fcc83c0..ff0cdc5c49bbf9d16a4cff0f31e3fc329df9821c 100644 --- a/services/ans/src/reminder_event_manager.cpp +++ b/services/ans/src/reminder_event_manager.cpp @@ -147,7 +147,7 @@ void ReminderEventManager::ReminderEventSubscriber::HandlePackageRemove(const Ev { OHOS::AppExecFwk::ElementName ele = want.GetElement(); std::string bundleName = ele.GetBundleName(); - int userId = want.GetIntParam(OHOS::AppExecFwk::Constants::USER_ID, -1); + int32_t userId = want.GetIntParam(OHOS::AppExecFwk::Constants::USER_ID, -1); reminderDataManager_->CancelAllReminders(bundleName, userId); } @@ -166,7 +166,7 @@ sptr ReminderEventManager::ReminderEventSubscriber::Ge { OHOS::AppExecFwk::ElementName ele = want.GetElement(); std::string bundleName = ele.GetBundleName(); - int userId = want.GetIntParam(OHOS::AppExecFwk::Constants::USER_ID, -1); + int32_t userId = want.GetIntParam(OHOS::AppExecFwk::Constants::USER_ID, -1); int32_t uid = ReminderRequest::GetUid(userId, bundleName); ANSR_LOGD("bundleName=%{public}s, userId=%{public}d, uid=%{public}d", bundleName.c_str(), userId, uid); sptr bundleOption = new (std::nothrow) NotificationBundleOption(bundleName, uid);