blob: c6425d8c2f2d9c4c381c625eca829f9766f7871d [file] [log] [blame]
Michael Schwartz97dc0f92017-05-08 14:07:14 -07001/*
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#include "utils.h"
18
Yifan Hongd14640a2018-02-27 18:35:39 -080019#ifdef LIBVINTF_TARGET
Yifan Hong10d86222018-04-06 15:41:05 -070020#include <android-base/logging.h>
Yifan Hongd14640a2018-02-27 18:35:39 -080021#include <android-base/properties.h>
22#endif
23
Michael Schwartz97dc0f92017-05-08 14:07:14 -070024namespace android {
25namespace vintf {
26namespace details {
27
Yifan Hong8640cd12017-05-17 12:02:28 -070028static PartitionMounter partitionMounter;
29PartitionMounter* gPartitionMounter = &partitionMounter;
Yifan Hong29bb2d42017-09-27 13:28:00 -070030
31static ObjectFactory<RuntimeInfo> runtimeInfoFactory;
32ObjectFactory<RuntimeInfo>* gRuntimeInfoFactory = &runtimeInfoFactory;
33
Yifan Hongd14640a2018-02-27 18:35:39 -080034#ifdef LIBVINTF_TARGET
35class DevicePropertyFetcher : public PropertyFetcher {
36 public:
37 std::string getProperty(const std::string& key,
38 const std::string& defaultValue) const override {
39 return android::base::GetProperty(key, defaultValue);
40 }
41 uint64_t getUintProperty(const std::string& key, uint64_t defaultValue,
42 uint64_t max) const override {
43 return android::base::GetUintProperty(key, defaultValue, max);
44 }
45 bool getBoolProperty(const std::string& key, bool defaultValue) const override {
46 return android::base::GetBoolProperty(key, defaultValue);
47 }
48};
49const PropertyFetcher& getPropertyFetcher() {
50 static DevicePropertyFetcher fetcher;
51 return fetcher;
52}
53#else
54const PropertyFetcher& getPropertyFetcher() {
55 static PropertyFetcher fetcher;
56 return fetcher;
57}
58#endif
59
Michael Schwartz97dc0f92017-05-08 14:07:14 -070060} // namespace details
61} // namespace vintf
62} // namespace android