Skip to content

Commit

Permalink
Enforce using the Dalvik runtime library
Browse files Browse the repository at this point in the history
As ART is not supported (yet?), disable it when Xposed is active to
avoid bootloops.
  • Loading branch information
rovo89 committed Nov 22, 2013
1 parent 04c1d3c commit ebc0eac
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions app_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ int main(int argc, char* const argv[])
runtime.mParentDir = parentDir;

xposedInfo();
xposedEnforceDalvik();
keepLoadingXposed = !isXposedDisabled() && !xposedShouldIgnoreCommand(className, argc, argv) && addXposedToClasspath(zygote);

if (zygote) {
Expand Down
14 changes: 14 additions & 0 deletions xposed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include "xposed_offsets.h"

extern int RUNNING_PLATFORM_SDK_VERSION;


namespace android {

Expand Down Expand Up @@ -65,6 +67,18 @@ void xposedInfo() {
ALOGD("ROM: %s\n", rom);
}

void xposedEnforceDalvik() {
if (RUNNING_PLATFORM_SDK_VERSION < 19)
return;

char runtime[PROPERTY_VALUE_MAX];
property_get("persist.sys.dalvik.vm.lib", runtime, "");
if (strcmp(runtime, "libdvm.so") != 0) {
ALOGE("Unsupported runtime library %s, setting to libdvm.so", runtime);
property_set("persist.sys.dalvik.vm.lib", "libdvm.so");
}
}

bool isXposedDisabled() {
// is the blocker file present?
if (access(XPOSED_LOAD_BLOCKER, F_OK) == 0) {
Expand Down
1 change: 1 addition & 0 deletions xposed.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct XposedHookInfo {

// called directoy by app_process
void xposedInfo();
void xposedEnforceDalvik();
bool isXposedDisabled();
bool xposedShouldIgnoreCommand(const char* className, int argc, const char* const argv[]);
bool addXposedToClasspath(bool zygote);
Expand Down

0 comments on commit ebc0eac

Please sign in to comment.