blob: 0437a6466fcf6415535cab3b5fec9f0b12ce7fd8 [file] [log] [blame]
Yifan Hong676447a2016-11-15 12:57:23 -08001/*
2 * Copyright (C) 2017 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 <iostream>
18#include <vintf/parse_xml.h>
Yifan Hongccf967b2017-01-18 11:04:19 -080019#include <vintf/parse_string.h>
Yifan Hong3daec812017-02-27 18:49:11 -080020#include <vintf/VintfObject.h>
Yifan Hong676447a2016-11-15 12:57:23 -080021
Yifan Hong1e5a0542017-04-28 14:37:56 -070022// A convenience binary to dump information available through libvintf.
Yifan Hong676447a2016-11-15 12:57:23 -080023int main(int, char **) {
24 using namespace ::android::vintf;
25
Yifan Hong1e5a0542017-04-28 14:37:56 -070026 std::cout << "======== Device HAL Manifest =========" << std::endl;
27
Yifan Hong3daec812017-02-27 18:49:11 -080028 const HalManifest *vm = VintfObject::GetDeviceHalManifest();
Yifan Hong676447a2016-11-15 12:57:23 -080029 if (vm != nullptr)
Yifan Hongd2b7e642017-02-17 10:15:32 -080030 std::cout << gHalManifestConverter(*vm);
Yifan Hongccf967b2017-01-18 11:04:19 -080031
Yifan Hong1e5a0542017-04-28 14:37:56 -070032 std::cout << "======== Framework HAL Manifest =========" << std::endl;
33
Yifan Hong3daec812017-02-27 18:49:11 -080034 const HalManifest *fm = VintfObject::GetFrameworkHalManifest();
35 if (fm != nullptr)
36 std::cout << gHalManifestConverter(*fm);
37
Yifan Hong1e5a0542017-04-28 14:37:56 -070038 std::cout << "======== Device Compatibility Matrix =========" << std::endl;
39
40 const CompatibilityMatrix *vcm = VintfObject::GetDeviceCompatibilityMatrix();
41 if (vcm != nullptr)
42 std::cout << gCompatibilityMatrixConverter(*vcm);
43
44 std::cout << "======== Framework Compatibility Matrix =========" << std::endl;
45
46 const CompatibilityMatrix *fcm = VintfObject::GetFrameworkCompatibilityMatrix();
47 if (fcm != nullptr)
48 std::cout << gCompatibilityMatrixConverter(*fcm);
49
50 std::cout << "======== Compatibility check =========" << std::endl;
51 std::cout << "Device HAL Manifest? " << (vm != nullptr) << std::endl
52 << "Device Compatibility Matrix? " << (vcm != nullptr) << std::endl
53 << "Framework HAL Manifest? " << (fm != nullptr) << std::endl
54 << "Framework Compatibility Matrix? " << (fcm != nullptr) << std::endl;
55 std::string error;
56 if (vm && fcm) {
57 bool compatible = vm->checkCompatibility(*fcm, &error);
58 std::cout << "Device HAL Manifest <==> Framework Compatibility Matrix? "
59 << compatible;
60 if (!compatible)
61 std::cout << ", " << error;
62 std::cout << std::endl;
63 }
64 if (fm && vcm) {
65 bool compatible = fm->checkCompatibility(*vcm, &error);
66 std::cout << "Framework HAL Manifest <==> Device Compatibility Matrix? "
67 << compatible;
68 if (!compatible)
69 std::cout << ", " << error;
70 std::cout << std::endl;
71 }
72
73 std::cout << "======== Runtime Info =========" << std::endl;
74
Yifan Hong3daec812017-02-27 18:49:11 -080075 const RuntimeInfo *ki = VintfObject::GetRuntimeInfo();
Yifan Hongccf967b2017-01-18 11:04:19 -080076 if (ki != nullptr)
77 std::cout << dump(*ki);
78 std::cout << std::endl;
Yifan Hong676447a2016-11-15 12:57:23 -080079}