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

Commit

Permalink
Auto fix file permissions
Browse files Browse the repository at this point in the history
Fixes #627
  • Loading branch information
Marcel Bokhorst committed Sep 7, 2013
1 parent 11e47fa commit 7db17fe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ How to get beta releases:

**Next release**

* Auto fix file permissions ([issue](https://github.com/M66B/XPrivacy/issues/627))
* Added Estonian translation
* Updated German translation
* Updated Slovenian translation
Expand Down
11 changes: 11 additions & 0 deletions src/biz/bokhorst/xprivacy/PrivacyProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,17 @@ private static void setPrefFileReadable(String preference, int uid) {
new File(getPrefFileName(preference, uid)).setReadable(true, false);
}

public static void fixFilePermissions() {
String packageName = PrivacyManager.class.getPackage().getName();
File list[] = new File(Environment.getDataDirectory() + File.separator + "data" + File.separator + packageName
+ File.separator + "shared_prefs").listFiles();
if (list != null)
for (File file : list)
if (file.getName().startsWith("biz.bokhorst.xprivacy.provider.") && file.getName().endsWith(".xml")
&& !file.getName().contains(".usage."))
file.setReadable(true, false);
}

private static String getRestrictionPref(String restrictionName) {
return String.format("%s.%s", COL_RESTRICTED, restrictionName);
}
Expand Down
2 changes: 2 additions & 0 deletions src/biz/bokhorst/xprivacy/XPrivacy.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public void initZygote(StartupParam startupParam) throws Throwable {
// Log load
Util.log(null, Log.INFO, String.format("load %s", startupParam.modulePath));

PrivacyProvider.fixFilePermissions();

// Account manager
hookAll(XAccountManager.getInstances());

Expand Down

0 comments on commit 7db17fe

Please sign in to comment.