From cefa3c18eb2da3224a8e2ff360b91579f1b33e2c Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 15 Nov 2013 10:54:32 +0100 Subject: [PATCH] Make allowed applications application specific Refs #686 --- src/biz/bokhorst/xprivacy/ActivityApp.java | 12 ++++++++---- .../xprivacy/XApplicationPackageManager.java | 3 ++- src/biz/bokhorst/xprivacy/XPrivacy.java | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/biz/bokhorst/xprivacy/ActivityApp.java b/src/biz/bokhorst/xprivacy/ActivityApp.java index ef6937020..8f8ef55ad 100644 --- a/src/biz/bokhorst/xprivacy/ActivityApp.java +++ b/src/biz/bokhorst/xprivacy/ActivityApp.java @@ -577,7 +577,8 @@ public int compare(ApplicationInfo info1, ApplicationInfo info2) { mListApp.add(String.format("%s (%s)", pm.getApplicationLabel(mListInfo.get(i)), mListInfo.get(i).packageName)); mSelection[i] = PrivacyManager.getSettingBool(null, ActivityApp.this, 0, - String.format("Application.%s", mListInfo.get(i).packageName), false, false); + String.format("Application.%d.%s", mListInfo.get(i).uid, mListInfo.get(i).packageName), + false, false); } catch (Throwable ex) { Util.bug(null, ex); } @@ -594,9 +595,12 @@ protected void onPostExecute(Object result) { new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int whichButton, boolean isChecked) { try { - PrivacyManager.setSetting(null, ActivityApp.this, 0, - String.format("Application.%s", mListInfo.get(whichButton).packageName), - Boolean.toString(isChecked)); + PrivacyManager.setSetting( + null, + ActivityApp.this, + 0, + String.format("Application.%d.%s", mListInfo.get(whichButton).uid, + mListInfo.get(whichButton).packageName), Boolean.toString(isChecked)); } catch (Throwable ex) { Util.bug(null, ex); Toast toast = Toast.makeText(ActivityApp.this, ex.toString(), Toast.LENGTH_LONG); diff --git a/src/biz/bokhorst/xprivacy/XApplicationPackageManager.java b/src/biz/bokhorst/xprivacy/XApplicationPackageManager.java index 0b4cc227d..3d6051caf 100644 --- a/src/biz/bokhorst/xprivacy/XApplicationPackageManager.java +++ b/src/biz/bokhorst/xprivacy/XApplicationPackageManager.java @@ -124,6 +124,7 @@ private List filterResolveInfo(List original) { } public static boolean isPackageAllowed(String packageName) { - return PrivacyManager.getSettingBool(null, null, 0, String.format("Application.%s", packageName), false, true); + return PrivacyManager.getSettingBool(null, null, 0, + String.format("Application.%d.%s", Binder.getCallingUid(), packageName), false, true); } } diff --git a/src/biz/bokhorst/xprivacy/XPrivacy.java b/src/biz/bokhorst/xprivacy/XPrivacy.java index 7b5b564b3..80f85017f 100644 --- a/src/biz/bokhorst/xprivacy/XPrivacy.java +++ b/src/biz/bokhorst/xprivacy/XPrivacy.java @@ -32,7 +32,7 @@ public class XPrivacy implements IXposedHookLoadPackage, IXposedHookZygoteInit { @SuppressLint("InlinedApi") public void initZygote(StartupParam startupParam) throws Throwable { // Log load - Util.log(null, Log.INFO, String.format("load %s", startupParam.modulePath)); + Util.log(null, Log.INFO, String.format("Load %s", startupParam.modulePath)); // Account manager hookAll(XAccountManager.getInstances());