diff --git a/README.md b/README.md index 2c6a9b74b..0bad8539a 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/biz/bokhorst/xprivacy/PrivacyProvider.java b/src/biz/bokhorst/xprivacy/PrivacyProvider.java index 7cdfae13d..9377a1d34 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyProvider.java +++ b/src/biz/bokhorst/xprivacy/PrivacyProvider.java @@ -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); } diff --git a/src/biz/bokhorst/xprivacy/XPrivacy.java b/src/biz/bokhorst/xprivacy/XPrivacy.java index 1f9196583..31e70f16f 100644 --- a/src/biz/bokhorst/xprivacy/XPrivacy.java +++ b/src/biz/bokhorst/xprivacy/XPrivacy.java @@ -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());