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