1 /* 2 * Copyright (c) 2021 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 FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_MODULE_USAGE_RECORD_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_MODULE_USAGE_RECORD_H 18 19 #include <string> 20 21 #include "ability_info.h" 22 #include "parcel.h" 23 #include "refbase.h" 24 25 namespace OHOS { 26 namespace AppExecFwk { 27 namespace UsageRecordKey { 28 const std::string LAUNCHED_COUNT = "launchedCount"; 29 const std::string LAST_LAUNCH_TIME = "lastLaunchTime"; 30 const std::string IS_REMOVED = "isRemoved"; 31 const std::string ABILITY_NAME = "abilityName"; 32 const std::string SCHEMA_LAST_LAUNCH_TIME = "$.lastLaunchTime"; 33 } // UsageRecordKey 34 35 struct ModuleUsageRecord : public Parcelable { 36 std::string bundleName; 37 uint32_t appLabelId = 0; 38 std::string name; 39 uint32_t labelId = 0; 40 uint32_t descriptionId = 0; 41 std::string abilityName; 42 uint32_t abilityLabelId = 0; 43 uint32_t abilityDescriptionId = 0; 44 uint32_t abilityIconId = 0; 45 uint32_t launchedCount = 0; 46 int64_t lastLaunchTime = 0; 47 bool removed = false; 48 bool installationFreeSupported = true; 49 50 bool ReadFromParcel(Parcel &parcel); 51 virtual bool Marshalling(Parcel &parcel) const override; 52 static ModuleUsageRecord *Unmarshalling(Parcel &parcel); 53 std::string ToString() const; 54 bool FromJsonString(const std::string &jsonString); 55 }; 56 } // namespace AppExecFwk 57 } // namespace OHOS 58 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_BASE_INCLUDE_MODULE_USAGE_RECORD_H