Home | History | Annotate | Download | only in os
      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 
     19 import android.annotation.TestApi;
     20 
     21 import java.util.Map;
     22 
     23 /**
     24  * Java API for libvintf.
     25  *
     26  * @hide
     27  */
     28 @TestApi
     29 public class VintfObject {
     30 
     31     /**
     32      * Slurps all device information (both manifests and both matrices)
     33      * and report them.
     34      * If any error in getting one of the manifests, it is not included in
     35      * the list.
     36      *
     37      * @hide
     38      */
     39     @TestApi
     40     public static native String[] report();
     41 
     42     /**
     43      * Verify that the given metadata for an OTA package is compatible with
     44      * this device.
     45      *
     46      * @param packageInfo a list of serialized form of HalManifest's /
     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.)
     51      *
     52      * @hide
     53      */
     54     public static native int verify(String[] packageInfo);
     55 
     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.)
     64      *
     65      * @hide
     66      */
     67     public static native int verifyWithoutAvb();
     68 
     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 (at) 1.0", "android.hardware.camera.device (at) 1.0",
     73      *  "android.hardware.camera.device (at) 3.2"]. There are no duplicates.
     74      *
     75      * @hide
     76      */
     77     @TestApi
     78     public static native String[] getHalNamesAndVersions();
     79 
     80     /**
     81      * @return the BOARD_SEPOLICY_VERS build flag available in device manifest.
     82      *
     83      * @hide
     84      */
     85     @TestApi
     86     public static native String getSepolicyVersion();
     87 
     88     /**
     89      * @return a list of VNDK snapshots supported by the framework, as
     90      * specified in framework manifest. For example,
     91      * [("27", ["libjpeg.so", "libbase.so"]),
     92      *  ("28", ["libjpeg.so", "libbase.so"])]
     93      *
     94      * @hide
     95      */
     96     @TestApi
     97     public static native Map<String, String[]> getVndkSnapshots();
     98 
     99     /**
    100      * @return Target Framework Compatibility Matrix (FCM) version, a number
    101      * specified in the device manifest indicating the FCM version that the
    102      * device manifest implements. Null if device manifest doesn't specify this
    103      * number (for legacy devices).
    104      *
    105      * @hide
    106      */
    107     @TestApi
    108     public static native Long getTargetFrameworkCompatibilityMatrixVersion();
    109 
    110     private VintfObject() {}
    111 }
    112