mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-16 11:55:39 +00:00
external: Update android-jni-wrap
This commit is contained in:
parent
d31bab9398
commit
f35ce4ea9b
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class Service : public content::Context {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ class Service : public content::Context {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.app.Activity objects.
|
* Wrapper for android.app.Activity objects.
|
||||||
*/
|
*/
|
||||||
|
@ -87,7 +88,7 @@ class Activity : public content::Context {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +96,7 @@ class Activity : public content::Context {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace android::app
|
} // namespace android::app
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "android.app.impl.h"
|
#include "android.app.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -22,5 +23,6 @@ Activity::setVrModeEnabled(bool enabled,
|
||||||
return object().call<void>(Meta::data().setVrModeEnabled, enabled,
|
return object().call<void>(Meta::data().setVrModeEnabled, enabled,
|
||||||
requestedComponent.object());
|
requestedComponent.object());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace android::app
|
} // namespace android::app
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@ Context::Meta::Meta(bool deferDrop)
|
||||||
WINDOW_SERVICE(classRef(), "WINDOW_SERVICE"),
|
WINDOW_SERVICE(classRef(), "WINDOW_SERVICE"),
|
||||||
getPackageManager(classRef().getMethod(
|
getPackageManager(classRef().getMethod(
|
||||||
"getPackageManager", "()Landroid/content/pm/PackageManager;")),
|
"getPackageManager", "()Landroid/content/pm/PackageManager;")),
|
||||||
|
getContentResolver(classRef().getMethod(
|
||||||
|
"getContentResolver", "()Landroid/content/ContentResolver;")),
|
||||||
getApplicationContext(classRef().getMethod(
|
getApplicationContext(classRef().getMethod(
|
||||||
"getApplicationContext", "()Landroid/content/Context;")),
|
"getApplicationContext", "()Landroid/content/Context;")),
|
||||||
getClassLoader(
|
getClassLoader(
|
||||||
|
@ -39,7 +41,6 @@ ComponentName::Meta::Meta()
|
||||||
Intent::Meta::Meta()
|
Intent::Meta::Meta()
|
||||||
: MetaBase(Intent::getTypeName()),
|
: MetaBase(Intent::getTypeName()),
|
||||||
FLAG_ACTIVITY_NEW_TASK(classRef(), "FLAG_ACTIVITY_NEW_TASK"),
|
FLAG_ACTIVITY_NEW_TASK(classRef(), "FLAG_ACTIVITY_NEW_TASK"),
|
||||||
init(classRef().getMethod("<init>", "()V")),
|
|
||||||
init1(classRef().getMethod("<init>", "(Landroid/content/Intent;)V")),
|
init1(classRef().getMethod("<init>", "(Landroid/content/Intent;)V")),
|
||||||
init2(classRef().getMethod("<init>", "(Ljava/lang/String;)V")),
|
init2(classRef().getMethod("<init>", "(Ljava/lang/String;)V")),
|
||||||
init3(classRef().getMethod("<init>",
|
init3(classRef().getMethod("<init>",
|
||||||
|
@ -51,5 +52,21 @@ Intent::Meta::Meta()
|
||||||
"content/Context;Ljava/lang/Class;)V")),
|
"content/Context;Ljava/lang/Class;)V")),
|
||||||
setFlags(
|
setFlags(
|
||||||
classRef().getMethod("setFlags", "(I)Landroid/content/Intent;")) {}
|
classRef().getMethod("setFlags", "(I)Landroid/content/Intent;")) {}
|
||||||
|
ContentResolver::Meta::Meta()
|
||||||
|
: MetaBaseDroppable(ContentResolver::getTypeName()),
|
||||||
|
query(classRef().getMethod(
|
||||||
|
"query",
|
||||||
|
"(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/"
|
||||||
|
"String;Ljava/lang/String;)Landroid/database/Cursor;")),
|
||||||
|
query1(classRef().getMethod(
|
||||||
|
"query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/"
|
||||||
|
"String;[Ljava/lang/String;Ljava/lang/String;Landroid/os/"
|
||||||
|
"CancellationSignal;)Landroid/database/Cursor;")),
|
||||||
|
query2(classRef().getMethod(
|
||||||
|
"query",
|
||||||
|
"(Landroid/net/Uri;[Ljava/lang/String;Landroid/os/Bundle;Landroid/os/"
|
||||||
|
"CancellationSignal;)Landroid/database/Cursor;")) {
|
||||||
|
MetaBaseDroppable::dropClassRef();
|
||||||
|
}
|
||||||
} // namespace android::content
|
} // namespace android::content
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
134
src/external/android-jni-wrap/wrap/android.content.h
vendored
134
src/external/android-jni-wrap/wrap/android.content.h
vendored
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
namespace wrap {
|
namespace wrap {
|
||||||
namespace android::content {
|
namespace android::content {
|
||||||
class ComponentName;
|
class ComponentName;
|
||||||
|
class ContentResolver;
|
||||||
class Context;
|
class Context;
|
||||||
class Intent;
|
class Intent;
|
||||||
} // namespace android::content
|
} // namespace android::content
|
||||||
|
@ -18,6 +19,10 @@ namespace android::content::pm {
|
||||||
class PackageManager;
|
class PackageManager;
|
||||||
} // namespace android::content::pm
|
} // namespace android::content::pm
|
||||||
|
|
||||||
|
namespace android::database {
|
||||||
|
class Cursor;
|
||||||
|
} // namespace android::database
|
||||||
|
|
||||||
namespace android::os {
|
namespace android::os {
|
||||||
class Bundle;
|
class Bundle;
|
||||||
} // namespace android::os
|
} // namespace android::os
|
||||||
|
@ -74,6 +79,17 @@ class Context : public ObjectWrapperBase {
|
||||||
*/
|
*/
|
||||||
pm::PackageManager getPackageManager();
|
pm::PackageManager getPackageManager();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the getContentResolver method
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public abstract android.content.ContentResolver getContentResolver();`
|
||||||
|
*
|
||||||
|
* JNI signature: ()Landroid/content/ContentResolver;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
ContentResolver getContentResolver() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for the getApplicationContext method
|
* Wrapper for the getApplicationContext method
|
||||||
*
|
*
|
||||||
|
@ -144,6 +160,7 @@ class Context : public ObjectWrapperBase {
|
||||||
impl::StaticFieldId<std::string> DISPLAY_SERVICE;
|
impl::StaticFieldId<std::string> DISPLAY_SERVICE;
|
||||||
impl::StaticFieldId<std::string> WINDOW_SERVICE;
|
impl::StaticFieldId<std::string> WINDOW_SERVICE;
|
||||||
jni::method_t getPackageManager;
|
jni::method_t getPackageManager;
|
||||||
|
jni::method_t getContentResolver;
|
||||||
jni::method_t getApplicationContext;
|
jni::method_t getApplicationContext;
|
||||||
jni::method_t getClassLoader;
|
jni::method_t getClassLoader;
|
||||||
jni::method_t startActivity;
|
jni::method_t startActivity;
|
||||||
|
@ -162,6 +179,7 @@ class Context : public ObjectWrapperBase {
|
||||||
explicit Meta(bool deferDrop);
|
explicit Meta(bool deferDrop);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.content.ComponentName objects.
|
* Wrapper for android.content.ComponentName objects.
|
||||||
*/
|
*/
|
||||||
|
@ -183,7 +201,7 @@ class ComponentName : public ObjectWrapperBase {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static ComponentName construct(std::string const &pkg,
|
static ComponentName construct(std::string const &pkg,
|
||||||
std::string const &cls);
|
std::string const &className);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for a constructor
|
* Wrapper for a constructor
|
||||||
|
@ -195,7 +213,8 @@ class ComponentName : public ObjectWrapperBase {
|
||||||
* JNI signature: (Landroid/content/Context;Ljava/lang/String;)V
|
* JNI signature: (Landroid/content/Context;Ljava/lang/String;)V
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static ComponentName construct(Context const &pkg, std::string const &cls);
|
static ComponentName construct(Context const &context,
|
||||||
|
std::string const &className);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for a constructor
|
* Wrapper for a constructor
|
||||||
|
@ -207,7 +226,7 @@ class ComponentName : public ObjectWrapperBase {
|
||||||
* JNI signature: (Landroid/content/Context;Ljava/lang/Class;)V
|
* JNI signature: (Landroid/content/Context;Ljava/lang/Class;)V
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static ComponentName construct(Context const &pkg,
|
static ComponentName construct(Context const &context,
|
||||||
java::lang::Class const &cls);
|
java::lang::Class const &cls);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -234,7 +253,7 @@ class ComponentName : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,6 +261,7 @@ class ComponentName : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.content.Intent objects.
|
* Wrapper for android.content.Intent objects.
|
||||||
*/
|
*/
|
||||||
|
@ -263,20 +283,6 @@ class Intent : public ObjectWrapperBase {
|
||||||
*/
|
*/
|
||||||
static int32_t FLAG_ACTIVITY_NEW_TASK();
|
static int32_t FLAG_ACTIVITY_NEW_TASK();
|
||||||
|
|
||||||
#if 0
|
|
||||||
// disabled because of zero-length array warning in jnipp
|
|
||||||
/*!
|
|
||||||
* Wrapper for a constructor
|
|
||||||
*
|
|
||||||
* Java prototype:
|
|
||||||
* `public android.content.Intent();`
|
|
||||||
*
|
|
||||||
* JNI signature: ()V
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static Intent construct();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for a constructor
|
* Wrapper for a constructor
|
||||||
*
|
*
|
||||||
|
@ -286,7 +292,7 @@ class Intent : public ObjectWrapperBase {
|
||||||
* JNI signature: (Landroid/content/Intent;)V
|
* JNI signature: (Landroid/content/Intent;)V
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static Intent construct(Intent &intent);
|
static Intent construct(Intent const &intent);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for a constructor
|
* Wrapper for a constructor
|
||||||
|
@ -354,7 +360,6 @@ class Intent : public ObjectWrapperBase {
|
||||||
*/
|
*/
|
||||||
struct Meta : public MetaBase {
|
struct Meta : public MetaBase {
|
||||||
impl::StaticFieldId<int32_t> FLAG_ACTIVITY_NEW_TASK;
|
impl::StaticFieldId<int32_t> FLAG_ACTIVITY_NEW_TASK;
|
||||||
jni::method_t init;
|
|
||||||
jni::method_t init1;
|
jni::method_t init1;
|
||||||
jni::method_t init2;
|
jni::method_t init2;
|
||||||
jni::method_t init3;
|
jni::method_t init3;
|
||||||
|
@ -366,7 +371,7 @@ class Intent : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,6 +379,91 @@ class Intent : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for android.content.ContentResolver objects.
|
||||||
|
*/
|
||||||
|
class ContentResolver : public ObjectWrapperBase {
|
||||||
|
public:
|
||||||
|
using ObjectWrapperBase::ObjectWrapperBase;
|
||||||
|
static constexpr const char *getTypeName() noexcept {
|
||||||
|
return "android/content/ContentResolver";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the query method - overload added in API level 1
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public final android.database.Cursor query(android.net.Uri,
|
||||||
|
* java.lang.String[], java.lang.String, java.lang.String[],
|
||||||
|
* java.lang.String);`
|
||||||
|
*
|
||||||
|
* JNI signature:
|
||||||
|
* (Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
database::Cursor query(jni::Object const &uri,
|
||||||
|
jni::Array<std::string> const &projection,
|
||||||
|
std::string const &selection,
|
||||||
|
jni::Array<std::string> const &selectionArgs,
|
||||||
|
std::string const &sortOrder);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the query method - overload added in API level 16
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public final android.database.Cursor query(android.net.Uri,
|
||||||
|
* java.lang.String[], java.lang.String, java.lang.String[],
|
||||||
|
* java.lang.String, android.os.CancellationSignal);`
|
||||||
|
*
|
||||||
|
* JNI signature:
|
||||||
|
* (Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/database/Cursor;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
database::Cursor query(jni::Object const &uri,
|
||||||
|
jni::Array<std::string> const &projection,
|
||||||
|
std::string const &selection,
|
||||||
|
jni::Array<std::string> const &selectionArgs,
|
||||||
|
std::string const &sortOrder,
|
||||||
|
jni::Object const &cancellationSignal);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the query method - overload added in API level 26
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public final android.database.Cursor query(android.net.Uri,
|
||||||
|
* java.lang.String[], android.os.Bundle, android.os.CancellationSignal);`
|
||||||
|
*
|
||||||
|
* JNI signature:
|
||||||
|
* (Landroid/net/Uri;[Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
database::Cursor query(jni::Object const &uri,
|
||||||
|
jni::Array<std::string> const &projection,
|
||||||
|
os::Bundle const &queryArgs,
|
||||||
|
jni::Object const &cancellationSignal);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Class metadata
|
||||||
|
*/
|
||||||
|
struct Meta : public MetaBaseDroppable {
|
||||||
|
jni::method_t query;
|
||||||
|
jni::method_t query1;
|
||||||
|
jni::method_t query2;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Singleton accessor
|
||||||
|
*/
|
||||||
|
static Meta &data() {
|
||||||
|
static Meta instance{};
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Meta();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace android::content
|
} // namespace android::content
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "android.content.impl.h"
|
#include "android.content.impl.h"
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "android.content.pm.h"
|
#include "android.content.pm.h"
|
||||||
|
#include "android.database.h"
|
||||||
#include "android.os.h"
|
#include "android.os.h"
|
||||||
#include "java.lang.h"
|
#include "java.lang.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -12,8 +14,6 @@
|
||||||
namespace wrap {
|
namespace wrap {
|
||||||
namespace android::content {
|
namespace android::content {
|
||||||
inline std::string Context::DISPLAY_SERVICE() {
|
inline std::string Context::DISPLAY_SERVICE() {
|
||||||
// Defer dropping the class ref to avoid having to do two class lookups
|
|
||||||
// by name for this static field. Instead, drop it before we return.
|
|
||||||
auto &data = Meta::data(true);
|
auto &data = Meta::data(true);
|
||||||
auto ret = get(data.DISPLAY_SERVICE, data.clazz());
|
auto ret = get(data.DISPLAY_SERVICE, data.clazz());
|
||||||
data.dropClassRef();
|
data.dropClassRef();
|
||||||
|
@ -21,8 +21,6 @@ inline std::string Context::DISPLAY_SERVICE() {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string Context::WINDOW_SERVICE() {
|
inline std::string Context::WINDOW_SERVICE() {
|
||||||
// Defer dropping the class ref to avoid having to do two class lookups
|
|
||||||
// by name for this static field. Instead, drop it before we return.
|
|
||||||
auto &data = Meta::data(true);
|
auto &data = Meta::data(true);
|
||||||
auto ret = get(data.WINDOW_SERVICE, data.clazz());
|
auto ret = get(data.WINDOW_SERVICE, data.clazz());
|
||||||
data.dropClassRef();
|
data.dropClassRef();
|
||||||
|
@ -35,6 +33,12 @@ inline pm::PackageManager Context::getPackageManager() {
|
||||||
object().call<jni::Object>(Meta::data().getPackageManager));
|
object().call<jni::Object>(Meta::data().getPackageManager));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline ContentResolver Context::getContentResolver() const {
|
||||||
|
assert(!isNull());
|
||||||
|
return ContentResolver(
|
||||||
|
object().call<jni::Object>(Meta::data().getContentResolver));
|
||||||
|
}
|
||||||
|
|
||||||
inline Context Context::getApplicationContext() {
|
inline Context Context::getApplicationContext() {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return Context(
|
return Context(
|
||||||
|
@ -65,40 +69,35 @@ inline Context Context::createPackageContext(std::string const &packageName,
|
||||||
return Context(object().call<jni::Object>(Meta::data().createPackageContext,
|
return Context(object().call<jni::Object>(Meta::data().createPackageContext,
|
||||||
packageName, flags));
|
packageName, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ComponentName ComponentName::construct(std::string const &pkg,
|
inline ComponentName ComponentName::construct(std::string const &pkg,
|
||||||
std::string const &cls) {
|
std::string const &className) {
|
||||||
return ComponentName(
|
return ComponentName(
|
||||||
Meta::data().clazz().newInstance(Meta::data().init, pkg, cls));
|
Meta::data().clazz().newInstance(Meta::data().init, pkg, className));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ComponentName ComponentName::construct(Context const &pkg,
|
inline ComponentName ComponentName::construct(Context const &context,
|
||||||
std::string const &cls) {
|
std::string const &className) {
|
||||||
return ComponentName(Meta::data().clazz().newInstance(Meta::data().init1,
|
return ComponentName(Meta::data().clazz().newInstance(
|
||||||
pkg.object(), cls));
|
Meta::data().init1, context.object(), className));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ComponentName ComponentName::construct(Context const &pkg,
|
inline ComponentName ComponentName::construct(Context const &context,
|
||||||
java::lang::Class const &cls) {
|
java::lang::Class const &cls) {
|
||||||
return ComponentName(Meta::data().clazz().newInstance(
|
return ComponentName(Meta::data().clazz().newInstance(
|
||||||
Meta::data().init2, pkg.object(), cls.object()));
|
Meta::data().init2, context.object(), cls.object()));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ComponentName ComponentName::construct(jni::Object const &parcel) {
|
inline ComponentName ComponentName::construct(jni::Object const &parcel) {
|
||||||
return ComponentName(
|
return ComponentName(
|
||||||
Meta::data().clazz().newInstance(Meta::data().init3, parcel));
|
Meta::data().clazz().newInstance(Meta::data().init3, parcel));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int32_t Intent::FLAG_ACTIVITY_NEW_TASK() {
|
inline int32_t Intent::FLAG_ACTIVITY_NEW_TASK() {
|
||||||
return get(Meta::data().FLAG_ACTIVITY_NEW_TASK, Meta::data().clazz());
|
return get(Meta::data().FLAG_ACTIVITY_NEW_TASK, Meta::data().clazz());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
inline Intent Intent::construct(Intent const &intent) {
|
||||||
// disabled because of zero-length array warning in jnipp
|
|
||||||
inline Intent Intent::construct() {
|
|
||||||
return Intent(Meta::data().clazz().newInstance(Meta::data().init));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline Intent Intent::construct(Intent &intent) {
|
|
||||||
return Intent(
|
return Intent(
|
||||||
Meta::data().clazz().newInstance(Meta::data().init1, intent.object()));
|
Meta::data().clazz().newInstance(Meta::data().init1, intent.object()));
|
||||||
}
|
}
|
||||||
|
@ -131,5 +130,35 @@ inline Intent Intent::setFlags(int32_t flags) {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return Intent(object().call<jni::Object>(Meta::data().setFlags, flags));
|
return Intent(object().call<jni::Object>(Meta::data().setFlags, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline database::Cursor ContentResolver::query(
|
||||||
|
jni::Object const &uri, jni::Array<std::string> const &projection,
|
||||||
|
std::string const &selection, jni::Array<std::string> const &selectionArgs,
|
||||||
|
std::string const &sortOrder) {
|
||||||
|
assert(!isNull());
|
||||||
|
return database::Cursor(
|
||||||
|
object().call<jni::Object>(Meta::data().query, uri, projection,
|
||||||
|
selection, selectionArgs, sortOrder));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline database::Cursor ContentResolver::query(
|
||||||
|
jni::Object const &uri, jni::Array<std::string> const &projection,
|
||||||
|
std::string const &selection, jni::Array<std::string> const &selectionArgs,
|
||||||
|
std::string const &sortOrder, jni::Object const &cancellationSignal) {
|
||||||
|
assert(!isNull());
|
||||||
|
return database::Cursor(object().call<jni::Object>(
|
||||||
|
Meta::data().query1, uri, projection, selection, selectionArgs,
|
||||||
|
sortOrder, cancellationSignal));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline database::Cursor ContentResolver::query(
|
||||||
|
jni::Object const &uri, jni::Array<std::string> const &projection,
|
||||||
|
os::Bundle const &queryArgs, jni::Object const &cancellationSignal) {
|
||||||
|
assert(!isNull());
|
||||||
|
return database::Cursor(
|
||||||
|
object().call<jni::Object>(Meta::data().query2, uri, projection,
|
||||||
|
queryArgs.object(), cancellationSignal));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace android::content
|
} // namespace android::content
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -40,9 +40,6 @@ PackageManager::Meta::Meta()
|
||||||
getPackageInfo(classRef().getMethod(
|
getPackageInfo(classRef().getMethod(
|
||||||
"getPackageInfo",
|
"getPackageInfo",
|
||||||
"(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;")),
|
"(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;")),
|
||||||
getPackageInfo1(classRef().getMethod(
|
|
||||||
"getPackageInfo", "(Landroid/content/pm/VersionedPackage;I)Landroid/"
|
|
||||||
"content/pm/PackageInfo;")),
|
|
||||||
getApplicationInfo(classRef().getMethod(
|
getApplicationInfo(classRef().getMethod(
|
||||||
"getApplicationInfo",
|
"getApplicationInfo",
|
||||||
"(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;")),
|
"(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;")),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class PackageItemInfo : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@ class PackageItemInfo : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.content.pm.ComponentInfo objects.
|
* Wrapper for android.content.pm.ComponentInfo objects.
|
||||||
*/
|
*/
|
||||||
|
@ -113,7 +114,7 @@ class ComponentInfo : public PackageItemInfo {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +122,7 @@ class ComponentInfo : public PackageItemInfo {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.content.pm.ServiceInfo objects.
|
* Wrapper for android.content.pm.ServiceInfo objects.
|
||||||
*/
|
*/
|
||||||
|
@ -140,7 +142,7 @@ class ServiceInfo : public PackageItemInfo {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +150,7 @@ class ServiceInfo : public PackageItemInfo {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.content.pm.ApplicationInfo objects.
|
* Wrapper for android.content.pm.ApplicationInfo objects.
|
||||||
*/
|
*/
|
||||||
|
@ -191,7 +194,7 @@ class ApplicationInfo : public PackageItemInfo {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +202,7 @@ class ApplicationInfo : public PackageItemInfo {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.content.pm.PackageInfo objects.
|
* Wrapper for android.content.pm.PackageInfo objects.
|
||||||
*/
|
*/
|
||||||
|
@ -242,7 +246,7 @@ class PackageInfo : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,6 +254,7 @@ class PackageInfo : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.content.pm.ResolveInfo objects.
|
* Wrapper for android.content.pm.ResolveInfo objects.
|
||||||
*/
|
*/
|
||||||
|
@ -281,7 +286,7 @@ class ResolveInfo : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,6 +294,7 @@ class ResolveInfo : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.content.pm.PackageManager objects.
|
* Wrapper for android.content.pm.PackageManager objects.
|
||||||
*/
|
*/
|
||||||
|
@ -312,24 +318,6 @@ class PackageManager : public ObjectWrapperBase {
|
||||||
*/
|
*/
|
||||||
PackageInfo getPackageInfo(std::string const &name, int32_t flags);
|
PackageInfo getPackageInfo(std::string const &name, int32_t flags);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Ambiguous overload until we wrap VersionedPackage
|
|
||||||
/*!
|
|
||||||
* Wrapper for the getPackageInfo method
|
|
||||||
*
|
|
||||||
* Java prototype:
|
|
||||||
* `public abstract android.content.pm.PackageInfo
|
|
||||||
* getPackageInfo(android.content.pm.VersionedPackage, int) throws
|
|
||||||
* android.content.pm.PackageManager$NameNotFoundException;`
|
|
||||||
*
|
|
||||||
* JNI signature:
|
|
||||||
* (Landroid/content/pm/VersionedPackage;I)Landroid/content/pm/PackageInfo;
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
PackageInfo getPackageInfo(jni::Object &versionedPackage, int32_t flags);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for the getApplicationInfo method
|
* Wrapper for the getApplicationInfo method
|
||||||
*
|
*
|
||||||
|
@ -354,7 +342,7 @@ class PackageManager : public ObjectWrapperBase {
|
||||||
* JNI signature: (Landroid/content/Intent;I)Ljava/util/List;
|
* JNI signature: (Landroid/content/Intent;I)Ljava/util/List;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
java::util::List queryIntentServices(Intent &intent, int32_t intParam);
|
java::util::List queryIntentServices(Intent const &intent, int32_t flags);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
GET_META_DATA = 128,
|
GET_META_DATA = 128,
|
||||||
|
@ -366,7 +354,6 @@ class PackageManager : public ObjectWrapperBase {
|
||||||
*/
|
*/
|
||||||
struct Meta : public MetaBaseDroppable {
|
struct Meta : public MetaBaseDroppable {
|
||||||
jni::method_t getPackageInfo;
|
jni::method_t getPackageInfo;
|
||||||
jni::method_t getPackageInfo1;
|
|
||||||
jni::method_t getApplicationInfo;
|
jni::method_t getApplicationInfo;
|
||||||
jni::method_t queryIntentServices;
|
jni::method_t queryIntentServices;
|
||||||
|
|
||||||
|
@ -374,7 +361,7 @@ class PackageManager : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,6 +369,7 @@ class PackageManager : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace android::content::pm
|
} // namespace android::content::pm
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "android.content.pm.impl.h"
|
#include "android.content.pm.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ inline std::string ApplicationInfo::getPublicSourceDir() const {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return get(Meta::data().publicSourceDir, object());
|
return get(Meta::data().publicSourceDir, object());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ApplicationInfo PackageInfo::getApplicationInfo() const {
|
inline ApplicationInfo PackageInfo::getApplicationInfo() const {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return get(Meta::data().applicationInfo, object());
|
return get(Meta::data().applicationInfo, object());
|
||||||
|
@ -43,10 +45,12 @@ inline std::string PackageInfo::getPackageName() const {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return get(Meta::data().packageName, object());
|
return get(Meta::data().packageName, object());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ServiceInfo ResolveInfo::getServiceInfo() const {
|
inline ServiceInfo ResolveInfo::getServiceInfo() const {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return get(Meta::data().serviceInfo, object());
|
return get(Meta::data().serviceInfo, object());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline PackageInfo PackageManager::getPackageInfo(std::string const &name,
|
inline PackageInfo PackageManager::getPackageInfo(std::string const &name,
|
||||||
int32_t flags) {
|
int32_t flags) {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
|
@ -54,17 +58,6 @@ inline PackageInfo PackageManager::getPackageInfo(std::string const &name,
|
||||||
object().call<jni::Object>(Meta::data().getPackageInfo, name, flags));
|
object().call<jni::Object>(Meta::data().getPackageInfo, name, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Ambiguous overload until we wrap VersionedPackage
|
|
||||||
inline PackageInfo
|
|
||||||
PackageManager::getPackageInfo(jni::Object const &versionedPackage,
|
|
||||||
int32_t flags) {
|
|
||||||
assert(!isNull());
|
|
||||||
return PackageInfo(object().call<jni::Object>(Meta::data().getPackageInfo1,
|
|
||||||
versionedPackage, flags));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline ApplicationInfo
|
inline ApplicationInfo
|
||||||
PackageManager::getApplicationInfo(std::string const &packageName,
|
PackageManager::getApplicationInfo(std::string const &packageName,
|
||||||
int32_t flags) {
|
int32_t flags) {
|
||||||
|
@ -73,11 +66,12 @@ PackageManager::getApplicationInfo(std::string const &packageName,
|
||||||
Meta::data().getApplicationInfo, packageName, flags));
|
Meta::data().getApplicationInfo, packageName, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline java::util::List PackageManager::queryIntentServices(Intent &intent,
|
inline java::util::List
|
||||||
int32_t intParam) {
|
PackageManager::queryIntentServices(Intent const &intent, int32_t flags) {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return java::util::List(object().call<jni::Object>(
|
return java::util::List(object().call<jni::Object>(
|
||||||
Meta::data().queryIntentServices, intent.object(), intParam));
|
Meta::data().queryIntentServices, intent.object(), flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace android::content::pm
|
} // namespace android::content::pm
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
22
src/external/android-jni-wrap/wrap/android.database.cpp
vendored
Normal file
22
src/external/android-jni-wrap/wrap/android.database.cpp
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
#include "android.database.h"
|
||||||
|
|
||||||
|
namespace wrap {
|
||||||
|
namespace android::database {
|
||||||
|
Cursor::Meta::Meta()
|
||||||
|
: MetaBaseDroppable(Cursor::getTypeName()),
|
||||||
|
getCount(classRef().getMethod("getCount", "()I")),
|
||||||
|
moveToFirst(classRef().getMethod("moveToFirst", "()Z")),
|
||||||
|
moveToNext(classRef().getMethod("moveToNext", "()Z")),
|
||||||
|
getColumnIndex(
|
||||||
|
classRef().getMethod("getColumnIndex", "(Ljava/lang/String;)I")),
|
||||||
|
getString(classRef().getMethod("getString", "(I)Ljava/lang/String;")),
|
||||||
|
getInt(classRef().getMethod("getInt", "(I)I")),
|
||||||
|
close(classRef().getMethod("close", "()V")) {
|
||||||
|
MetaBaseDroppable::dropClassRef();
|
||||||
|
}
|
||||||
|
} // namespace android::database
|
||||||
|
} // namespace wrap
|
125
src/external/android-jni-wrap/wrap/android.database.h
vendored
Normal file
125
src/external/android-jni-wrap/wrap/android.database.h
vendored
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ObjectWrapperBase.h"
|
||||||
|
|
||||||
|
namespace wrap {
|
||||||
|
namespace android::database {
|
||||||
|
/*!
|
||||||
|
* Wrapper for android.database.Cursor objects.
|
||||||
|
*/
|
||||||
|
class Cursor : public ObjectWrapperBase {
|
||||||
|
public:
|
||||||
|
using ObjectWrapperBase::ObjectWrapperBase;
|
||||||
|
static constexpr const char *getTypeName() noexcept {
|
||||||
|
return "android/database/Cursor";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the getCount method
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public abstract int getCount();`
|
||||||
|
*
|
||||||
|
* JNI signature: ()I
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int32_t getCount();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the moveToFirst method
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public abstract boolean moveToFirst();`
|
||||||
|
*
|
||||||
|
* JNI signature: ()Z
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool moveToFirst();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the moveToNext method
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public abstract boolean moveToNext();`
|
||||||
|
*
|
||||||
|
* JNI signature: ()Z
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool moveToNext();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the getColumnIndex method
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public abstract int getColumnIndex(java.lang.String);`
|
||||||
|
*
|
||||||
|
* JNI signature: (Ljava/lang/String;)I
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int32_t getColumnIndex(std::string const &columnName);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the getString method
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public abstract java.lang.String getString(int);`
|
||||||
|
*
|
||||||
|
* JNI signature: (I)Ljava/lang/String;
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
std::string getString(int32_t column);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the getInt method
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public abstract int getInt(int);`
|
||||||
|
*
|
||||||
|
* JNI signature: (I)I
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int32_t getInt(int32_t column);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Wrapper for the close method
|
||||||
|
*
|
||||||
|
* Java prototype:
|
||||||
|
* `public abstract void close();`
|
||||||
|
*
|
||||||
|
* JNI signature: ()V
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void close();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Class metadata
|
||||||
|
*/
|
||||||
|
struct Meta : public MetaBaseDroppable {
|
||||||
|
jni::method_t getCount;
|
||||||
|
jni::method_t moveToFirst;
|
||||||
|
jni::method_t moveToNext;
|
||||||
|
jni::method_t getColumnIndex;
|
||||||
|
jni::method_t getString;
|
||||||
|
jni::method_t getInt;
|
||||||
|
jni::method_t close;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Singleton accessor
|
||||||
|
*/
|
||||||
|
static Meta &data() {
|
||||||
|
static Meta instance{};
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Meta();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace android::database
|
||||||
|
} // namespace wrap
|
||||||
|
#include "android.database.impl.h"
|
48
src/external/android-jni-wrap/wrap/android.database.impl.h
vendored
Normal file
48
src/external/android-jni-wrap/wrap/android.database.impl.h
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace wrap {
|
||||||
|
namespace android::database {
|
||||||
|
inline int32_t Cursor::getCount() {
|
||||||
|
assert(!isNull());
|
||||||
|
return object().call<int32_t>(Meta::data().getCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool Cursor::moveToFirst() {
|
||||||
|
assert(!isNull());
|
||||||
|
return object().call<bool>(Meta::data().moveToFirst);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool Cursor::moveToNext() {
|
||||||
|
assert(!isNull());
|
||||||
|
return object().call<bool>(Meta::data().moveToNext);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int32_t Cursor::getColumnIndex(std::string const &columnName) {
|
||||||
|
assert(!isNull());
|
||||||
|
return object().call<int32_t>(Meta::data().getColumnIndex, columnName);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string Cursor::getString(int32_t column) {
|
||||||
|
assert(!isNull());
|
||||||
|
return object().call<std::string>(Meta::data().getString, column);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int32_t Cursor::getInt(int32_t column) {
|
||||||
|
assert(!isNull());
|
||||||
|
return object().call<int32_t>(Meta::data().getInt, column);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Cursor::close() {
|
||||||
|
assert(!isNull());
|
||||||
|
return object().call<void>(Meta::data().close);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace android::database
|
||||||
|
} // namespace wrap
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class Point : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ class Point : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace android::graphics
|
} // namespace android::graphics
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "android.graphics.impl.h"
|
#include "android.graphics.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -15,5 +16,6 @@ inline int32_t Point::getY() const {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return get(Meta::data().y, object());
|
return get(Meta::data().y, object());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace android::graphics
|
} // namespace android::graphics
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
|
10
src/external/android-jni-wrap/wrap/android.os.h
vendored
10
src/external/android-jni-wrap/wrap/android.os.h
vendored
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class BaseBundle : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ class BaseBundle : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.os.Bundle objects.
|
* Wrapper for android.os.Bundle objects.
|
||||||
*/
|
*/
|
||||||
|
@ -98,7 +99,7 @@ class Bundle : public BaseBundle {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +187,7 @@ class ParcelFileDescriptor : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +195,7 @@ class ParcelFileDescriptor : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace android::os
|
} // namespace android::os
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "android.os.impl.h"
|
#include "android.os.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -49,5 +50,6 @@ inline void ParcelFileDescriptor::checkError() const {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return object().call<void>(Meta::data().checkError);
|
return object().call<void>(Meta::data().checkError);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace android::os
|
} // namespace android::os
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class Settings : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ class Settings : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace android::provider
|
} // namespace android::provider
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "android.provider.impl.h"
|
#include "android.provider.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -9,5 +10,6 @@ namespace android::provider {
|
||||||
inline std::string Settings::ACTION_VR_LISTENER_SETTINGS() {
|
inline std::string Settings::ACTION_VR_LISTENER_SETTINGS() {
|
||||||
return get(Meta::data().ACTION_VR_LISTENER_SETTINGS, Meta::data().clazz());
|
return get(Meta::data().ACTION_VR_LISTENER_SETTINGS, Meta::data().clazz());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace android::provider
|
} // namespace android::provider
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class VrListenerService : public app::Service {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ class VrListenerService : public app::Service {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace android::service::vr
|
} // namespace android::service::vr
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "android.service.vr.impl.h"
|
#include "android.service.vr.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -15,5 +16,6 @@ inline bool VrListenerService::isVrModePackageEnabled(
|
||||||
context.object(),
|
context.object(),
|
||||||
componentName.object());
|
componentName.object());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace android::service::vr
|
} // namespace android::service::vr
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class DisplayMetrics : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ class DisplayMetrics : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace android::util
|
} // namespace android::util
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "android.util.impl.h"
|
#include "android.util.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -15,5 +16,6 @@ inline int32_t DisplayMetrics::getWidthPixels() const {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return get(Meta::data().widthPixels, object());
|
return get(Meta::data().widthPixels, object());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace android::util
|
} // namespace android::util
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class Display : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ class Display : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.view.Surface objects.
|
* Wrapper for android.view.Surface objects.
|
||||||
*/
|
*/
|
||||||
|
@ -105,7 +106,7 @@ class Surface : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +114,7 @@ class Surface : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for android.view.SurfaceHolder objects.
|
* Wrapper for android.view.SurfaceHolder objects.
|
||||||
*/
|
*/
|
||||||
|
@ -144,7 +146,7 @@ class SurfaceHolder : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +154,7 @@ class SurfaceHolder : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace android::view
|
} // namespace android::view
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "android.view.impl.h"
|
#include "android.view.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -19,13 +20,16 @@ inline void Display::getRealMetrics(util::DisplayMetrics &out_displayMetrics) {
|
||||||
return object().call<void>(Meta::data().getRealMetrics,
|
return object().call<void>(Meta::data().getRealMetrics,
|
||||||
out_displayMetrics.object());
|
out_displayMetrics.object());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool Surface::isValid() const {
|
inline bool Surface::isValid() const {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return object().call<bool>(Meta::data().isValid);
|
return object().call<bool>(Meta::data().isValid);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Surface SurfaceHolder::getSurface() {
|
inline Surface SurfaceHolder::getSurface() {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return Surface(object().call<jni::Object>(Meta::data().getSurface));
|
return Surface(object().call<jni::Object>(Meta::data().getSurface));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace android::view
|
} // namespace android::view
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class Toast : public ObjectWrapperBase {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static Toast makeText(content::Context const &context,
|
static Toast makeText(content::Context const &context,
|
||||||
std::string const &stringParam, int32_t duration);
|
jni::Object const &text, int32_t duration);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for the makeText static method
|
* Wrapper for the makeText static method
|
||||||
|
@ -86,7 +86,7 @@ class Toast : public ObjectWrapperBase {
|
||||||
* JNI signature: (Landroid/content/Context;II)Landroid/widget/Toast;
|
* JNI signature: (Landroid/content/Context;II)Landroid/widget/Toast;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static Toast makeText(content::Context &context, int32_t resId,
|
static Toast makeText(content::Context const &context, int32_t resId,
|
||||||
int32_t duration);
|
int32_t duration);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -103,7 +103,7 @@ class Toast : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@ class Toast : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace android::widget
|
} // namespace android::widget
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "android.widget.impl.h"
|
#include "android.widget.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -22,15 +23,16 @@ inline void Toast::show() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Toast Toast::makeText(content::Context const &context,
|
inline Toast Toast::makeText(content::Context const &context,
|
||||||
std::string const &stringParam, int32_t duration) {
|
jni::Object const &text, int32_t duration) {
|
||||||
return Toast(Meta::data().clazz().call<jni::Object>(
|
return Toast(Meta::data().clazz().call<jni::Object>(
|
||||||
Meta::data().makeText, context.object(), stringParam, duration));
|
Meta::data().makeText, context.object(), text, duration));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Toast Toast::makeText(content::Context &context, int32_t resId,
|
inline Toast Toast::makeText(content::Context const &context, int32_t resId,
|
||||||
int32_t duration) {
|
int32_t duration) {
|
||||||
return Toast(Meta::data().clazz().call<jni::Object>(
|
return Toast(Meta::data().clazz().call<jni::Object>(
|
||||||
Meta::data().makeText1, context.object(), resId, duration));
|
Meta::data().makeText1, context.object(), resId, duration));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace android::widget
|
} // namespace android::widget
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
|
||||||
|
|
||||||
#include "dalvik.system.h"
|
|
||||||
|
|
||||||
namespace wrap {
|
|
||||||
namespace dalvik::system {
|
|
||||||
DexClassLoader::Meta::Meta()
|
|
||||||
: MetaBase(DexClassLoader::getTypeName()),
|
|
||||||
init(classRef().getMethod("<init>",
|
|
||||||
"(Ljava/lang/String;Ljava/lang/String;Ljava/"
|
|
||||||
"lang/String;Ljava/lang/ClassLoader;)V")) {}
|
|
||||||
} // namespace dalvik::system
|
|
||||||
} // namespace wrap
|
|
|
@ -1,67 +0,0 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ObjectWrapperBase.h"
|
|
||||||
|
|
||||||
namespace wrap {
|
|
||||||
namespace dalvik::system {
|
|
||||||
class DexClassLoader;
|
|
||||||
} // namespace dalvik::system
|
|
||||||
|
|
||||||
namespace java::lang {
|
|
||||||
class ClassLoader;
|
|
||||||
} // namespace java::lang
|
|
||||||
|
|
||||||
} // namespace wrap
|
|
||||||
|
|
||||||
namespace wrap {
|
|
||||||
namespace dalvik::system {
|
|
||||||
/*!
|
|
||||||
* Wrapper for dalvik.system.DexClassLoader objects.
|
|
||||||
*/
|
|
||||||
class DexClassLoader : public ObjectWrapperBase {
|
|
||||||
public:
|
|
||||||
using ObjectWrapperBase::ObjectWrapperBase;
|
|
||||||
static constexpr const char *getTypeName() noexcept {
|
|
||||||
return "dalvik/system/DexClassLoader";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Wrapper for a constructor
|
|
||||||
*
|
|
||||||
* Java prototype:
|
|
||||||
* `public dalvik.system.DexClassLoader(java.lang.String, java.lang.String,
|
|
||||||
* java.lang.String, java.lang.ClassLoader);`
|
|
||||||
*
|
|
||||||
* JNI signature:
|
|
||||||
* (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)V
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static DexClassLoader construct(std::string const &searchPath,
|
|
||||||
std::string const &nativeSearchPath,
|
|
||||||
jni::Object parentClassLoader);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Class metadata
|
|
||||||
*/
|
|
||||||
struct Meta : public MetaBase {
|
|
||||||
jni::method_t init;
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Singleton accessor
|
|
||||||
*/
|
|
||||||
static Meta &data() {
|
|
||||||
static Meta instance;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Meta();
|
|
||||||
};
|
|
||||||
};
|
|
||||||
} // namespace dalvik::system
|
|
||||||
} // namespace wrap
|
|
||||||
#include "dalvik.system.impl.h"
|
|
|
@ -1,21 +0,0 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "java.lang.h"
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace wrap {
|
|
||||||
namespace dalvik::system {
|
|
||||||
inline DexClassLoader
|
|
||||||
DexClassLoader::construct(std::string const &searchPath,
|
|
||||||
std::string const &nativeSearchPath,
|
|
||||||
jni::Object parentClassLoader) {
|
|
||||||
return DexClassLoader{
|
|
||||||
Meta::data().clazz().newInstance(Meta::data().init, searchPath, "",
|
|
||||||
nativeSearchPath, parentClassLoader)};
|
|
||||||
}
|
|
||||||
} // namespace dalvik::system
|
|
||||||
} // namespace wrap
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -13,9 +13,6 @@ Class::Meta::Meta()
|
||||||
forName1(classRef().getStaticMethod(
|
forName1(classRef().getStaticMethod(
|
||||||
"forName",
|
"forName",
|
||||||
"(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;")),
|
"(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;")),
|
||||||
forName2(classRef().getStaticMethod(
|
|
||||||
"forName",
|
|
||||||
"(Ljava/lang/Module;Ljava/lang/String;)Ljava/lang/Class;")),
|
|
||||||
getCanonicalName(
|
getCanonicalName(
|
||||||
classRef().getMethod("getCanonicalName", "()Ljava/lang/String;")) {}
|
classRef().getMethod("getCanonicalName", "()Ljava/lang/String;")) {}
|
||||||
ClassLoader::Meta::Meta()
|
ClassLoader::Meta::Meta()
|
||||||
|
|
28
src/external/android-jni-wrap/wrap/java.lang.h
vendored
28
src/external/android-jni-wrap/wrap/java.lang.h
vendored
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class Class : public ObjectWrapperBase {
|
||||||
* JNI signature: (Ljava/lang/String;)Ljava/lang/Class;
|
* JNI signature: (Ljava/lang/String;)Ljava/lang/Class;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static Class forName(std::string &stringParam);
|
static Class forName(std::string const &name);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for the forName static method
|
* Wrapper for the forName static method
|
||||||
|
@ -50,23 +50,11 @@ class Class : public ObjectWrapperBase {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static Class forName(std::string const &name, bool initialize,
|
static Class forName(std::string const &name, bool initialize,
|
||||||
jni::Object classLoader);
|
ClassLoader const &classLoader);
|
||||||
|
|
||||||
//! @overload
|
//! @overload
|
||||||
static Class forName(jstring name, bool initialize,
|
static Class forName(jstring name, bool initialize,
|
||||||
jni::Object classLoader);
|
jni::Object classLoader);
|
||||||
/*!
|
|
||||||
* Wrapper for the forName static method
|
|
||||||
*
|
|
||||||
* Java prototype:
|
|
||||||
* `public static java.lang.Class<?> forName(java.lang.Module,
|
|
||||||
* java.lang.String);`
|
|
||||||
*
|
|
||||||
* JNI signature: (Ljava/lang/Module;Ljava/lang/String;)Ljava/lang/Class;
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static Class forName(jni::Object const &module, std::string const &name);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for the getCanonicalName method
|
* Wrapper for the getCanonicalName method
|
||||||
*
|
*
|
||||||
|
@ -84,14 +72,13 @@ class Class : public ObjectWrapperBase {
|
||||||
struct Meta : public MetaBase {
|
struct Meta : public MetaBase {
|
||||||
jni::method_t forName;
|
jni::method_t forName;
|
||||||
jni::method_t forName1;
|
jni::method_t forName1;
|
||||||
jni::method_t forName2;
|
|
||||||
jni::method_t getCanonicalName;
|
jni::method_t getCanonicalName;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +86,7 @@ class Class : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for java.lang.ClassLoader objects.
|
* Wrapper for java.lang.ClassLoader objects.
|
||||||
*/
|
*/
|
||||||
|
@ -143,7 +131,7 @@ class ClassLoader : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +139,7 @@ class ClassLoader : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper for java.lang.System objects.
|
* Wrapper for java.lang.System objects.
|
||||||
*/
|
*/
|
||||||
|
@ -182,7 +171,7 @@ class System : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,6 +179,7 @@ class System : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace java::lang
|
} // namespace java::lang
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "java.lang.impl.h"
|
#include "java.lang.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -8,15 +9,15 @@
|
||||||
|
|
||||||
namespace wrap {
|
namespace wrap {
|
||||||
namespace java::lang {
|
namespace java::lang {
|
||||||
inline Class Class::forName(std::string &stringParam) {
|
inline Class Class::forName(std::string const &name) {
|
||||||
return Class(Meta::data().clazz().call<jni::Object>(Meta::data().forName,
|
return Class(
|
||||||
stringParam));
|
Meta::data().clazz().call<jni::Object>(Meta::data().forName, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Class Class::forName(std::string const &name, bool initialize,
|
inline Class Class::forName(std::string const &name, bool initialize,
|
||||||
jni::Object classLoader) {
|
ClassLoader const &classLoader) {
|
||||||
return Class(Meta::data().clazz().call<jni::Object>(
|
return Class(Meta::data().clazz().call<jni::Object>(
|
||||||
Meta::data().forName1, name, initialize, classLoader));
|
Meta::data().forName1, name, initialize, classLoader.object()));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Class Class::forName(jstring name, bool initialize,
|
inline Class Class::forName(jstring name, bool initialize,
|
||||||
|
@ -25,12 +26,6 @@ inline Class Class::forName(jstring name, bool initialize,
|
||||||
Meta::data().forName, name, initialize, classLoader)};
|
Meta::data().forName, name, initialize, classLoader)};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Class Class::forName(jni::Object const &module,
|
|
||||||
std::string const &name) {
|
|
||||||
return Class(Meta::data().clazz().call<jni::Object>(Meta::data().forName2,
|
|
||||||
module, name));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string Class::getCanonicalName() {
|
inline std::string Class::getCanonicalName() {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return object().call<std::string>(Meta::data().getCanonicalName);
|
return object().call<std::string>(Meta::data().getCanonicalName);
|
||||||
|
@ -55,5 +50,6 @@ inline std::string System::mapLibraryName(std::string const &name) {
|
||||||
return Meta::data().clazz().call<std::string>(Meta::data().mapLibraryName,
|
return Meta::data().clazz().call<std::string>(Meta::data().mapLibraryName,
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace java::lang
|
} // namespace java::lang
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class List : public ObjectWrapperBase {
|
||||||
* Singleton accessor
|
* Singleton accessor
|
||||||
*/
|
*/
|
||||||
static Meta &data() {
|
static Meta &data() {
|
||||||
static Meta instance;
|
static Meta instance{};
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ class List : public ObjectWrapperBase {
|
||||||
Meta();
|
Meta();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace java::util
|
} // namespace java::util
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
#include "java.util.impl.h"
|
#include "java.util.impl.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2020, Collabora, Ltd.
|
// Copyright 2020-2021, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
// Author: Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||||
|
// Inline implementations: do not include on its own!
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
@ -15,5 +16,6 @@ inline jni::Object List::get(int32_t index) const {
|
||||||
assert(!isNull());
|
assert(!isNull());
|
||||||
return object().call<jni::Object>(Meta::data().get, index);
|
return object().call<jni::Object>(Meta::data().get, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace java::util
|
} // namespace java::util
|
||||||
} // namespace wrap
|
} // namespace wrap
|
||||||
|
|
Loading…
Reference in a new issue