1 /*
2  * Copyright (C) 2018 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 #pragma once
18 
19 #include <stddef.h>
20 #include <sys/socket.h>
21 #include <sys/types.h>
22 
23 #include <optional>
24 #include <string>
25 
26 #include <android-base/properties.h>
27 
28 // android/api-level.h
29 #define __ANDROID_API_P__ 28
30 #define __ANDROID_API_Q__ 29
31 #define __ANDROID_API_R__ 30
32 #define __ANDROID_API_S__ 31
33 #define __ANDROID_API_T__ 33
34 #define __ANDROID_API_U__ 34
35 #define __ANDROID_API_V__ 35
36 
37 // sys/system_properties.h
38 #define PROP_VALUE_MAX 92
39 
40 namespace android {
41 namespace init {
42 
43 // property_service.h
CanReadProperty(const std::string &,const std::string &)44 inline bool CanReadProperty(const std::string&, const std::string&) {
45     return true;
46 }
47 
48 // reboot_utils.h
49 inline void SetFatalRebootTarget(const std::optional<std::string>& = std::nullopt) {}
InitFatalReboot(int signal_number)50 inline void __attribute__((noreturn)) InitFatalReboot(int signal_number) {
51     abort();
52 }
53 
54 // selabel.h
SelabelInitialize()55 inline void SelabelInitialize() {}
SelabelLookupFileContext(const std::string &,int,std::string *)56 inline bool SelabelLookupFileContext(const std::string&, int, std::string*) {
57     return false;
58 }
59 
60 // selinux.h
SelinuxGetVendorAndroidVersion()61 inline int SelinuxGetVendorAndroidVersion() {
62     return 10000;
63 }
64 
65 }  // namespace init
66 }  // namespace android
67