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 16 #ifndef BUNDLE_ACTIVE_CONSTANT_H 17 #define BUNDLE_ACTIVE_CONSTANT_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace DeviceUsageStats { 23 const int32_t DURATION_TABLE_ROW_NUMBER = 1; 24 const int32_t TABLE_ROW_ZERO = 0; 25 const int32_t SORTED_TABLE_ARRAY_NUMBER = 4; 26 const int32_t ALL_TABLE_ARRAY_NUMBER = 6; 27 const int32_t NO_UPDATE_ROW = 0; 28 const int32_t NO_DELETE_ROW = 0; 29 const int32_t EVENT_TABLE_NUMBER = 1; 30 const int32_t APP_GROUP_TABLE_NUMBER = 2; 31 const int32_t TABLE_NOT_EXIST = 0; 32 const int32_t DAILY_DATABASE_INDEX = 0; 33 const int32_t WEEKLY_DATABASE_INDEX = 1; 34 const int32_t MONTHLY_DATABASE_INDEX = 2; 35 const int32_t YEARLY_DATABASE_INDEX = 3; 36 const int32_t EVENT_DATABASE_INDEX = 4; 37 const int32_t APP_GROUP_DATABASE_INDEX = 5; 38 const int32_t BUNDLE_ACTIVE_VERSION_V1 = 1; 39 const int32_t BUNDLE_ACTIVE_VERSION_V2 = 2; 40 const int32_t BUNDLE_ACTIVE_CURRENT_VERSION = 3; 41 const int32_t BUNDLE_ACTIVE_SUCCESS = 0; 42 const int32_t BUNDLE_ACTIVE_FAIL = -1; 43 const int32_t BUNDLE_ACTIVE_RDB_VERSION = 1; 44 const int32_t BUNDLE_ACTIVE_RDB_VERSION_V2 = 2; 45 const int32_t BUNDLE_ACTIVE_DB_INDEX_NORMAL = 0; 46 const int32_t BUNDLE_ACTIVE_DB_INDEX_MODULE = 1; 47 const int32_t BUNDLE_ACTIVE_DB_INDEX_FORM = 2; 48 const int32_t USER_ID_COLUMN_INDEX = 0; 49 const int32_t BUNDLE_NAME_COLUMN_INDEX = 1; 50 const int32_t BUNDLE_STARTED_COUNT_COLUMN_INDEX = 2; 51 const int32_t LAST_TIME_COLUMN_INDEX = 3; 52 const int32_t LAST_TIME_CONTINUOUS_TASK_COLUMN_INDEX = 4; 53 const int32_t TOTAL_TIME_COLUMN_INDEX = 5; 54 const int32_t TOTAL_TIME_CONTINUOUS_TASK_COLUMN_INDEX = 6; 55 const int32_t PACKAGE_LOG_UID_COLUMN_INDEX = 7; 56 const int32_t EVENT_ID_COLUMN_INDEX = 2; 57 const int32_t TIME_STAMP_COLUMN_INDEX = 3; 58 const int32_t ABILITY_ID_COLUMN_INDEX = 4; 59 const int32_t EVENT_UID_COLUMN_INDEX = 5; 60 const int32_t LAST_BOOT_FROM_USED_TIME_COLUMN_INDEX = 2; 61 const int32_t LAST_SCREEN_USED_TIME_COLUMN_INDEX = 3; 62 const int32_t CURRENT_GROUP_COLUMN_INDEX = 4; 63 const int32_t REASON_IN_GROUP_COLUMN_INDEX = 5; 64 const int32_t BUNDLE_ALIVE_TIMEOUT_TIME_COLUMN_INDEX = 6; 65 const int32_t BUNDLE_DAILY_TIMEOUT_TIME_COLUMN_INDEX = 7; 66 const int32_t BUNDLE_HISTORY_LOG_UID_COLUMN_INDEX = 8; 67 const int32_t BUNDLE_HISTORY_LOG_FIRST_USE_TIME_COLUMN_INDEX = 9; 68 const int32_t BOOT_BASED_DURATION_COLUMN_INDEX = 0; 69 const int32_t SCREEN_ON_DURATION_COLUMN_INDEX = 1; 70 const int32_t DURATION_FLAG_COLUMN_INDEX = 2; 71 const int32_t MODULE_NAME_COLUMN_INDEX = 2; 72 const int32_t MODULE_USED_COUNT_COLUMN_INDEX = 3; 73 const int32_t MODULE_LAST_TIME_COLUMN_INDEX = 4; 74 const int32_t MODULE_UID_COLUMN_INDEX = 5; 75 const int32_t FORM_NAME_COLUMN_INDEX = 3; 76 const int32_t FORM_DIMENSION_COLUMN_INDEX = 4; 77 const int32_t FORM_ID_COLUMN_INDEX = 5; 78 const int32_t FORM_COUNT_COLUMN_INDEX = 6; 79 const int32_t FORM_LAST_TIME_COLUMN_INDEX = 7; 80 const int32_t FORM_UID_COLUMN_INDEX = 8; 81 const int32_t QUERY_CONDITION_VALID = 0; 82 const int32_t QUERY_CONDITION_INVALID = -1; 83 const int32_t DEFAULT_DELETE_EVENT_DALIYS = 0; 84 const int32_t NUM_HOUR_ONE_DAY = 24; 85 const int32_t NUM_DAY_ONE_WEEK = 7; 86 const int32_t MINIMUM_LIMIT = 0; 87 const int32_t DEFAULT_INVALID_VALUE = 0; 88 const uint32_t BUNDLE_ACTIVE_DB_NAME_MAX_LENGTH = 100; 89 const int64_t TWO_SECONDS = 2 * 1000LL; 90 const int64_t TEN_MINUTES = 10 * 60 * 1000LL; 91 const int64_t THIRTY_MINUTE = 30 * 60 * 1000LL; 92 const int64_t SIX_DAY_IN_MILLIS_MAX_DEBUG = 6 * 1 * 10 * 60 * 1000LL; 93 const int64_t SIX_DAY_IN_MILLIS_MAX = 6 * 24 * 60 * 60 * 1000LL; 94 const int64_t ONE_DAY_TIME_DEBUG = 1 * 10 * 60 * 1000LL; 95 const int64_t ONE_DAY_TIME = 1 * 24 * 60 * 60 * 1000LL; 96 const int64_t ONE_WEEK_TIME_DEBUG = 1 * 20 * 60 * 1000LL; 97 const int64_t ONE_WEEK_TIME = 7 * 24 * 60 * 60 * 1000LL; 98 const int64_t ONE_MONTH_TIME_DEBUG = 1 * 30 * 60 * 1000LL; 99 const int64_t ONE_MONTH_TIME = 30 * 24 * 60 * 60 * 1000LL; 100 const int64_t ONE_YEAR_TIME_DEBUG = 1 * 40 * 60 * 1000LL; 101 const int64_t ONE_YEAR_TIME = 365 * 24 * 60 * 60 * 1000LL; 102 const int64_t LAST_TIME_IN_MILLIS_MIN = 0LL; 103 const int64_t EVENT_TIME_IN_MILLIS_MIN = 0LL; 104 const int64_t EVENT_BEGIN_TIME_INITIAL_VALUE = -1LL; 105 const int64_t MAX_END_TIME = 20000000000000; 106 const std::string PACKAGE_LOG_TABLE = "PackageLog"; 107 const std::string PACKAGE_LOG_TABLE_INDEX_PREFIX = "PackageLogIndex"; 108 const std::string EVENT_LOG_TABLE = "DeviceEventLog"; 109 const std::string EVENT_LOG_TABLE_INDEX_PREFIX = "DeviceEventLogIndex"; 110 const std::string DURATION_LOG_TABLE = "DurationLog"; 111 const std::string BUNDLE_HISTORY_LOG_TABLE = "BundleHistoryLog"; 112 const std::string BUNDLE_HISTORY_LOG_TABLE_INDEX_PREFIX = "BundleHistoryLogIndex"; 113 const std::string MODULE_RECORD_LOG_TABLE = "ModuleRecordLog"; 114 const std::string MODULE_RECORD_LOG_TABLE_INDEX_PREFIX = "ModuleRecordLogIndex"; 115 const std::string FORM_RECORD_LOG_TABLE = "FormRecordLog"; 116 const std::string FORM_RECORD_LOG_TABLE_INDEX_PREFIX = "FormRecordLogIndex"; 117 const std::string UNKNOWN_TABLE_NAME = "unknownTableName"; 118 const std::string BUNDLE_ACTIVE_DB_USER_ID = "userId"; 119 const std::string BUNDLE_ACTIVE_DB_BUNDLE_NAME = "bundleName"; 120 const std::string BUNDLE_ACTIVE_DB_MODULE_NAME = "moduleName"; 121 const std::string BUNDLE_ACTIVE_DB_FORM_NAME = "formName"; 122 const std::string BUNDLE_ACTIVE_DB_FORM_DIMENSION = "formDimension"; 123 const std::string BUNDLE_ACTIVE_DB_FORM_ID = "formId"; 124 const std::string BUNDLE_ACTIVE_DB_MODULE_LAUNCHED_COUNT = "launchedCount"; 125 const std::string BUNDLE_ACTIVE_DB_FORM_TOUCH_COUNT = "touchCount"; 126 const std::string BUNDLE_ACTIVE_DB_BUNDLE_STARTED_COUNT = "bundleStartedCount"; 127 const std::string BUNDLE_ACTIVE_DB_LAST_TIME = "lastTime"; 128 const std::string BUNDLE_ACTIVE_DB_LAST_TIME_CONTINUOUS_TASK = "lastTimeContinuousTask"; 129 const std::string BUNDLE_ACTIVE_DB_TOTAL_TIME = "totalTime"; 130 const std::string BUNDLE_ACTIVE_DB_TOTAL_TIME_CONTINUOUS_TASK = "totalTimeContinuousTask"; 131 const std::string BUNDLE_ACTIVE_DB_EVENT_ID = "eventId"; 132 const std::string BUNDLE_ACTIVE_DB_TIME_STAMP = "timeStamp"; 133 const std::string BUNDLE_ACTIVE_DB_ABILITY_ID = "abilityId"; 134 const std::string BUNDLE_ACTIVE_DB_LAST_BOOT_FROM_USED_TIME = "lastBootFromUsedTime"; 135 const std::string BUNDLE_ACTIVE_DB_LAST_SCREEN_USED_TIME = "lastScreenUsedTime"; 136 const std::string BUNDLE_ACTIVE_DB_CURRENT_GROUP = "currentGroup"; 137 const std::string BUNDLE_ACTIVE_DB_REASON_IN_GROUP = "reasonInGroup"; 138 const std::string BUNDLE_ACTIVE_DB_BUNDLE_ALIVE_TIMEOUT_TIME = "bundleAliveTimeoutTime"; 139 const std::string BUNDLE_ACTIVE_DB_BUNDLE_DAILY_TIMEOUT_TIME = "bundleDailyTimeoutTime"; 140 const std::string BUNDLE_ACTIVE_DB_BOOT_BASED_DURATION = "bootBasedDuration"; 141 const std::string BUNDLE_ACTIVE_DB_SCREEN_ON_DURATION = "screenOnDuration"; 142 const std::string RDB_STORE_COLUMN_TYPE_INT = "INTEGER"; 143 const std::string BUNDLE_ACTIVE_DB_UID = "uid"; 144 const std::string BUNDLE_ACTIVE_DB_FIRST_USE_TIME = "firstUseTime"; 145 146 const std::string REFRESH_DATABASE_RUNNER_NAME = "RefreshDatabase"; 147 const std::string BUNDLE_ACTIVE_DATABASE_DIR = "/data/service/el1/public/bundle_usage/"; 148 const std::string BUNDLE_ACTIVE_VERSION_FILE = "/version"; 149 const std::string BUNDLE_ACTIVE_VERSION_DIRECTORY_PATH = BUNDLE_ACTIVE_DATABASE_DIR + BUNDLE_ACTIVE_VERSION_FILE; 150 const std::string DATABASE_FILE_TABLE_NAME = "table"; 151 const std::string SQLITE_MASTER_NAME = "name"; 152 const std::string COMMON_EVENT_UNLOCK_SCREEN = "common.event.UNLOCK_SCREEN"; 153 const std::string COMMON_EVENT_LOCK_SCREEN = "common.event.LOCK_SCREEN"; 154 const std::string DATABASE_TYPE[] = {"daily", "weekly", "monthly", "yearly", "event", "usageGroup"}; 155 const std::string SUFFIX_TYPE[] = {".db"}; 156 const std::string OPERATION_SYSTEM_LOCK = "SYSTEM_LOCK"; 157 const std::string OPERATION_SYSTEM_UNLOCK = "SYSTEM_UNLOCK"; 158 const std::string OPERATION_SYSTEM_SLEEP = "SYSTEM_SLEEP"; 159 const std::string OPERATION_SYSTEM_WAKEUP = "SYSTEM_WAKEUP"; 160 } // namespace DeviceUsageStats 161 } // namespace OHOS 162 #endif // BUNDLE_ACTIVE_CONSTANT_H 163 164