diff --git a/CHANGELOG.md b/CHANGELOG.md index f9f19c596..590bd2d35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Changelog * Fixed migration of template settings * Fixed migration of allowed accounts, applications and contacts +* Fixed permission updates ([issue](/../../issues/1557)) [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) diff --git a/src/biz/bokhorst/xprivacy/PackageChange.java b/src/biz/bokhorst/xprivacy/PackageChange.java index 3345ea83d..01715f80d 100644 --- a/src/biz/bokhorst/xprivacy/PackageChange.java +++ b/src/biz/bokhorst/xprivacy/PackageChange.java @@ -34,11 +34,14 @@ public void onReceive(final Context context, Intent intent) { // Default deny new user apps if (PrivacyService.getClient() != null && appInfo.getPackageName().size() == 1) { - if (!replacing) { + if (replacing) + PrivacyManager.clearPermissionCache(uid); + else { // Delete existing restrictions PrivacyManager.deleteRestrictions(uid, null, false); PrivacyManager.deleteSettings(uid); PrivacyManager.deleteUsage(uid); + PrivacyManager.clearPermissionCache(uid); boolean ondemand = PrivacyManager.getSettingBool(0, PrivacyManager.cSettingOnDemand, true, false); diff --git a/src/biz/bokhorst/xprivacy/PrivacyManager.java b/src/biz/bokhorst/xprivacy/PrivacyManager.java index 260971d35..1730f79b7 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyManager.java +++ b/src/biz/bokhorst/xprivacy/PrivacyManager.java @@ -1073,6 +1073,17 @@ public static boolean hasPermission(Context context, ApplicationInfoEx appInfo, } } + public static void clearPermissionCache(int uid) { + synchronized (mPermissionRestrictionCache) { + if (mPermissionRestrictionCache.get(uid) != null) + mPermissionRestrictionCache.remove(uid); + } + synchronized (mPermissionHookCache) { + if (mPermissionHookCache.get(uid) != null) + mPermissionHookCache.remove(uid); + } + } + @SuppressLint("DefaultLocale") private static boolean hasPermission(Context context, List listPackage, List listPermission) { try {