diff --git a/CHANGELOG.md b/CHANGELOG.md index 473169ba5..068fd1339 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ Changelog **Next release** +* Fixed erasing whitelists when changing restrictions ([issue](/../../issues/1499)) +* Fixed updating application state when new application with shared user ID is installed ([issue](/../../issues/1498)) + [Open issues](https://github.com/M66B/XPrivacy/issues?state=open) **Version 1.99.67 TEST** @@ -31,7 +34,7 @@ Changelog **Version 1.99.65 TEST** -* Fixed on demand restricting filtering negate ([issue](/../../issues/1495)) +* Fixed on demand restricting filtering negate ([issue](/../../issues/1495)) * Run all restriction changes in the background * To prevent application not responding messages * There can be a delay before a restriction change is visible diff --git a/src/biz/bokhorst/xprivacy/ActivityShare.java b/src/biz/bokhorst/xprivacy/ActivityShare.java index 29a176289..3e91f5b5a 100644 --- a/src/biz/bokhorst/xprivacy/ActivityShare.java +++ b/src/biz/bokhorst/xprivacy/ActivityShare.java @@ -635,7 +635,7 @@ protected Throwable doInBackground(String... params) { List oldState = PrivacyManager.getRestartStates(uid, restrictionName); if (actionId == R.id.rbClear) - PrivacyManager.deleteRestrictions(uid, restrictionName, true); + PrivacyManager.deleteRestrictions(uid, restrictionName, (restrictionName == null)); else if (actionId == R.id.rbRestrict) PrivacyManager.setRestriction(uid, restrictionName, null, true, false); diff --git a/src/biz/bokhorst/xprivacy/PrivacyManager.java b/src/biz/bokhorst/xprivacy/PrivacyManager.java index 8da1b0f48..260971d35 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyManager.java +++ b/src/biz/bokhorst/xprivacy/PrivacyManager.java @@ -333,7 +333,7 @@ public static void setRestriction(int uid, String restrictionName, String method else listRestriction.add(restrictionName); - // Create list of restrictions set set + // Create list of restrictions to set List listPRestriction = new ArrayList(); for (String rRestrictionName : listRestriction) listPRestriction.add(new PRestriction(uid, rRestrictionName, methodName, restricted, asked)); @@ -382,14 +382,15 @@ public static List getRestrictionList(int uid, String restrictionN public static void deleteRestrictions(int uid, String restrictionName, boolean deleteWhitelists) { checkCaller(); - // Delete restrictions try { + // Delete restrictions PrivacyService.getClient().deleteRestrictions(uid, restrictionName == null ? "" : restrictionName); - if (deleteWhitelists) { - if (uid > 0) - for (PSetting setting : getSettingList(uid)) - if (Meta.isWhitelist(setting.type)) - setSetting(uid, setting.type, setting.name, null); + + // Clear associated whitelists + if (deleteWhitelists && uid > 0) { + for (PSetting setting : getSettingList(uid)) + if (Meta.isWhitelist(setting.type)) + setSetting(uid, setting.type, setting.name, null); } } catch (Throwable ex) { Util.bug(null, ex); diff --git a/src/biz/bokhorst/xprivacy/RState.java b/src/biz/bokhorst/xprivacy/RState.java index ade3849c0..490a56aaa 100644 --- a/src/biz/bokhorst/xprivacy/RState.java +++ b/src/biz/bokhorst/xprivacy/RState.java @@ -72,7 +72,7 @@ public void toggleRestriction() { // Change restriction if (restricted) - PrivacyManager.deleteRestrictions(mUid, mRestrictionName, true); + PrivacyManager.deleteRestrictions(mUid, mRestrictionName, (mRestrictionName == null)); else for (String restrictionName : listRestriction) PrivacyManager.setRestriction(mUid, restrictionName, null, true, false);