1 /*
2 * Copyright (c) 2021, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "PackageInfoTestUtils.h"
18
19 namespace android {
20 namespace automotive {
21 namespace watchdog {
22
23 using ::aidl::android::automotive::watchdog::internal::ApplicationCategoryType;
24 using ::aidl::android::automotive::watchdog::internal::ComponentType;
25 using ::aidl::android::automotive::watchdog::internal::PackageInfo;
26 using ::aidl::android::automotive::watchdog::internal::UidType;
27
constructPackageInfo(const char * packageName,int32_t uid,UidType uidType,ComponentType componentType,ApplicationCategoryType appCategoryType,std::vector<std::string> sharedUidPackages)28 PackageInfo constructPackageInfo(const char* packageName, int32_t uid, UidType uidType,
29 ComponentType componentType,
30 ApplicationCategoryType appCategoryType,
31 std::vector<std::string> sharedUidPackages) {
32 PackageInfo packageInfo;
33 packageInfo.packageIdentifier.name = packageName;
34 packageInfo.packageIdentifier.uid = uid;
35 packageInfo.uidType = uidType;
36 packageInfo.componentType = componentType;
37 packageInfo.appCategoryType = appCategoryType;
38 packageInfo.sharedUidPackages = sharedUidPackages;
39 return packageInfo;
40 }
41
constructAppPackageInfo(const char * packageName,const ComponentType componentType,const ApplicationCategoryType appCategoryType,const std::vector<std::string> & sharedUidPackages)42 PackageInfo constructAppPackageInfo(const char* packageName, const ComponentType componentType,
43 const ApplicationCategoryType appCategoryType,
44 const std::vector<std::string>& sharedUidPackages) {
45 return constructPackageInfo(packageName, 0, UidType::APPLICATION, componentType,
46 appCategoryType, sharedUidPackages);
47 }
48
49 } // namespace watchdog
50 } // namespace automotive
51 } // namespace android
52