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

Commit

Permalink
Allow applications in package events
Browse files Browse the repository at this point in the history
Refs #686
  • Loading branch information
M66B committed Nov 15, 2013
1 parent 770f70a commit f609919
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
14 changes: 14 additions & 0 deletions src/biz/bokhorst/xprivacy/XActivityThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions src/biz/bokhorst/xprivacy/XApplicationPackageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,36 +94,36 @@ protected boolean isRestricted(MethodHookParam param) throws Throwable {
private List<ApplicationInfo> filterApplicationInfo(List<ApplicationInfo> original) {
ArrayList<ApplicationInfo> result = new ArrayList<ApplicationInfo>();
for (ApplicationInfo appInfo : original)
if (packageAllowed(appInfo.packageName))
if (isPackageAllowed(appInfo.packageName))
result.add(appInfo);
return result;
}

private List<PackageInfo> filterPackageInfo(List<PackageInfo> original) {
ArrayList<PackageInfo> result = new ArrayList<PackageInfo>();
for (PackageInfo appInfo : original)
if (packageAllowed(appInfo.packageName))
if (isPackageAllowed(appInfo.packageName))
result.add(appInfo);
return result;
}

private List<ProviderInfo> filterProviderInfo(List<ProviderInfo> original) {
ArrayList<ProviderInfo> result = new ArrayList<ProviderInfo>();
for (ProviderInfo appInfo : original)
if (packageAllowed(appInfo.packageName))
if (isPackageAllowed(appInfo.packageName))
result.add(appInfo);
return result;
}

private List<ResolveInfo> filterResolveInfo(List<ResolveInfo> original) {
ArrayList<ResolveInfo> result = new ArrayList<ResolveInfo>();
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);
}
}

0 comments on commit f609919

Please sign in to comment.