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

Commit

Permalink
Revert "Moved database back due to permission problems"
Browse files Browse the repository at this point in the history
This reverts commit 97b9f2a.

Conflicts:
	CHANGELOG.md

Refs #1160
  • Loading branch information
M66B committed Jan 26, 2014
1 parent 8ca4090 commit e91f71c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Test and beta releases will have experimental functions enabled by default.
**Next release**

* Updated German translation
* Moved database back again due to permission problems ([issue](https://github.com/M66B/XPrivacy/issues/1160))

[Open issues](https://github.com/M66B/XPrivacy/issues?state=open)

Expand Down
35 changes: 17 additions & 18 deletions src/biz/bokhorst/xprivacy/PrivacyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -761,33 +761,32 @@ private static int getXUid() {
}

private static File getDbFile() {
return new File(Environment.getDataDirectory() + File.separator + "xprivacy" + File.separator + "xprivacy.db");
return new File(Environment.getDataDirectory() + File.separator + "data" + File.separator
+ PrivacyService.class.getPackage().getName() + File.separator + "xprivacy.db");
}

public static void setupDatebase() {
// This is run from Zygote with root permissions
try {
// Create base folder
getDbFile().getParentFile().mkdirs();

// Move existing database
File source = new File(Environment.getDataDirectory() + File.separator + "data" + File.separator
+ PrivacyService.class.getPackage().getName() + File.separator + "xprivacy.db");
File target = new File(getDbFile().getParentFile() + File.separator + "xprivacy.db");
source.renameTo(target);
source = new File(source + "-journal");
target = new File(target + "-journal");
source.renameTo(target);

// Create database, if needed
getDatabase();

// Set database folder permission
// Move database from experimental location
File folder = new File(Environment.getDataDirectory() + File.separator + "xprivacy");
if (folder.exists()) {
File[] files = folder.listFiles();
if (files != null)
for (File file : files) {
File target = new File(getDbFile().getParentFile() + File.separator + file.getName());
Util.log(null, Log.WARN, "Moving " + file + " to " + target);
file.renameTo(target);
}
folder.delete();
}

// Set application folder permission
// Owner: rwx (untouched)
// Group: rwx (set to system)
// World: ---
File dbFile = getDbFile();
Util.setPermission(dbFile.getParentFile().getAbsolutePath(), 0770, -1, PrivacyManager.cAndroidUid);
Util.setPermission(dbFile.getParentFile().getAbsolutePath(), 0771, -1, PrivacyManager.cAndroidUid);

// Set database file permissions
// Owner: rwx (untouched)
Expand Down

0 comments on commit e91f71c

Please sign in to comment.