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

Commit

Permalink
Fixed permission updates
Browse files Browse the repository at this point in the history
Fixes #1554
Closes #1557
  • Loading branch information
M66B committed Mar 14, 2014
1 parent 8a2c397 commit dce53e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion src/biz/bokhorst/xprivacy/PackageChange.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions src/biz/bokhorst/xprivacy/PrivacyManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> listPackage, List<String> listPermission) {
try {
Expand Down

0 comments on commit dce53e5

Please sign in to comment.