Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4eec20f authored by Alex Vakulenko's avatar Alex Vakulenko Committed by Jiwen 'Steve' Cai
Browse files

Add DaydreamVR native libraries and services

Upstreaming the main VR system components from master-dreamos-dev
into goog/master.

Bug: None
Test: `m -j32` succeeds. Sailfish boots and basic_vr sample app works
Change-Id: I853015872afc443aecee10411ef2d6b79184d051
parent c34e059b
Loading
Loading
Loading
Loading
+80 −0
Original line number Diff line number Diff line
/*
 * 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_VR_MANAGER_H
#define ANDROID_VR_MANAGER_H

#include <binder/IInterface.h>

namespace android {

// Must be kept in sync with interface defined in IVrStateCallbacks.aidl.

class IVrStateCallbacks : public IInterface {
public:
    DECLARE_META_INTERFACE(VrStateCallbacks)

    virtual void onVrStateChanged(bool enabled) = 0;
};

enum VrStateCallbacksTransaction {
    ON_VR_STATE_CHANGED = IBinder::FIRST_CALL_TRANSACTION,
};

class BnVrStateCallbacks : public BnInterface<IVrStateCallbacks> {
public:
    status_t onTransact(uint32_t code, const Parcel& data,
                        Parcel* reply, uint32_t flags = 0) override;
};


// Must be kept in sync with interface defined in IVrManager.aidl.

class IVrManager : public IInterface {
public:
    DECLARE_META_INTERFACE(VrManager)

    virtual void registerListener(const sp<IVrStateCallbacks>& cb) = 0;
    virtual void unregisterListener(const sp<IVrStateCallbacks>& cb) = 0;
    virtual bool getVrModeState() = 0;
};

enum VrManagerTransaction {
    REGISTER_LISTENER = IBinder::FIRST_CALL_TRANSACTION,
    UNREGISTER_LISTENER,
    GET_VR_MODE_STATE,
};

enum class VrDisplayStateTransaction {
  ON_DISPLAY_STATE_CHANGED = IBinder::FIRST_CALL_TRANSACTION,
};

class IVrDisplayStateService : public IInterface {
public:
    DECLARE_META_INTERFACE(VrDisplayStateService)

    virtual void displayAvailable(bool available) = 0;
};

class BnVrDisplayStateService : public BnInterface<IVrDisplayStateService> {
public:
    status_t onTransact(uint32_t code, const Parcel &data, Parcel *reply,
                        uint32_t flags = 0) override;
};

};  // namespace android

#endif // ANDROID_VR_MANAGER_H

libs/vr/.clang-format

0 → 100644
+5 −0
Original line number Diff line number Diff line
BasedOnStyle: Google
DerivePointerAlignment: false
PointerAlignment: Left
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false

libs/vr/Android.bp

0 → 100644
+3 −0
Original line number Diff line number Diff line
subdirs = [
    "*",
]

libs/vr/CPPLINT.cfg

0 → 100644
+2 −0
Original line number Diff line number Diff line
set noparent
filter=-build/include_order,-legal/copyright,-build/include,-build/c++11,+build/include_alpha
+57 −0
Original line number Diff line number Diff line
# Copyright (C) 2016 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.

LOCAL_PATH := $(call my-dir)

sourceFiles := \
	buffer_hub_client.cpp \
	buffer_hub_rpc.cpp \
	ion_buffer.cpp

includeFiles := \
	$(LOCAL_PATH)/include

staticLibraries := \
	libchrome \
	libdvrcommon \
	libpdx_default_transport \

sharedLibraries := \
	libbase \
	libcutils \
	libhardware \
	liblog \
	libui \
	libutils

include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(sourceFiles)
LOCAL_C_INCLUDES := $(includeFiles)
LOCAL_CFLAGS := -DLOG_TAG=\"libbufferhub\"
LOCAL_CFLAGS += -DTRACE=0
LOCAL_EXPORT_C_INCLUDE_DIRS := $(includeFiles)
LOCAL_STATIC_LIBRARIES := $(staticLibraries)
LOCAL_SHARED_LIBRARIES := $(sharedLibraries)
LOCAL_MODULE := libbufferhub
include $(BUILD_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := bufferhub_tests.cpp
LOCAL_STATIC_LIBRARIES := libbufferhub $(staticLibraries)
LOCAL_SHARED_LIBRARIES := $(sharedLibraries)
LOCAL_MODULE := bufferhub_tests
include $(BUILD_NATIVE_TEST)

include $(call all-makefiles-under,$(LOCAL_PATH))
Loading