vr_manager.h 2.7 KB

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