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

Commit

Permalink
Fixed privacy service not running with older Xposed releases
Browse files Browse the repository at this point in the history
Closes #2206
  • Loading branch information
M66B committed May 25, 2015
1 parent 757b41d commit bba3476
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
4 changes: 2 additions & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="biz.bokhorst.xprivacy"
android:installLocation="internalOnly"
android:versionCode="476"
android:versionName="3.6.14" >
android:versionCode="477"
android:versionName="3.6.15" >

<uses-sdk
android:minSdkVersion="15"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ Changelog

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

**Version 3.6.15 BETA**

* Fixed privacy service not running with older Xposed releases ([issue](/../../issues/2206))

**Version 3.6.14 BETA**

* Fixed on demand restricting for some custom ROMs (OPPO)
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 @@ -13,7 +13,6 @@
import android.content.Intent;
import android.location.Address;
import android.location.Geocoder;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Process;
Expand Down Expand Up @@ -283,7 +282,7 @@ protected void onCreate(Bundle savedInstanceState) {
}
cbExpert.setChecked(expert);

if (PrivacyManager.cVersion3 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
if (PrivacyManager.cVersion3 && !Util.isSELinuxEnforced())
cbAOSP.setVisibility(View.VISIBLE);

if (expert) {
Expand Down
4 changes: 2 additions & 2 deletions src/biz/bokhorst/xprivacy/PrivacyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public class PrivacyService extends IPrivacyService.Stub {
private static final String cTableUsage = "usage";
private static final String cTableSetting = "setting";

private static final int cCurrentVersion = 476;
private static final String cServiceName = "xprivacy476";
private static final int cCurrentVersion = 477;
private static final String cServiceName = "xprivacy477";

private boolean mCorrupt = false;
private boolean mNotified = false;
Expand Down
11 changes: 11 additions & 0 deletions src/biz/bokhorst/xprivacy/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,17 @@ public static boolean hasLBE() {
return mHasLBE;
}

public static boolean isSELinuxEnforced() {
try {
Class<?> cSELinux = Class.forName("android.os.SELinux");
if ((Boolean) cSELinux.getDeclaredMethod("isSELinuxEnabled").invoke(null))
if ((Boolean) cSELinux.getDeclaredMethod("isSELinuxEnforced").invoke(null))
return true;
} catch (Throwable t) {
}
return false;
}

public static int getSelfVersionCode(Context context) {
try {
String self = Util.class.getPackage().getName();
Expand Down
3 changes: 1 addition & 2 deletions src/biz/bokhorst/xprivacy/XPrivacy.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
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 @@ -43,7 +42,7 @@ public void initZygote(StartupParam startupParam) throws Throwable {
mSecret = Long.toHexString(new Random().nextLong());

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

// Read list of disabled hooks
if (mListDisabled.size() == 0 && !selinux) {
Expand Down

0 comments on commit bba3476

Please sign in to comment.