blob: 1c78b081120a2dee22529bc2b33b8f8e001f9300 [file] [log] [blame]
Yifan Hongbecc56d2017-04-05 14:42:05 -07001/*
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
17package android.os;
18
Yifan Hong58578702019-01-11 16:35:50 -080019import android.annotation.TestApi;
Yifan Hongbecc56d2017-04-05 14:42:05 -070020
Yifan Hong58578702019-01-11 16:35:50 -080021import java.util.Map;
Yifan Hongbecc56d2017-04-05 14:42:05 -070022
Yifan Hong687113a2017-05-04 13:05:24 -070023/**
24 * Java API for libvintf.
Yifan Hong58578702019-01-11 16:35:50 -080025 *
Yifan Hong687113a2017-05-04 13:05:24 -070026 * @hide
27 */
Yifan Hong58578702019-01-11 16:35:50 -080028@TestApi
Yifan Hongbecc56d2017-04-05 14:42:05 -070029public class VintfObject {
30
Yifan Hongbecc56d2017-04-05 14:42:05 -070031 /**
Yifan Hong75ffd662017-05-01 18:43:36 -070032 * Slurps all device information (both manifests and both matrices)
33 * and report them.
Yifan Hongbecc56d2017-04-05 14:42:05 -070034 * If any error in getting one of the manifests, it is not included in
35 * the list.
Yifan Hong58578702019-01-11 16:35:50 -080036 *
37 * @hide
Yifan Hongbecc56d2017-04-05 14:42:05 -070038 */
Yifan Hong58578702019-01-11 16:35:50 -080039 @TestApi
Yifan Hong75ffd662017-05-01 18:43:36 -070040 public static native String[] report();
Yifan Hongbecc56d2017-04-05 14:42:05 -070041
42 /**
43 * Verify that the given metadata for an OTA package is compatible with
44 * this device.
45 *
Bowgo Tsai78934c92017-11-17 17:18:50 +080046 * @param packageInfo a list of serialized form of HalManifest's /
Yifan Hongbecc56d2017-04-05 14:42:05 -070047 * CompatibilityMatri'ces (XML).
48 * @return = 0 if success (compatible)
49 * > 0 if incompatible
50 * < 0 if any error (mount partition fails, illformed XML, etc.)
Yifan Hong58578702019-01-11 16:35:50 -080051 *
52 * @hide
Yifan Hongbecc56d2017-04-05 14:42:05 -070053 */
54 public static native int verify(String[] packageInfo);
55
Bowgo Tsai78934c92017-11-17 17:18:50 +080056 /**
57 * Verify Vintf compatibility on the device without checking AVB
58 * (Android Verified Boot). It is useful to verify a running system
59 * image where AVB check is irrelevant.
60 *
61 * @return = 0 if success (compatible)
62 * > 0 if incompatible
63 * < 0 if any error (mount partition fails, illformed XML, etc.)
Yifan Hong58578702019-01-11 16:35:50 -080064 *
65 * @hide
Bowgo Tsai78934c92017-11-17 17:18:50 +080066 */
67 public static native int verifyWithoutAvb();
68
Yifan Hong687113a2017-05-04 13:05:24 -070069 /**
70 * @return a list of HAL names and versions that is supported by this
71 * device as stated in device and framework manifests. For example,
72 * ["android.hidl.manager@1.0", "android.hardware.camera.device@1.0",
73 * "android.hardware.camera.device@3.2"]. There are no duplicates.
Yifan Hong58578702019-01-11 16:35:50 -080074 *
Yifan Hong0cdba322019-09-10 19:59:24 -070075 * For AIDL HALs, the version is stripped away
76 * (e.g. "android.hardware.light").
Yifan Hong58578702019-01-11 16:35:50 -080077 * @hide
Yifan Hong687113a2017-05-04 13:05:24 -070078 */
Yifan Hong58578702019-01-11 16:35:50 -080079 @TestApi
Yifan Hong687113a2017-05-04 13:05:24 -070080 public static native String[] getHalNamesAndVersions();
81
82 /**
83 * @return the BOARD_SEPOLICY_VERS build flag available in device manifest.
Yifan Hong58578702019-01-11 16:35:50 -080084 *
85 * @hide
Yifan Hong687113a2017-05-04 13:05:24 -070086 */
Yifan Hong58578702019-01-11 16:35:50 -080087 @TestApi
Yifan Hong687113a2017-05-04 13:05:24 -070088 public static native String getSepolicyVersion();
89
90 /**
91 * @return a list of VNDK snapshots supported by the framework, as
92 * specified in framework manifest. For example,
Yifan Hong8da8798c2018-01-10 16:04:18 -080093 * [("27", ["libjpeg.so", "libbase.so"]),
94 * ("28", ["libjpeg.so", "libbase.so"])]
Yifan Hong58578702019-01-11 16:35:50 -080095 *
96 * @hide
Yifan Hong687113a2017-05-04 13:05:24 -070097 */
Yifan Hong58578702019-01-11 16:35:50 -080098 @TestApi
Yifan Hong687113a2017-05-04 13:05:24 -070099 public static native Map<String, String[]> getVndkSnapshots();
Yifan Hong0e5e4722018-02-07 14:16:21 -0800100
101 /**
Yifan Hong58578702019-01-11 16:35:50 -0800102 * @return Target Framework Compatibility Matrix (FCM) version, a number
103 * specified in the device manifest indicating the FCM version that the
104 * device manifest implements. Null if device manifest doesn't specify this
105 * number (for legacy devices).
106 *
107 * @hide
Yifan Hong0e5e4722018-02-07 14:16:21 -0800108 */
Yifan Hong58578702019-01-11 16:35:50 -0800109 @TestApi
Yifan Hong0e5e4722018-02-07 14:16:21 -0800110 public static native Long getTargetFrameworkCompatibilityMatrixVersion();
Yifan Hong58578702019-01-11 16:35:50 -0800111
112 private VintfObject() {}
Yifan Hongbecc56d2017-04-05 14:42:05 -0700113}