diff --git a/CHANGELOG.md b/CHANGELOG.md index d723a6448..acf5c8cc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Version 2.99.x and version 3.x will be available with a [pro license](http://www **Next release** * Added help items to template ([issue](/../../issues/1827)) +* Added restrictions *Srv_getPackageInfo* and *Srv_getApplicationInfo* ([issue](/../../issues/1834)) [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/res/values/functions.xml b/res/values/functions.xml index a8ca12351..36785d084 100644 --- a/res/values/functions.xml +++ b/res/values/functions.xml @@ -346,6 +346,8 @@ Google documentation]]> Google documentation]]> Google documentation]]> + Google documentation]]> + Google documentation]]> Google documentation]]> Google documentation]]> Google documentation]]> diff --git a/src/biz/bokhorst/xprivacy/Meta.java b/src/biz/bokhorst/xprivacy/Meta.java index ef78dc77d..e823f6b09 100644 --- a/src/biz/bokhorst/xprivacy/Meta.java +++ b/src/biz/bokhorst/xprivacy/Meta.java @@ -416,6 +416,8 @@ public static List get() { mListHook.add(new Hook("system", "queryIntentContentProviders", "", 19, "1.99.1", null).notAOSP(19).dangerous()); mListHook.add(new Hook("system", "queryIntentServices", "", 1, null, null).notAOSP(19).dangerous()); + mListHook.add(new Hook("system", "Srv_getPackageInfo", "", 19, "2.99.30", null).AOSP(19).dangerous()); + mListHook.add(new Hook("system", "Srv_getApplicationInfo", "", 19, "2.99.30", null).AOSP(19).dangerous()); mListHook.add(new Hook("system", "Srv_getInstalledApplications", "", 19, "2.99", "getInstalledApplications").AOSP(19).dangerous()); mListHook.add(new Hook("system", "Srv_getInstalledPackages", "", 19, "2.99", "getInstalledPackages").AOSP(19).dangerous()); mListHook.add(new Hook("system", "Srv_getPackagesForUid", "", 19, "2.99", "getPackagesForUid").AOSP(19).dangerous()); diff --git a/src/biz/bokhorst/xprivacy/XPackageManager.java b/src/biz/bokhorst/xprivacy/XPackageManager.java index 80bfc1c30..9b731be44 100644 --- a/src/biz/bokhorst/xprivacy/XPackageManager.java +++ b/src/biz/bokhorst/xprivacy/XPackageManager.java @@ -67,6 +67,10 @@ public String getClassName() { // public android.content.pm.ParceledListSlice getInstalledPackages(int flags, int userId) // public android.content.pm.ParceledListSlice getPackagesHoldingPermissions(java.lang.String[] permissions, int flags, int userId) // public android.content.pm.ParceledListSlice getInstalledApplications(int flags, int userId) + + // public PackageInfo getPackageInfo(String packageName, int flags, int userId) + // public ApplicationInfo getApplicationInfo(String packageName, int flags, int userId) + // http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.4.2_r1/com/android/server/pm/PackageManagerService.java // @formatter:on @@ -83,6 +87,7 @@ private enum Methods { checkPermission, checkUidPermission, + Srv_getPackageInfo, Srv_getApplicationInfo, Srv_getInstalledApplications, Srv_getInstalledPackages, Srv_getPackagesForUid, Srv_getPackagesHoldingPermissions, @@ -102,6 +107,8 @@ public static List getInstances(String className) { if (className == null) className = cClassName; + listHook.add(new XPackageManager(Methods.Srv_getPackageInfo, PrivacyManager.cSystem)); + listHook.add(new XPackageManager(Methods.Srv_getApplicationInfo, PrivacyManager.cSystem)); listHook.add(new XPackageManager(Methods.Srv_getInstalledApplications, PrivacyManager.cSystem)); listHook.add(new XPackageManager(Methods.Srv_getInstalledPackages, PrivacyManager.cSystem)); listHook.add(new XPackageManager(Methods.Srv_getPackagesForUid, PrivacyManager.cSystem)); @@ -149,6 +156,18 @@ protected void before(XParam param) throws Throwable { @SuppressWarnings("unchecked") protected void after(XParam param) throws Throwable { switch (mMethod) { + case Srv_getPackageInfo: + case Srv_getApplicationInfo: + if (param.args.length > 0 && param.args[0] instanceof String && param.getResult() != null) { + String packageName = (String) param.args[0]; + // Prevent recursion + if (!XPackageManager.class.getPackage().getName().equals(packageName)) + if (isRestricted(param)) + if (!isPackageAllowed(packageName)) + param.setResult(null); + } + break; + case Srv_getInstalledApplications: if (param.getResult() != null) if (isRestricted(param)) {