The open source OpenXR runtime
at main 102 lines 2.2 kB view raw
1// Copyright 2020-2021, Collabora, Ltd. 2// SPDX-License-Identifier: BSL-1.0 3// Author: Rylie Pavlik <rylie.pavlik@collabora.com> 4 5#pragma once 6 7#include "android.content.h" 8 9namespace wrap { 10namespace android::content { 11class ComponentName; 12} // namespace android::content 13 14} // namespace wrap 15 16namespace wrap { 17namespace android::app { 18/*! 19 * Wrapper for android.app.Service objects. 20 */ 21class Service : public content::Context { 22 public: 23 using Context::Context; 24 static constexpr const char *getTypeName() noexcept { 25 return "android/app/Service"; 26 } 27 28 /*! 29 * Class metadata 30 */ 31 struct Meta : public MetaBaseDroppable { 32 33 /*! 34 * Singleton accessor 35 */ 36 static Meta &data() { 37 static Meta instance{}; 38 return instance; 39 } 40 41 private: 42 Meta(); 43 }; 44}; 45 46/*! 47 * Wrapper for android.app.Activity objects. 48 */ 49class Activity : public content::Context { 50 public: 51 using Context::Context; 52 static constexpr const char *getTypeName() noexcept { 53 return "android/app/Activity"; 54 } 55 56 /*! 57 * Wrapper for the getWindow method 58 * 59 * Java prototype: 60 * `public android.view.Window getWindow();` 61 * 62 * JNI signature: ()Landroid/view/Window; 63 * 64 */ 65 jni::Object getWindow(); 66 67 /*! 68 * Wrapper for the setVrModeEnabled method 69 * 70 * Java prototype: 71 * `public void setVrModeEnabled(boolean, android.content.ComponentName) 72 * throws android.content.pm.PackageManager$NameNotFoundException;` 73 * 74 * JNI signature: (ZLandroid/content/ComponentName;)V 75 * 76 */ 77 void setVrModeEnabled(bool enabled, 78 content::ComponentName const &requestedComponent); 79 80 /*! 81 * Class metadata 82 */ 83 struct Meta : public MetaBaseDroppable { 84 jni::method_t getWindow; 85 jni::method_t setVrModeEnabled; 86 87 /*! 88 * Singleton accessor 89 */ 90 static Meta &data() { 91 static Meta instance{}; 92 return instance; 93 } 94 95 private: 96 Meta(); 97 }; 98}; 99 100} // namespace android::app 101} // namespace wrap 102#include "android.app.impl.h"