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