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 
33 // sys/system_properties.h
34 #define PROP_VALUE_MAX 92
35 
36 namespace android {
37 namespace init {
38 
39 // property_service.h
CanReadProperty(const std::string &,const std::string &)40 inline bool CanReadProperty(const std::string&, const std::string&) {
41     return true;
42 }
43 
44 // reboot_utils.h
45 inline void SetFatalRebootTarget(const std::optional<std::string>& = std::nullopt) {}
InitFatalReboot(int signal_number)46 inline void __attribute__((noreturn)) InitFatalReboot(int signal_number) {
47     abort();
48 }
49 
50 // selabel.h
SelabelInitialize()51 inline void SelabelInitialize() {}
SelabelLookupFileContext(const std::string &,int,std::string *)52 inline bool SelabelLookupFileContext(const std::string&, int, std::string*) {
53     return false;
54 }
55 
56 // selinux.h
SelinuxGetVendorAndroidVersion()57 inline int SelinuxGetVendorAndroidVersion() {
58     return 10000;
59 }
60 
61 }  // namespace init
62 }  // namespace android
63