Skip to content

Commit

Permalink
Do not read /data/system/xprivacy/aosp on Lollipop to prevent trigger…
Browse files Browse the repository at this point in the history
…ing SELinux policies
  • Loading branch information
M66B committed May 23, 2015
1 parent 17051fa commit 15dedf8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
3 changes: 2 additions & 1 deletion src/biz/bokhorst/xprivacy/ActivitySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ protected void onCreate(Bundle savedInstanceState) {
}
cbExpert.setChecked(expert);

if (PrivacyManager.cVersion3 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
if (PrivacyManager.cVersion3 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
&& Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
cbAOSP.setVisibility(View.VISIBLE);

if (expert) {
Expand Down
30 changes: 15 additions & 15 deletions src/biz/bokhorst/xprivacy/XPrivacy.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,22 @@ private void bootstrapZygote() throws Throwable {
} catch (Throwable ex) {
Log.w("XPrivacy", ex.toString());
}
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
try {
Class<?> libcore = Class.forName("libcore.io.Libcore");
Field fOs = libcore.getDeclaredField("os");
fOs.setAccessible(true);
Object os = fOs.get(null);
Method setenv = os.getClass().getMethod("setenv", String.class, String.class, boolean.class);
setenv.setAccessible(true);
boolean aosp = new File("/data/system/xprivacy/aosp").exists();
setenv.invoke(os, "XPrivacy.AOSP", Boolean.toString(aosp), false);
Util.log(null, Log.WARN, "AOSP mode forced=" + aosp);
} catch (Throwable ex) {
Util.bug(null, ex);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
try {
Class<?> libcore = Class.forName("libcore.io.Libcore");
Field fOs = libcore.getDeclaredField("os");
fOs.setAccessible(true);
Object os = fOs.get(null);
Method setenv = os.getClass().getMethod("setenv", String.class, String.class, boolean.class);
setenv.setAccessible(true);
boolean aosp = new File("/data/system/xprivacy/aosp").exists();
setenv.invoke(os, "XPrivacy.AOSP", Boolean.toString(aosp), false);
Util.log(null, Log.WARN, "AOSP mode forced=" + aosp);
} catch (Throwable ex) {
Util.bug(null, ex);
}
}

/*
* Add nixed User Space / System Server hooks
Expand Down

0 comments on commit 15dedf8

Please sign in to comment.