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