mirror of
https://github.com/LSPosed/LSPlant.git
synced 2025-05-04 12:19:52 +08:00
Fix ABI
This commit is contained in:
parent
96f217d0bf
commit
2c1fba450b
@ -70,7 +70,7 @@ private:
|
||||
|
||||
CREATE_HOOK_STUB_ENTRY(
|
||||
"_ZN3art6mirror5Class9SetStatusENS_6HandleIS1_EENS_11ClassStatusEPNS_6ThreadE", void,
|
||||
SetClassStatus, (Handle<Class> h, uint8_t new_status, Thread *self), {
|
||||
SetClassStatus, (TrivialHandle<Class> h, uint8_t new_status, Thread *self), {
|
||||
if (new_status == initialized_status) {
|
||||
BackupClassMethods(h->GetClassDef(), self);
|
||||
}
|
||||
@ -86,6 +86,15 @@ private:
|
||||
return backup(h, new_status, self);
|
||||
});
|
||||
|
||||
CREATE_HOOK_STUB_ENTRY(
|
||||
"_ZN3art6mirror5Class9SetStatusENS_6HandleIS1_EENS1_6StatusEPNS_6ThreadE", void,
|
||||
TrivialSetStatus, (TrivialHandle<Class> h, uint32_t new_status, Thread *self), {
|
||||
if (new_status == initialized_status) {
|
||||
BackupClassMethods(h->GetClassDef(), self);
|
||||
}
|
||||
return backup(h, new_status, self);
|
||||
});
|
||||
|
||||
CREATE_MEM_HOOK_STUB_ENTRY("_ZN3art6mirror5Class9SetStatusENS1_6StatusEPNS_6ThreadE", void,
|
||||
ClassSetStatus, (Class * thiz, int new_status, Thread *self), {
|
||||
if (new_status == static_cast<int>(initialized_status)) {
|
||||
@ -107,11 +116,18 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!HookSyms(handler, SetClassStatus, SetStatus, ClassSetStatus)) {
|
||||
return false;
|
||||
int sdk_int = GetAndroidApiLevel();
|
||||
|
||||
if (sdk_int < __ANDROID_API_O__) {
|
||||
if (!HookSyms(handler, SetStatus, ClassSetStatus)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!HookSyms(handler, SetClassStatus, TrivialSetStatus)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int sdk_int = GetAndroidApiLevel();
|
||||
if (sdk_int >= __ANDROID_API_R__) {
|
||||
initialized_status = 15;
|
||||
} else if (sdk_int >= __ANDROID_API_P__) {
|
||||
|
@ -14,14 +14,37 @@ class Class;
|
||||
template <typename T>
|
||||
class Handle : public ValueObject {
|
||||
public:
|
||||
Handle(const Handle<T>& handle) : reference_(handle.reference_) {}
|
||||
|
||||
Handle<T>& operator=(const Handle<T>& handle) {
|
||||
reference_ = handle.reference_;
|
||||
return *this;
|
||||
}
|
||||
static_assert(std::is_same_v<T, mirror::Class>, "Expected mirror::Class");
|
||||
|
||||
auto operator->() { return Get(); }
|
||||
|
||||
T *Get() { return down_cast<T *>(reference_->AsMirrorPtr()); }
|
||||
T* Get() { return down_cast<T*>(reference_->AsMirrorPtr()); }
|
||||
|
||||
protected:
|
||||
StackReference<T> *reference_;
|
||||
StackReference<T>* reference_;
|
||||
};
|
||||
|
||||
static_assert(!std::is_trivially_copyable_v<Handle<mirror::Class>>);
|
||||
|
||||
// https://cs.android.com/android/_/android/platform/art/+/38cea84b362a10859580e788e984324f36272817
|
||||
template <typename T>
|
||||
class TrivialHandle : public ValueObject {
|
||||
public:
|
||||
static_assert(std::is_same_v<T, mirror::Class>, "Expected mirror::Class");
|
||||
|
||||
auto operator->() { return Get(); }
|
||||
|
||||
T* Get() { return down_cast<T*>(reference_->AsMirrorPtr()); }
|
||||
|
||||
protected:
|
||||
StackReference<T>* reference_;
|
||||
};
|
||||
static_assert(std::is_trivially_copyable_v<TrivialHandle<mirror::Class>>);
|
||||
|
||||
} // namespace lsplant::art
|
||||
|
@ -5,8 +5,8 @@ pluginManagement {
|
||||
mavenCentral()
|
||||
}
|
||||
plugins {
|
||||
id("com.android.application") version "7.3.0"
|
||||
id("com.android.library") version "7.3.0"
|
||||
id("com.android.application") version "7.3.1"
|
||||
id("com.android.library") version "7.3.1"
|
||||
}
|
||||
}
|
||||
dependencyResolutionManagement {
|
||||
|
@ -76,7 +76,7 @@ android {
|
||||
createDevice(28, true)
|
||||
createDevice(29, false)
|
||||
createDevice(29, true)
|
||||
createDevice(30, false, "aosp_atd")
|
||||
createDevice(30, false)
|
||||
createDevice(30, true)
|
||||
// createDevice(31, false, "android-tv")
|
||||
createDevice(31, true, "aosp_atd")
|
||||
|
Loading…
x
Reference in New Issue
Block a user