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

Commit

Permalink
Fixed on demand restricting asking again
Browse files Browse the repository at this point in the history
Closes #1447
  • Loading branch information
M66B committed Feb 25, 2014
1 parent 3d1aa25 commit 4d18a52
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Changelog
* Import/export one application will not import/export global settings
* Option to enable/disable usage data parameters (**default disabled**)
* Removed phone properties restrictions (these are covered by function restrictions too)
* Fixed on demand restricting asking again ([issue](/../../issues/1447))
* Updated Dutch translation
* Updated Italian translation
* Updated Polish translation
Expand Down
4 changes: 2 additions & 2 deletions src/biz/bokhorst/xprivacy/CRestriction.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public int getUid() {
return mUid;
}

public boolean matches(PRestriction restriction) {
public boolean isSameMethod(PRestriction restriction) {
// @formatter:off
return (restriction.uid == mUid
&& restriction.restrictionName.equals(mRestrictionName)
&& (restriction.methodName == null ? true : restriction.methodName.equals(mMethodName)));
&& restriction.methodName.equals(mMethodName));
// @formatter:on
}

Expand Down
18 changes: 9 additions & 9 deletions src/biz/bokhorst/xprivacy/PrivacyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -411,16 +411,16 @@ private void setRestrictionInternal(PRestriction restriction) throws RemoteExcep
// Update cache
if (mUseCache)
synchronized (mRestrictionCache) {
// Clear cache
for (CRestriction key : new ArrayList<CRestriction>(mRestrictionCache.keySet()))
if (key.matches(restriction))
mRestrictionCache.remove(key);

if (restriction.methodName != null) {
// Update cache
CRestriction key = new CRestriction(restriction, restriction.extra);
mRestrictionCache.put(key, key);
if (restriction.methodName != null && restriction.extra == null) {
for (CRestriction key : new ArrayList<CRestriction>(mRestrictionCache.keySet()))
if (key.isSameMethod(restriction))
mRestrictionCache.remove(key);
}

CRestriction key = new CRestriction(restriction, restriction.extra);
if (mRestrictionCache.containsKey(key))
mRestrictionCache.remove(key);
mRestrictionCache.put(key, key);
}
} catch (Throwable ex) {
Util.bug(null, ex);
Expand Down

0 comments on commit 4d18a52

Please sign in to comment.