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

Commit

Permalink
Fixed erasing whitelists when changing restrictions
Browse files Browse the repository at this point in the history
Fixes #1499
  • Loading branch information
M66B committed Mar 4, 2014
1 parent 17dd844 commit d312826
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/biz/bokhorst/xprivacy/ActivityShare.java
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ protected Throwable doInBackground(String... params) {
List<Boolean> 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);
Expand Down
15 changes: 8 additions & 7 deletions src/biz/bokhorst/xprivacy/PrivacyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<PRestriction> listPRestriction = new ArrayList<PRestriction>();
for (String rRestrictionName : listRestriction)
listPRestriction.add(new PRestriction(uid, rRestrictionName, methodName, restricted, asked));
Expand Down Expand Up @@ -382,14 +382,15 @@ public static List<PRestriction> 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);
Expand Down
2 changes: 1 addition & 1 deletion src/biz/bokhorst/xprivacy/RState.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d312826

Please sign in to comment.