diff --git a/Android.bp b/Android.bp
new file mode 100644
index 00000000..74cf9b4b
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,3 @@
+subdirs = [
+ "vr",
+]
diff --git a/device.mk b/device.mk
index 3d9db364..57e5e557 100644
--- a/device.mk
+++ b/device.mk
@@ -153,6 +153,8 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml \
frameworks/native/data/etc/android.hardware.nfc.hce.xml:system/etc/permissions/android.hardware.nfc.hce.xml \
frameworks/native/data/etc/android.hardware.nfc.hcef.xml:system/etc/permissions/android.hardware.nfc.hcef.xml \
+ frameworks/native/data/etc/android.hardware.vr.headtracking-0.xml:system/etc/permissions/android.hardware.vr.headtracking.xml \
+ frameworks/native/data/etc/android.hardware.vr.high_performance.xml:system/etc/permissions/android.hardware.vr.high_performance.xml \
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/init.power.sh:system/bin/init.power.sh \
@@ -319,6 +321,10 @@ PRODUCT_PACKAGES += \
android.hardware.gnss@1.0-impl-qti \
android.hardware.gnss@1.0-service-qti
+# VR HAL
+PRODUCT_PACKAGES += \
+ android.hardware.vr@1.0-service.wahoo \
+
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/sec_config:system/etc/sec_config
diff --git a/manifest.xml b/manifest.xml
index c0d7411b..74c84d9f 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -67,4 +67,10 @@
1.0
+
+ android.hardware.vr
+ hwbinder
+
+ 1.0
+
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index 7e798a43..b23b0b2c 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -99,6 +99,7 @@
# files in /vendor
/vendor/bin/hw/android\.hardware\.dumpstate@1\.0-service.wahoo u:object_r:hal_dumpstate_impl_exec:s0
+/vendor/bin/hw/android\.hardware\.vr@1\.0-service.wahoo u:object_r:hal_vr_default_exec:s0
/vendor/bin/perfd u:object_r:perfd_exec:s0
/vendor/bin/thermal-engine u:object_r:thermal-engine_exec:s0
/vendor/bin/sensors.qcom u:object_r:sensors_exec:s0
diff --git a/vr/Android.bp b/vr/Android.bp
new file mode 100644
index 00000000..99aef7d8
--- /dev/null
+++ b/vr/Android.bp
@@ -0,0 +1,30 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+cc_binary {
+ name: "android.hardware.vr@1.0-service.wahoo",
+ relative_install_path: "hw",
+ init_rc: ["android.hardware.vr@1.0-service.wahoo.rc"],
+ srcs: ["service.cpp", "VrDevice.cpp"],
+ cflags: ["-Werror", "-Wall"],
+ shared_libs: [
+ "libbase",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libutils",
+ "android.hardware.vr@1.0",
+ ],
+ proprietary: true,
+}
diff --git a/vr/NOTICE b/vr/NOTICE
new file mode 100644
index 00000000..667db97b
--- /dev/null
+++ b/vr/NOTICE
@@ -0,0 +1,10 @@
+Copyright (C) 2017 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/vr/VrDevice.cpp b/vr/VrDevice.cpp
new file mode 100644
index 00000000..2be95840
--- /dev/null
+++ b/vr/VrDevice.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "VrDevice"
+
+#include "VrDevice.h"
+
+namespace android {
+namespace hardware {
+namespace vr {
+namespace V1_0 {
+namespace implementation {
+
+VrDevice::VrDevice() {}
+
+Return VrDevice::init() {
+ // NOOP
+ return Void();
+}
+
+Return VrDevice::setVrMode(bool /* enabled */) {
+ // TODO(b/36514493): start or stop using thermal engine VR profile.
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace vr
+} // namespace hardware
+} // namespace android
diff --git a/vr/VrDevice.h b/vr/VrDevice.h
new file mode 100644
index 00000000..cd754508
--- /dev/null
+++ b/vr/VrDevice.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef ANDROID_HARDWARE_VR_V1_0_VR_H
+#define ANDROID_HARDWARE_VR_V1_0_VR_H
+
+#include
+
+namespace android {
+namespace hardware {
+namespace vr {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::vr::V1_0::IVr;
+using ::android::hardware::Return;
+
+struct VrDevice : public IVr {
+ VrDevice();
+
+ Return init() override;
+ Return setVrMode(bool enabled) override;
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace vr
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_VR_V1_0_VR_H
diff --git a/vr/android.hardware.vr@1.0-service.wahoo.rc b/vr/android.hardware.vr@1.0-service.wahoo.rc
new file mode 100644
index 00000000..7a66e903
--- /dev/null
+++ b/vr/android.hardware.vr@1.0-service.wahoo.rc
@@ -0,0 +1,4 @@
+service vr-wahoo-1-0 /vendor/bin/hw/android.hardware.vr@1.0-service.wahoo
+ class hal
+ user system
+ group system
diff --git a/vr/service.cpp b/vr/service.cpp
new file mode 100644
index 00000000..a04991b0
--- /dev/null
+++ b/vr/service.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "android.hardware.vr@1.0-service.wahoo"
+
+#include
+#include
+#include
+#include
+
+#include "VrDevice.h"
+
+using ::android::hardware::configureRpcThreadpool;
+using ::android::hardware::joinRpcThreadpool;
+using ::android::hardware::vr::V1_0::implementation::VrDevice;
+using ::android::hardware::vr::V1_0::IVr;
+using ::android::sp;
+
+int main(int /* argc */, char* /* argv */ []) {
+ sp vr = new VrDevice;
+ configureRpcThreadpool(1, true);
+ CHECK_EQ(vr->registerAsService(), android::NO_ERROR)
+ << "Failed to register vr HAL";
+ joinRpcThreadpool();
+ return 0;
+}