1 /*
2  * Copyright (C) 2019 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 <vintf/Level.h>
18 #include <vintf/Version.h>
19 #include <vintf/VersionRange.h>
20 #include <vintf/constants.h>
21 
22 namespace android {
23 namespace vintf {
24 namespace details {
25 
26 // All <version> tags in <hal format="aidl"> tags are ignored, and an implicit version
27 // is inserted so that compatibility checks for different HAL formats can be unified.
28 // This is an implementation detail of libvintf and won't be written to actual XML files.
29 // 0.0 is not used because FQName / FqInstance consider it an invalid value.
30 static constexpr size_t kFakeAidlMajorVersion = SIZE_MAX;
31 static constexpr VersionRange kDefaultAidlVersionRange{kFakeAidlMajorVersion,
32                                                        kDefaultAidlMinorVersion};
33 static constexpr Version kDefaultAidlVersion = kDefaultAidlVersionRange.minVer();
34 
35 #define VINTF_SUB_DIR "etc/vintf/"
36 constexpr const char* kVintfSubDir = VINTF_SUB_DIR;
37 #define SYSTEM_VINTF_DIR "/system/etc/vintf/"
38 constexpr const char* kSystemVintfDir = SYSTEM_VINTF_DIR;
39 #define VENDOR_VINTF_DIR "/vendor/etc/vintf/"
40 constexpr const char* kVendorVintfDir = VENDOR_VINTF_DIR;
41 #define ODM_VINTF_DIR "/odm/etc/vintf/"
42 constexpr const char* kOdmVintfDir = ODM_VINTF_DIR;
43 #define PRODUCT_VINTF_DIR "/product/etc/vintf/"
44 constexpr const char* kProductVintfDir = PRODUCT_VINTF_DIR;
45 #define SYSTEM_EXT_VINTF_DIR "/system_ext/etc/vintf/"
46 constexpr const char* kSystemExtVintfDir = SYSTEM_EXT_VINTF_DIR;
47 
48 constexpr const char* kVendorManifest = VENDOR_VINTF_DIR "manifest.xml";
49 constexpr const char* kSystemManifest = SYSTEM_VINTF_DIR "manifest.xml";
50 constexpr const char* kVendorMatrix = VENDOR_VINTF_DIR "compatibility_matrix.xml";
51 constexpr const char* kOdmManifest = ODM_VINTF_DIR "manifest.xml";
52 constexpr const char* kProductMatrix = PRODUCT_VINTF_DIR "compatibility_matrix.xml";
53 constexpr const char* kProductManifest = PRODUCT_VINTF_DIR "manifest.xml";
54 constexpr const char* kSystemExtManifest = SYSTEM_EXT_VINTF_DIR "manifest.xml";
55 
56 constexpr const char* kVendorManifestFragmentDir = VENDOR_VINTF_DIR "manifest/";
57 constexpr const char* kSystemManifestFragmentDir = SYSTEM_VINTF_DIR "manifest/";
58 constexpr const char* kOdmManifestFragmentDir = ODM_VINTF_DIR "manifest/";
59 constexpr const char* kProductManifestFragmentDir = PRODUCT_VINTF_DIR "manifest/";
60 constexpr const char* kSystemExtManifestFragmentDir = SYSTEM_EXT_VINTF_DIR "manifest/";
61 
62 constexpr const char* kVendorLegacyManifest = "/vendor/manifest.xml";
63 constexpr const char* kVendorLegacyMatrix = "/vendor/compatibility_matrix.xml";
64 constexpr const char* kSystemLegacyManifest = "/system/manifest.xml";
65 constexpr const char* kSystemLegacyMatrix = "/system/compatibility_matrix.xml";
66 #define ODM_LEGACY_VINTF_DIR "/odm/etc/"
67 constexpr const char* kOdmLegacyVintfDir = ODM_LEGACY_VINTF_DIR;
68 constexpr const char* kOdmLegacyManifest = ODM_LEGACY_VINTF_DIR "manifest.xml";
69 
70 constexpr const char* kApexInfoFile = "/apex/apex-info-list.xml";
71 constexpr const char* kBootstrapApexInfoFile = "/bootstrap-apex/apex-info-list.xml";
72 
73 #undef SYSTEM_VINTF_DIR
74 #undef VENDOR_VINTF_DIR
75 #undef ODM_VINTF_DIR
76 #undef PRODUCT_VINTF_DIR
77 #undef SYSTEM_EXT_VINTF_DIR
78 #undef ODM_LEGACY_VINTF_DIR
79 
80 // Device manifest with level T must not set kernel level.
81 constexpr Level kEnforceDeviceManifestNoKernelLevel = Level::T;
82 
83 }  // namespace details
84 }  // namespace vintf
85 }  // namespace android
86