Skip to content

Commit

Permalink
Added "safemode_disable" flag file to prevent disabling Xposed with t…
Browse files Browse the repository at this point in the history
…he safemode key sequence during Zygote startup.

If the file exists, safemode detection will be entirely disabled.
  • Loading branch information
Tungstwenty committed Feb 10, 2014
1 parent 2572fa2 commit 6485105
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ int main(int argc, char* const argv[])
}

if (zygote) {
if (xposed::detectSafemodeTrigger(xposedSkipSafemodeDelay()))
if (!xposedDisableSafemode() && xposed::detectSafemodeTrigger(xposedSkipSafemodeDelay()))
disableXposed();
}

Expand Down
8 changes: 8 additions & 0 deletions xposed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ bool xposedSkipSafemodeDelay() {
return false;
}

bool xposedDisableSafemode() {
// is the flag file present?
if (access(XPOSED_SAFEMODE_DISABLE, F_OK) == 0)
return true;
else
return false;
}


// ignore the broadcasts by various Superuser implementations to avoid spamming the Xposed log
bool xposedShouldIgnoreCommand(const char* className, int argc, const char* const argv[]) {
Expand Down
2 changes: 2 additions & 0 deletions xposed.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace android {
#define XPOSED_JAR_NEWVERSION XPOSED_DIR "bin/XposedBridge.jar.newversion"
#define XPOSED_LOAD_BLOCKER XPOSED_DIR "conf/disabled"
#define XPOSED_SAFEMODE_NODELAY XPOSED_DIR "conf/safemode_nodelay"
#define XPOSED_SAFEMODE_DISABLE XPOSED_DIR "conf/safemode_disable"
#define XPOSED_CLASS "de/robv/android/xposed/XposedBridge"
#define XPOSED_CLASS_DOTS "de.robv.android.xposed.XposedBridge"
#define XRESOURCES_CLASS "android/content/res/XResources"
Expand Down Expand Up @@ -45,6 +46,7 @@ void xposedEnforceDalvik();
void disableXposed();
bool isXposedDisabled();
bool xposedSkipSafemodeDelay();
bool xposedDisableSafemode();
bool xposedShouldIgnoreCommand(const char* className, int argc, const char* const argv[]);
bool addXposedToClasspath(bool zygote);
bool xposedOnVmCreated(JNIEnv* env, const char* className);
Expand Down

0 comments on commit 6485105

Please sign in to comment.