Skip to content

Support Android 12#97

Open
bad-copy wants to merge 1 commit into
asLody:masterfrom
bad-copy:master
Open

Support Android 12#97
bad-copy wants to merge 1 commit into
asLody:masterfrom
bad-copy:master

Conversation

@bad-copy

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

Copy link
Copy Markdown

dex_code_item_offset_ is removed from ArtMethod for Android 12.

@francescoelbiesjt

Copy link
Copy Markdown

can android13 support?

@miyohome

miyohome commented Nov 21, 2023

Copy link
Copy Markdown

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