Skip to content
This repository has been archived by the owner on Sep 6, 2019. It is now read-only.

Commit

Permalink
AOSP mode on Lollipop for stock ROM only
Browse files Browse the repository at this point in the history
Fixes #2201
  • Loading branch information
M66B committed May 25, 2015
1 parent 0fb1c77 commit 7cd2c42
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1170,13 +1170,15 @@ Nevertheless, the most sensitive data, like contacts and your location, can safe
* [Android Revolution HD](http://forum.xda-developers.com/showthread.php?t=1925402)
* [Mahdi ROM](https://plus.google.com/u/0/communities/116540622179206449806)
* [Omega ROM](http://omegadroid.co/omega-roms/)
* AOSP mode = vanilla (Google) Android Lollipop
* Compatibility mode = all other Android versions/variants

*About* will show if XPrivacy 3 is running in compatibility mode, which means XPrivacy 3 is behaving as XPrivay 2.
If there is no message about compatibility mode, XPrivacy 3 is running in AOSP mode.
XPrivacy 3 will always run in compatibility mode on Android versions before KitKat.

You can force XPrivacy 3 into AOSP mode using the main settings.
This will work on Lollipop when SELinux is disabled or in permissive mode only.
There is no need to force AOSP mode if XPrivacy recognizes your ROM as a compatible ROM.

If you force AOSP mode, privacy sensitive data may leak.
Expand Down
3 changes: 1 addition & 2 deletions src/biz/bokhorst/xprivacy/ActivitySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,7 @@ protected void onCreate(Bundle savedInstanceState) {
}
cbExpert.setChecked(expert);

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

if (expert) {
Expand Down
21 changes: 19 additions & 2 deletions src/biz/bokhorst/xprivacy/Hook.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,25 @@ public static boolean isAOSP(int sdk) {
return true;
if (Build.DISPLAY == null || Build.HOST == null)
return false;
return (isAOSP() || isCyanogenMod() || isOmni() || isMIUI() || isSlim() || isParanoidAndroid()
|| isCarbon() || isDirtyUnicorns() || isLiquidSmooth() || isAndroidRevolutionHD() || isMahdi() || isOmega());
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
// @formatter:off
return (
isAOSP() ||
isCyanogenMod() ||
isOmni() ||
isMIUI() ||
isSlim() ||
isParanoidAndroid() ||
isCarbon() ||
isDirtyUnicorns() ||
isLiquidSmooth() ||
isAndroidRevolutionHD() ||
isMahdi() ||
isOmega()
);
// @formatter:on
else
return isAOSP();
} else
return false;
}
Expand Down
9 changes: 6 additions & 3 deletions src/biz/bokhorst/xprivacy/XPrivacy.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import android.os.Build;
import android.os.Process;
import android.util.Log;

import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.SELinuxHelper;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XC_MethodHook;
Expand All @@ -42,8 +42,11 @@ public void initZygote(StartupParam startupParam) throws Throwable {
// Generate secret
mSecret = Long.toHexString(new Random().nextLong());

// Reading files with SELinux enabled can result in bootloops
boolean selinux = (SELinuxHelper.isSELinuxEnabled() && SELinuxHelper.isSELinuxEnforced());

// Read list of disabled hooks
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP && mListDisabled.size() == 0) {
if (mListDisabled.size() == 0 && !selinux) {
File disabled = new File("/data/system/xprivacy/disabled");
if (disabled.exists() && disabled.canRead())
try {
Expand Down Expand Up @@ -71,7 +74,7 @@ public void initZygote(StartupParam startupParam) throws Throwable {
}

// AOSP mode override
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && !selinux)
try {
Class<?> libcore = Class.forName("libcore.io.Libcore");
Field fOs = libcore.getDeclaredField("os");
Expand Down

0 comments on commit 7cd2c42

Please sign in to comment.