diff --git a/src/biz/bokhorst/xprivacy/XActivityThread.java b/src/biz/bokhorst/xprivacy/XActivityThread.java index fe198b66e..21df9ce05 100644 --- a/src/biz/bokhorst/xprivacy/XActivityThread.java +++ b/src/biz/bokhorst/xprivacy/XActivityThread.java @@ -10,6 +10,7 @@ import android.annotation.SuppressLint; import android.content.BroadcastReceiver; import android.content.Intent; +import android.net.Uri; import android.nfc.NfcAdapter; import android.os.Binder; import android.os.Build; @@ -140,6 +141,19 @@ protected void before(MethodHookParam param) throws Throwable { .getDefacedProp(Binder.getCallingUid(), "PhoneNumber")); } } + } else if (getRestrictionName().equals(PrivacyManager.cSystem)) { + String[] packageNames; + if (action.equals(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE) + || action.equals(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE)) + packageNames = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_PACKAGE_LIST); + else + packageNames = new String[] { intent.getData().getEncodedSchemeSpecificPart() }; + for (String packageName : packageNames) + if (!XApplicationPackageManager.isPackageAllowed(packageName)) { + finish(param); + param.setResult(null); + break; + } } else if (isRestricted(param, mActionName)) { finish(param); param.setResult(null); diff --git a/src/biz/bokhorst/xprivacy/XApplicationPackageManager.java b/src/biz/bokhorst/xprivacy/XApplicationPackageManager.java index 9fe426d71..0b4cc227d 100644 --- a/src/biz/bokhorst/xprivacy/XApplicationPackageManager.java +++ b/src/biz/bokhorst/xprivacy/XApplicationPackageManager.java @@ -94,7 +94,7 @@ protected boolean isRestricted(MethodHookParam param) throws Throwable { private List filterApplicationInfo(List original) { ArrayList result = new ArrayList(); for (ApplicationInfo appInfo : original) - if (packageAllowed(appInfo.packageName)) + if (isPackageAllowed(appInfo.packageName)) result.add(appInfo); return result; } @@ -102,7 +102,7 @@ private List filterApplicationInfo(List origin private List filterPackageInfo(List original) { ArrayList result = new ArrayList(); for (PackageInfo appInfo : original) - if (packageAllowed(appInfo.packageName)) + if (isPackageAllowed(appInfo.packageName)) result.add(appInfo); return result; } @@ -110,7 +110,7 @@ private List filterPackageInfo(List original) { private List filterProviderInfo(List original) { ArrayList result = new ArrayList(); for (ProviderInfo appInfo : original) - if (packageAllowed(appInfo.packageName)) + if (isPackageAllowed(appInfo.packageName)) result.add(appInfo); return result; } @@ -118,12 +118,12 @@ private List filterProviderInfo(List original) { private List filterResolveInfo(List original) { ArrayList result = new ArrayList(); for (ResolveInfo appInfo : original) - if (packageAllowed(appInfo.resolvePackageName)) + if (isPackageAllowed(appInfo.resolvePackageName)) result.add(appInfo); return result; } - private boolean packageAllowed(String packageName) { + public static boolean isPackageAllowed(String packageName) { return PrivacyManager.getSettingBool(null, null, 0, String.format("Application.%s", packageName), false, true); } }