1 /* 2 * Copyright (c) 2022 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 #ifndef FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_WORK_SCHED_UTILS_H 16 #define FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_WORK_SCHED_UTILS_H 17 18 #include <string> 19 20 namespace OHOS { 21 namespace WorkScheduler { 22 class WorkSchedUtils { 23 public: 24 WorkSchedUtils() = delete; 25 ~WorkSchedUtils() = delete; 26 27 /** 28 * @brief Get current account id. 29 * 30 * @return Current account id. 31 */ 32 static int32_t GetCurrentAccountId(); 33 /** 34 * @brief The id active. 35 * 36 * @param id The id. 37 * @return True if success,else false. 38 */ 39 static bool IsIdActive(int32_t id); 40 /** 41 * @brief Get user id by uid. 42 * 43 * @param uid The uid. 44 * @return User id by uid. 45 */ 46 static int32_t GetUserIdByUid(int32_t uid); 47 /** 48 * @brief Convert full path. 49 * 50 * @param inOriPath The inOriPath. 51 * @param outRealPath The outRealPath. 52 * @return True if success,else false. 53 */ 54 static bool ConvertFullPath(const std::string &inOriPath, std::string &outRealPath); 55 /** 56 * @brief Check if the calling app is system app. 57 * 58 * @return True if success,else false. 59 */ 60 static bool IsSystemApp(); 61 /** 62 * @brief Get current millisecond time. 63 * 64 * @return Millisecond time. 65 */ 66 static uint64_t GetCurrentTimeMs(); 67 }; 68 } // namespace WorkScheduler 69 } // namespace OHOS 70 #endif // FOUNDATION_RESOURCESCHEDULE_WORKSCHEDULER_WORK_SCHED_UTILS_H