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_MODULE_RECORD_H
17 #define BUNDLE_ACTIVE_MODULE_RECORD_H
18 
19 #include "bundle_active_form_record.h"
20 
21 namespace OHOS {
22 namespace DeviceUsageStats {
23 class BundleActiveModuleRecord : public Parcelable {
24 public:
25     void AddOrUpdateOneFormRecord(const std::string formName, const int32_t formDimension,
26         const int64_t formId, const int64_t timeStamp, const int32_t uid);
27     void RemoveOneFormRecord(const std::string formName, const int32_t formDimension,
28         const int64_t formId);
29     void UpdateModuleRecord(int64_t timeStamp);
30     BundleActiveModuleRecord();
~BundleActiveModuleRecord()31     ~BundleActiveModuleRecord() {}
32     static bool cmp(const BundleActiveModuleRecord& moduleRecordA, const BundleActiveModuleRecord& moduleRecordB);
33     bool Marshalling(Parcel &parcel) const override;
34     static std::shared_ptr<BundleActiveModuleRecord> UnMarshalling(Parcel &parcel);
35     std::string ToString();
36 
37 public:
38     std::string deviceId_;
39     std::string bundleName_;
40     std::string moduleName_;
41     std::string abilityName_;
42     uint32_t appLabelId_;
43     uint32_t labelId_;
44     uint32_t descriptionId_;
45     uint32_t abilityLableId_;
46     uint32_t abilityDescriptionId_;
47     uint32_t abilityIconId_;
48     int32_t launchedCount_;
49     int64_t lastModuleUsedTime_;
50     int32_t userId_;
51     int32_t uid_;
52     bool removed_;
53     bool installFreeSupported_;
54     bool isNewAdded_;
55     std::vector<BundleActiveFormRecord> formRecords_; // key:formid, value:formhistory
56 };
57 }  // namespace DeviceUsageStats
58 }  // namespace OHOS
59 #endif  // BUNDLE_ACTIVE_MODULE_RECORD_H