Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Android 12 #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Support Android 12 #97

wants to merge 1 commit into from

Conversation

bad-copy
Copy link

@bad-copy bad-copy commented Jan 19, 2023

dex_code_item_offset_ is removed from ArtMethod for Android 12.

@francescoelbiesjt
Copy link

can android13 support?

@miyohome
Copy link

miyohome commented Nov 21, 2023

Support android 13 14 based on others submissions

Step1 Modify hide_api.cpp

        if(make_initialized_classes_visibly_initialized_) {
            size_t OFFSET_classlinker;
#ifdef __LP64__
            if (SDK_INT >= ANDROID_TIRAMISU) {
                OFFSET_classlinker = 600;
                // OFFSET_classlinker = 592;
            } else if (SDK_INT >= ANDROID_S) {
                OFFSET_classlinker = 496;
            } else {
                OFFSET_classlinker = 472;
            }
#else
            if (SDK_INT >= ANDROID_TIRAMISU) {
                OFFSET_classlinker = 340;
                // OFFSET_classlinker = 336;
            } else if (SDK_INT >= ANDROID_S) {
                OFFSET_classlinker = 288;
            } else {
                OFFSET_classlinker = 276;
            }
#endif
            void *thiz = *reinterpret_cast<void **>(
                    reinterpret_cast<size_t>(runtime_instance_) + OFFSET_classlinker);
            make_initialized_classes_visibly_initialized_(thiz, self, true);
        }
    }

Step2 Modify arch.h
#define ANDROID_TIRAMISU 33





If shouldUseInterpreterEntryPoint inline can use the following code

bool doHookWithReplacement(JNIEnv* env,
                           art::mirror::ArtMethod *originMethod,
                           art::mirror::ArtMethod *hookMethod,
                           art::mirror::ArtMethod *backupMethod) {
    // ...
        originMethod->setQuickCodeEntry(hookTrampoline->replacement->getCode());
        originMethod->setNative(); // this code
    // ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants