Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -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; |
| 20 | |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 21 | /** |
| 22 | * Java API for ::android::vintf::RuntimeInfo. Methods return null / 0 on any error. |
| 23 | * |
| 24 | * @hide |
| 25 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 26 | @TestApi |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 27 | public class VintfRuntimeInfo { |
| 28 | |
| 29 | private VintfRuntimeInfo() {} |
| 30 | |
| 31 | /** |
| 32 | * @return /sys/fs/selinux/policyvers, via security_policyvers() native call |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 33 | * |
| 34 | * @hide |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 35 | */ |
| 36 | public static native long getKernelSepolicyVersion(); |
| 37 | /** |
| 38 | * @return content of /proc/cpuinfo |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 39 | * |
| 40 | * @hide |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 41 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 42 | @TestApi |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 43 | public static native String getCpuInfo(); |
| 44 | /** |
| 45 | * @return os name extracted from uname() native call |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 46 | * |
| 47 | * @hide |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 48 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 49 | @TestApi |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 50 | public static native String getOsName(); |
| 51 | /** |
| 52 | * @return node name extracted from uname() native call |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 53 | * |
| 54 | * @hide |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 55 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 56 | @TestApi |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 57 | public static native String getNodeName(); |
| 58 | /** |
| 59 | * @return os release extracted from uname() native call |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 60 | * |
| 61 | * @hide |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 62 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 63 | @TestApi |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 64 | public static native String getOsRelease(); |
| 65 | /** |
| 66 | * @return os version extracted from uname() native call |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 67 | * |
| 68 | * @hide |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 69 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 70 | @TestApi |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 71 | public static native String getOsVersion(); |
| 72 | /** |
| 73 | * @return hardware id extracted from uname() native call |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 74 | * |
| 75 | * @hide |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 76 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 77 | @TestApi |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 78 | public static native String getHardwareId(); |
| 79 | /** |
| 80 | * @return kernel version extracted from uname() native call. Format is |
| 81 | * {@code x.y.z}. |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 82 | * |
| 83 | * @hide |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 84 | */ |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 85 | @TestApi |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 86 | public static native String getKernelVersion(); |
| 87 | /** |
| 88 | * @return libavb version in OS. Format is {@code x.y}. |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 89 | * |
| 90 | * @hide |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 91 | */ |
| 92 | public static native String getBootAvbVersion(); |
| 93 | /** |
| 94 | * @return libavb version in bootloader. Format is {@code x.y}. |
Yifan Hong | 5857870 | 2019-01-11 16:35:50 -0800 | [diff] [blame] | 95 | * |
| 96 | * @hide |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 97 | */ |
| 98 | public static native String getBootVbmetaAvbVersion(); |
Yifan Hong | 1bda673 | 2017-04-26 11:38:01 -0700 | [diff] [blame] | 99 | } |