The open source OpenXR runtime
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 "ObjectWrapperBase.h"
8
9namespace wrap {
10namespace android::graphics {
11class Point;
12} // namespace android::graphics
13
14namespace android::hardware::display {
15class DeviceProductInfo;
16} // namespace android::hardware::display
17
18namespace android::util {
19class DisplayMetrics;
20} // namespace android::util
21
22namespace android::view {
23class Display;
24class Surface;
25class WindowManager_LayoutParams;
26} // namespace android::view
27
28} // namespace wrap
29
30namespace wrap {
31namespace android::view {
32/*!
33 * Wrapper for android.view.Display objects.
34 */
35class Display : public ObjectWrapperBase {
36 public:
37 using ObjectWrapperBase::ObjectWrapperBase;
38 static constexpr const char *getTypeName() noexcept {
39 return "android/view/Display";
40 }
41
42 /*!
43 * Getter for the DEFAULT_DISPLAY static field value
44 *
45 * Java prototype:
46 * `public static final int DEFAULT_DISPLAY;`
47 *
48 * JNI signature: I
49 *
50 */
51 static int32_t DEFAULT_DISPLAY();
52
53 /*!
54 * Wrapper for the getDisplayId method
55 *
56 * Java prototype:
57 * `public int getDisplayId();`
58 *
59 * JNI signature: ()I
60 *
61 */
62 int32_t getDisplayId() const;
63
64 /*!
65 * Wrapper for the getName method
66 *
67 * Java prototype:
68 * `public java.lang.String getName();`
69 *
70 * JNI signature: ()Ljava/lang/String;
71 *
72 */
73 std::string getName() const;
74
75 /*!
76 * Wrapper for the getDeviceProductInfo method
77 *
78 * Java prototype:
79 * `public android.hardware.display.DeviceProductInfo
80 * getDeviceProductInfo();`
81 *
82 * JNI signature: ()Landroid/hardware/display/DeviceProductInfo;
83 *
84 */
85 hardware::display::DeviceProductInfo getDeviceProductInfo() const;
86
87 /*!
88 * Wrapper for the getRealSize method
89 *
90 * Java prototype:
91 * `public void getRealSize(android.graphics.Point);`
92 *
93 * JNI signature: (Landroid/graphics/Point;)V
94 *
95 */
96 void getRealSize(graphics::Point &out_size);
97
98 /*!
99 * Wrapper for the getRealMetrics method
100 *
101 * Java prototype:
102 * `public void getRealMetrics(android.util.DisplayMetrics);`
103 *
104 * JNI signature: (Landroid/util/DisplayMetrics;)V
105 *
106 */
107 void getRealMetrics(util::DisplayMetrics &out_displayMetrics);
108
109 /*!
110 * Class metadata
111 */
112 struct Meta : public MetaBaseDroppable {
113 impl::StaticFieldId<int32_t> DEFAULT_DISPLAY;
114 jni::method_t getDisplayId;
115 jni::method_t getName;
116 jni::method_t getDeviceProductInfo;
117 jni::method_t getRealSize;
118 jni::method_t getRealMetrics;
119
120 /*!
121 * Singleton accessor
122 */
123 static Meta &data(bool deferDrop = false) {
124 static Meta instance{deferDrop};
125 return instance;
126 }
127
128 private:
129 explicit Meta(bool deferDrop);
130 };
131};
132
133/*!
134 * Wrapper for android.view.Surface objects.
135 */
136class Surface : public ObjectWrapperBase {
137 public:
138 using ObjectWrapperBase::ObjectWrapperBase;
139 static constexpr const char *getTypeName() noexcept {
140 return "android/view/Surface";
141 }
142
143 /*!
144 * Wrapper for the isValid method
145 *
146 * Java prototype:
147 * `public boolean isValid();`
148 *
149 * JNI signature: ()Z
150 *
151 */
152 bool isValid() const;
153
154 /*!
155 * Class metadata
156 */
157 struct Meta : public MetaBaseDroppable {
158 jni::method_t isValid;
159
160 /*!
161 * Singleton accessor
162 */
163 static Meta &data() {
164 static Meta instance{};
165 return instance;
166 }
167
168 private:
169 Meta();
170 };
171};
172
173/*!
174 * Wrapper for android.view.SurfaceHolder objects.
175 */
176class SurfaceHolder : public ObjectWrapperBase {
177 public:
178 using ObjectWrapperBase::ObjectWrapperBase;
179 static constexpr const char *getTypeName() noexcept {
180 return "android/view/SurfaceHolder";
181 }
182
183 /*!
184 * Wrapper for the getSurface method
185 *
186 * Java prototype:
187 * `public abstract android.view.Surface getSurface();`
188 *
189 * JNI signature: ()Landroid/view/Surface;
190 *
191 */
192 Surface getSurface();
193
194 /*!
195 * Class metadata
196 */
197 struct Meta : public MetaBaseDroppable {
198 jni::method_t getSurface;
199
200 /*!
201 * Singleton accessor
202 */
203 static Meta &data() {
204 static Meta instance{};
205 return instance;
206 }
207
208 private:
209 Meta();
210 };
211};
212
213/*!
214 * Wrapper for android.view.WindowManager objects.
215 */
216class WindowManager : public ObjectWrapperBase {
217 public:
218 using ObjectWrapperBase::ObjectWrapperBase;
219 static constexpr const char *getTypeName() noexcept {
220 return "android/view/WindowManager";
221 }
222
223 /*!
224 * Wrapper for the getDefaultDisplay method
225 *
226 * Java prototype:
227 * `public abstract android.view.Display getDefaultDisplay();`
228 *
229 * JNI signature: ()Landroid/view/Display;
230 *
231 */
232 Display getDefaultDisplay() const;
233
234 /*!
235 * Class metadata
236 */
237 struct Meta : public MetaBaseDroppable {
238 jni::method_t getDefaultDisplay;
239
240 /*!
241 * Singleton accessor
242 */
243 static Meta &data() {
244 static Meta instance{};
245 return instance;
246 }
247
248 private:
249 Meta();
250 };
251};
252
253/*!
254 * Wrapper for android.view.WindowManager$LayoutParams objects.
255 */
256class WindowManager_LayoutParams : public ObjectWrapperBase {
257 public:
258 using ObjectWrapperBase::ObjectWrapperBase;
259 static constexpr const char *getTypeName() noexcept {
260 return "android/view/WindowManager$LayoutParams";
261 }
262
263 /*!
264 * Getter for the FLAG_FULLSCREEN static field value
265 *
266 * Java prototype:
267 * `public static final int FLAG_FULLSCREEN;`
268 *
269 * JNI signature: I
270 *
271 */
272 static int32_t FLAG_FULLSCREEN();
273
274 /*!
275 * Getter for the FLAG_NOT_FOCUSABLE static field value
276 *
277 * Java prototype:
278 * `public static final int FLAG_NOT_FOCUSABLE;`
279 *
280 * JNI signature: I
281 *
282 */
283 static int32_t FLAG_NOT_FOCUSABLE();
284
285 /*!
286 * Getter for the FLAG_NOT_TOUCHABLE static field value
287 *
288 * Java prototype:
289 * `public static final int FLAG_NOT_TOUCHABLE;`
290 *
291 * JNI signature: I
292 *
293 */
294 static int32_t FLAG_NOT_TOUCHABLE();
295
296 /*!
297 * Getter for the TYPE_APPLICATION static field value
298 *
299 * Java prototype:
300 * `public static final int TYPE_APPLICATION;`
301 *
302 * JNI signature: I
303 *
304 */
305 static int32_t TYPE_APPLICATION();
306
307 /*!
308 * Getter for the TYPE_APPLICATION_OVERLAY static field value
309 *
310 * Java prototype:
311 * `public static final int TYPE_APPLICATION_OVERLAY;`
312 *
313 * JNI signature: I
314 *
315 */
316 static int32_t TYPE_APPLICATION_OVERLAY();
317
318 /*!
319 * Wrapper for a constructor
320 *
321 * Java prototype:
322 * `public android.view.WindowManager$LayoutParams();`
323 *
324 * JNI signature: ()V
325 *
326 */
327 static WindowManager_LayoutParams construct();
328
329 /*!
330 * Wrapper for a constructor
331 *
332 * Java prototype:
333 * `public android.view.WindowManager$LayoutParams(int);`
334 *
335 * JNI signature: (I)V
336 *
337 */
338 static WindowManager_LayoutParams construct(int32_t type);
339
340 /*!
341 * Wrapper for a constructor
342 *
343 * Java prototype:
344 * `public android.view.WindowManager$LayoutParams(int, int);`
345 *
346 * JNI signature: (II)V
347 *
348 */
349 static WindowManager_LayoutParams construct(int32_t type, int32_t flags);
350
351 /*!
352 * Wrapper for a constructor
353 *
354 * Java prototype:
355 * `public android.view.WindowManager$LayoutParams(int, int, int, int, int);`
356 *
357 * JNI signature: (IIIII)V
358 *
359 */
360 static WindowManager_LayoutParams construct(int32_t w, int32_t h, int32_t type, int32_t flags, int32_t format);
361
362 /*!
363 * Wrapper for the setTitle method
364 *
365 * Java prototype:
366 * `public final void setTitle(java.lang.CharSequence);`
367 *
368 * JNI signature: (Ljava/lang/CharSequence;)V
369 *
370 */
371 void setTitle(std::string const &title);
372
373 /*!
374 * Class metadata
375 */
376 struct Meta : public MetaBase {
377 impl::StaticFieldId<int32_t> FLAG_FULLSCREEN;
378 impl::StaticFieldId<int32_t> FLAG_NOT_FOCUSABLE;
379 impl::StaticFieldId<int32_t> FLAG_NOT_TOUCHABLE;
380 impl::StaticFieldId<int32_t> TYPE_APPLICATION;
381 impl::StaticFieldId<int32_t> TYPE_APPLICATION_OVERLAY;
382 jni::method_t init;
383 jni::method_t init1;
384 jni::method_t init2;
385 jni::method_t init4;
386 jni::method_t setTitle;
387
388 /*!
389 * Singleton accessor
390 */
391 static Meta &data() {
392 static Meta instance{};
393 return instance;
394 }
395
396 private:
397 Meta();
398 };
399};
400
401class Display_Mode : public ObjectWrapperBase {
402public:
403 using ObjectWrapperBase::ObjectWrapperBase;
404 static constexpr const char *getTypeName() noexcept {
405 return "android/view/Display$Mode";
406 }
407
408 int getModeId();
409
410 int getPhysicalHeight();
411
412 int getPhysicalWidth();
413
414 float getRefreshRate();
415
416 struct Meta : public MetaBaseDroppable {
417 jni::method_t getModeId;
418 jni::method_t getPhysicalHeight;
419 jni::method_t getPhysicalWidth;
420 jni::method_t getRefreshRate;
421
422 static Meta &data() {
423 static Meta instance{};
424 return instance;
425 }
426
427 private:
428 Meta();
429 };
430};
431
432} // namespace android::view
433} // namespace wrap
434#include "android.view.impl.h"