1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_CLOUD_SYNC_SERVICE_CYCLE_TASK_RUNNER_H 17 #define OHOS_CLOUD_SYNC_SERVICE_CYCLE_TASK_RUNNER_H 18 19 #include <set> 20 #include <chrono> 21 #include <ctime> 22 #include "cloud_pref_impl.h" 23 #include "cycle_task.h" 24 25 namespace OHOS { 26 namespace FileManagement { 27 namespace CloudSync { 28 class CycleTaskRunner { 29 public: 30 static const std::string FILE_PATH; 31 static const int32_t DEFAULT_VALUE; 32 static const int32_t DEFAULT_USER_ID; 33 CycleTaskRunner(std::shared_ptr<CloudFile::DataSyncManager> dataSyncManager); 34 void StartTask(); 35 36 private: 37 void InitTasks(); 38 void SetRunableBundleNames(); 39 40 int32_t userId_{0}; 41 std::time_t setUpTime_{0}; 42 std::shared_ptr<CloudFile::DataSyncManager> dataSyncManager_; 43 std::vector<std::shared_ptr<CycleTask>> cycleTasks_ {}; 44 }; 45 46 } // namespace CloudSync 47 } // namespace FileManagement 48 } // namespace OHOS 49 #endif // OHOS_CLOUD_SYNC_SERVICE_CYCLE_TASK_RUNNER_H