Home | History | Annotate | Download | only in vr_manager
      1 /*
      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 #ifndef ANDROID_VR_MANAGER_H
     18 #define ANDROID_VR_MANAGER_H
     19 
     20 #include <binder/IInterface.h>
     21 
     22 namespace android {
     23 
     24 // Must be kept in sync with interface defined in IVrStateCallbacks.aidl.
     25 
     26 class IVrStateCallbacks : public IInterface {
     27 public:
     28     DECLARE_META_INTERFACE(VrStateCallbacks)
     29 
     30     virtual void onVrStateChanged(bool enabled) = 0;
     31 };
     32 
     33 enum VrStateCallbacksTransaction {
     34     ON_VR_STATE_CHANGED = IBinder::FIRST_CALL_TRANSACTION,
     35 };
     36 
     37 class BnVrStateCallbacks : public BnInterface<IVrStateCallbacks> {
     38 public:
     39     status_t onTransact(uint32_t code, const Parcel& data,
     40                         Parcel* reply, uint32_t flags = 0) override;
     41 };
     42 
     43 
     44 // Must be kept in sync with interface defined in
     45 // IPersistentVrStateCallbacks.aidl.
     46 
     47 class IPersistentVrStateCallbacks : public IInterface {
     48 public:
     49     DECLARE_META_INTERFACE(PersistentVrStateCallbacks)
     50 
     51     virtual void onPersistentVrStateChanged(bool enabled) = 0;
     52 };
     53 
     54 enum PersistentVrStateCallbacksTransaction {
     55     ON_PERSISTENT_VR_STATE_CHANGED = IBinder::FIRST_CALL_TRANSACTION,
     56 };
     57 
     58 class BnPersistentVrStateCallbacks
     59         : public BnInterface<IPersistentVrStateCallbacks> {
     60 public:
     61     status_t onTransact(uint32_t code, const Parcel& data,
     62                         Parcel* reply, uint32_t flags = 0) override;
     63 };
     64 
     65 
     66 // Must be kept in sync with interface defined in IVrManager.aidl.
     67 
     68 class IVrManager : public IInterface {
     69 public:
     70     DECLARE_META_INTERFACE(VrManager)
     71 
     72     virtual void registerListener(const sp<IVrStateCallbacks>& cb) = 0;
     73     virtual void unregisterListener(const sp<IVrStateCallbacks>& cb) = 0;
     74     virtual void registerPersistentVrStateListener(
     75         const sp<IPersistentVrStateCallbacks>& cb) = 0;
     76     virtual void unregisterPersistentVrStateListener(
     77         const sp<IPersistentVrStateCallbacks>& cb) = 0;
     78     virtual bool getVrModeState() = 0;
     79 };
     80 
     81 enum VrManagerTransaction {
     82     REGISTER_LISTENER = IBinder::FIRST_CALL_TRANSACTION,
     83     UNREGISTER_LISTENER,
     84     REGISTER_PERSISTENT_VR_STATE_LISTENER,
     85     UNREGISTER_PERSISTENT_VR_STATE_LISTENER,
     86     GET_VR_MODE_STATE,
     87 };
     88 
     89 };  // namespace android
     90 
     91 #endif // ANDROID_VR_MANAGER_H
     92