diff --git a/services/samgr/native/source/collect/device_timed_collect.cpp b/services/samgr/native/source/collect/device_timed_collect.cpp index 533167066e5e4e15eaa8fc274da641ec931137fc..a2a892e8c3dfd6169d5d867ecac98188c7656dd9 100644 --- a/services/samgr/native/source/collect/device_timed_collect.cpp +++ b/services/samgr/native/source/collect/device_timed_collect.cpp @@ -135,9 +135,9 @@ void DeviceTimedCollect::ProcessPersistenceLoopTask(int64_t disTime, int64_t tri ReportEventByTimeInfo(interval, true); // In order to enable the timer to start on time next time and make up for the missing time disTime = interval - abs(disTime) % interval; - PostPersistenceDelayTask(persitenceLoopTasks_[interval], interval, disTime); + PostPersistenceDelayTask(task, interval, disTime); } else { - PostDelayTaskByTimeInfo(persitenceLoopTasks_[interval], interval, disTime); + PostDelayTaskByTimeInfo(task, interval, disTime); } } diff --git a/services/samgr/native/test/unittest/src/device_timed_collect_test.cpp b/services/samgr/native/test/unittest/src/device_timed_collect_test.cpp index 176b1b8a2b3d8f5c9c00d5bbd80a26cf1e4abd81..32e6935e3ac4cce73931d6b91961b3767092ba1e 100644 --- a/services/samgr/native/test/unittest/src/device_timed_collect_test.cpp +++ b/services/samgr/native/test/unittest/src/device_timed_collect_test.cpp @@ -846,6 +846,7 @@ HWTEST_F(DeviceTimedCollectTest, ProcessPersistenceTimedTask002, TestSize.Level3 } #endif +#ifdef PREFERENCES_ENABLE HWTEST_F(DeviceTimedCollectTest, ProcessPersistenceLoopTask001, TestSize.Level3) { DTEST_LOG << " ProcessPersistenceLoopTask001 begin" << std::endl; @@ -903,6 +904,7 @@ HWTEST_F(DeviceTimedCollectTest, PostPersistenceLoopTaskLocked002, TestSize.Leve deviceTimedCollect->persitenceLoopTasks_.erase(1); DTEST_LOG << " PostPersistenceLoopTaskLocked002 end" << std::endl; } +#endif HWTEST_F(DeviceTimedCollectTest, PostNonPersistenceLoopTaskLocked001, TestSize.Level3) {