mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-21 11:48:30 +00:00
Minor Zygisk API changes
This commit is contained in:
parent
f59309a445
commit
27814e3015
@ -1,6 +1,8 @@
|
|||||||
// All content of this file is released to the public domain.
|
// All content of this file is released to the public domain.
|
||||||
|
|
||||||
// This file is the public API for Zygisk modules, and should always be updated in sync with:
|
// This file is the public API for Zygisk modules.
|
||||||
|
// DO NOT use this file for developing Zygisk modules as it might contain WIP changes.
|
||||||
|
// Always use the following header for development as those are finalized APIs:
|
||||||
// https://github.com/topjohnwu/zygisk-module-sample/blob/master/module/jni/zygisk.hpp
|
// https://github.com/topjohnwu/zygisk-module-sample/blob/master/module/jni/zygisk.hpp
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -162,7 +164,7 @@ struct Api {
|
|||||||
//
|
//
|
||||||
// The unmounting does not happen immediately after the function is called. It is actually
|
// The unmounting does not happen immediately after the function is called. It is actually
|
||||||
// done during app process specialization.
|
// done during app process specialization.
|
||||||
void forceDenylistUnmount();
|
void forceDenyListUnmount();
|
||||||
|
|
||||||
// Hook JNI native methods for a class
|
// Hook JNI native methods for a class
|
||||||
//
|
//
|
||||||
@ -220,14 +222,12 @@ struct module_abi {
|
|||||||
long api_version;
|
long api_version;
|
||||||
ModuleBase *_this;
|
ModuleBase *_this;
|
||||||
|
|
||||||
void (*onLoad)(ModuleBase *, Api *, JNIEnv *);
|
|
||||||
void (*preAppSpecialize)(ModuleBase *, AppSpecializeArgs *);
|
void (*preAppSpecialize)(ModuleBase *, AppSpecializeArgs *);
|
||||||
void (*postAppSpecialize)(ModuleBase *, const AppSpecializeArgs *);
|
void (*postAppSpecialize)(ModuleBase *, const AppSpecializeArgs *);
|
||||||
void (*preServerSpecialize)(ModuleBase *, ServerSpecializeArgs *);
|
void (*preServerSpecialize)(ModuleBase *, ServerSpecializeArgs *);
|
||||||
void (*postServerSpecialize)(ModuleBase *, const ServerSpecializeArgs *);
|
void (*postServerSpecialize)(ModuleBase *, const ServerSpecializeArgs *);
|
||||||
|
|
||||||
module_abi(ModuleBase *module) : api_version(ZYGISK_API_VERSION), _this(module) {
|
module_abi(ModuleBase *module) : api_version(ZYGISK_API_VERSION), _this(module) {
|
||||||
onLoad = [](auto self, auto api, auto env) { self->onLoad(api, env); };
|
|
||||||
preAppSpecialize = [](auto self, auto args) { self->preAppSpecialize(args); };
|
preAppSpecialize = [](auto self, auto args) { self->preAppSpecialize(args); };
|
||||||
postAppSpecialize = [](auto self, auto args) { self->postAppSpecialize(args); };
|
postAppSpecialize = [](auto self, auto args) { self->postAppSpecialize(args); };
|
||||||
preServerSpecialize = [](auto self, auto args) { self->preServerSpecialize(args); };
|
preServerSpecialize = [](auto self, auto args) { self->preServerSpecialize(args); };
|
||||||
@ -248,12 +248,12 @@ struct api_table {
|
|||||||
|
|
||||||
// Zygisk functions
|
// Zygisk functions
|
||||||
int (*connectCompanion)(void * /* _this */);
|
int (*connectCompanion)(void * /* _this */);
|
||||||
void (*forceDenylistUnmount)(void * /* _this */);
|
void (*forceDenyListUnmount)(void * /* _this */);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void entry_impl(api_table *table, JNIEnv *env) {
|
void entry_impl(api_table *table, JNIEnv *env) {
|
||||||
auto module = new T();
|
ModuleBase *module = new T();
|
||||||
if (!table->registerModule(table, new module_abi(module)))
|
if (!table->registerModule(table, new module_abi(module)))
|
||||||
return;
|
return;
|
||||||
auto api = new Api();
|
auto api = new Api();
|
||||||
@ -266,8 +266,8 @@ void entry_impl(api_table *table, JNIEnv *env) {
|
|||||||
int Api::connectCompanion() {
|
int Api::connectCompanion() {
|
||||||
return impl->connectCompanion(impl->_this);
|
return impl->connectCompanion(impl->_this);
|
||||||
}
|
}
|
||||||
void Api::forceDenylistUnmount() {
|
void Api::forceDenyListUnmount() {
|
||||||
impl->forceDenylistUnmount(impl->_this);
|
impl->forceDenyListUnmount(impl->_this);
|
||||||
}
|
}
|
||||||
void Api::hookJniNativeMethods(const char *className, JNINativeMethod *methods, int numMethods) {
|
void Api::hookJniNativeMethods(const char *className, JNINativeMethod *methods, int numMethods) {
|
||||||
impl->hookJniNativeMethods(className, methods, numMethods);
|
impl->hookJniNativeMethods(className, methods, numMethods);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user