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