Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 1 | /* |
| 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 | package android.os; |
| 18 | |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 19 | import android.annotation.TestApi; |
Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 20 | |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 21 | import java.util.Map; |
Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 22 | |
Yifan Hong | 687113a | 2017-05-04 13:05:24 -0700 | [diff] [blame] | 23 | /** |
| 24 | * Java API for libvintf. |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 25 | * |
Yifan Hong | 687113a | 2017-05-04 13:05:24 -0700 | [diff] [blame] | 26 | * @hide |
| 27 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 28 | @TestApi |
Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 29 | public class VintfObject { |
| 30 | |
Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 31 | /** |
Yifan Hong | 75ffd66 | 2017-05-01 18:43:36 -0700 | [diff] [blame] | 32 | * Slurps all device information (both manifests and both matrices) |
| 33 | * and report them. |
Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 34 | * If any error in getting one of the manifests, it is not included in |
| 35 | * the list. |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 36 | * |
| 37 | * @hide |
Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 38 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 39 | @TestApi |
Yifan Hong | 75ffd66 | 2017-05-01 18:43:36 -0700 | [diff] [blame] | 40 | public static native String[] report(); |
Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * Verify that the given metadata for an OTA package is compatible with |
| 44 | * this device. |
| 45 | * |
Bowgo Tsai | 78934c9 | 2017-11-17 17:18:50 +0800 | [diff] [blame] | 46 | * @param packageInfo a list of serialized form of HalManifest's / |
Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 47 | * 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 Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 51 | * |
| 52 | * @hide |
Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 53 | */ |
| 54 | public static native int verify(String[] packageInfo); |
| 55 | |
Bowgo Tsai | 78934c9 | 2017-11-17 17:18:50 +0800 | [diff] [blame] | 56 | /** |
| 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 Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 64 | * |
| 65 | * @hide |
Bowgo Tsai | 78934c9 | 2017-11-17 17:18:50 +0800 | [diff] [blame] | 66 | */ |
| 67 | public static native int verifyWithoutAvb(); |
| 68 | |
Yifan Hong | 687113a | 2017-05-04 13:05:24 -0700 | [diff] [blame] | 69 | /** |
| 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 Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 74 | * |
Yifan Hong | 0cdba32 | 2019-09-10 19:59:24 -0700 | [diff] [blame] | 75 | * For AIDL HALs, the version is stripped away |
| 76 | * (e.g. "android.hardware.light"). |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 77 | * @hide |
Yifan Hong | 687113a | 2017-05-04 13:05:24 -0700 | [diff] [blame] | 78 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 79 | @TestApi |
Yifan Hong | 687113a | 2017-05-04 13:05:24 -0700 | [diff] [blame] | 80 | public static native String[] getHalNamesAndVersions(); |
| 81 | |
| 82 | /** |
| 83 | * @return the BOARD_SEPOLICY_VERS build flag available in device manifest. |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 84 | * |
| 85 | * @hide |
Yifan Hong | 687113a | 2017-05-04 13:05:24 -0700 | [diff] [blame] | 86 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 87 | @TestApi |
Yifan Hong | 687113a | 2017-05-04 13:05:24 -0700 | [diff] [blame] | 88 | 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 Hong | 8da8798c | 2018-01-10 16:04:18 -0800 | [diff] [blame] | 93 | * [("27", ["libjpeg.so", "libbase.so"]), |
| 94 | * ("28", ["libjpeg.so", "libbase.so"])] |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 95 | * |
| 96 | * @hide |
Yifan Hong | 687113a | 2017-05-04 13:05:24 -0700 | [diff] [blame] | 97 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 98 | @TestApi |
Yifan Hong | 687113a | 2017-05-04 13:05:24 -0700 | [diff] [blame] | 99 | public static native Map<String, String[]> getVndkSnapshots(); |
Yifan Hong | 0e5e472 | 2018-02-07 14:16:21 -0800 | [diff] [blame] | 100 | |
| 101 | /** |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 102 | * @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 Hong | 0e5e472 | 2018-02-07 14:16:21 -0800 | [diff] [blame] | 108 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 109 | @TestApi |
Yifan Hong | 0e5e472 | 2018-02-07 14:16:21 -0800 | [diff] [blame] | 110 | public static native Long getTargetFrameworkCompatibilityMatrixVersion(); |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 111 | |
| 112 | private VintfObject() {} |
Yifan Hong | becc56d | 2017-04-05 14:42:05 -0700 | [diff] [blame] | 113 | } |