From 1b993e51aca3fb0abba7cb6da6df78b8dd667219 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 24 Feb 2014 06:06:17 +0100 Subject: [PATCH] Move database to /data/system/xprivacy Refs #1437 --- CHANGELOG.md | 4 ++-- src/biz/bokhorst/xprivacy/PrivacyService.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07aeb0514..c81f40084 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,8 @@ Changelog * Toggle restriction will allow to choose between, clear, restrict and template ([issue](/../../issues/1319)) * Option to select if existing restrictions should be deleted on fetch ([issue](/../../issues/1119)) -* Move database to /data/system ([issue](/../../issues/1437)) -* Submit restricted functions with a whitelist as an exception ([issue](/../../issues/1438)) +* Move database to /data/system/xprivacy ([issue](/../../issues/1437)) +* Submit restricted functions with a whitelist as having an exception ([issue](/../../issues/1438)) * Updated Dutch translation * Updated Italian translation diff --git a/src/biz/bokhorst/xprivacy/PrivacyService.java b/src/biz/bokhorst/xprivacy/PrivacyService.java index 7f0f46a50..f3793959f 100644 --- a/src/biz/bokhorst/xprivacy/PrivacyService.java +++ b/src/biz/bokhorst/xprivacy/PrivacyService.java @@ -79,6 +79,9 @@ public static void setupDatabase() { try { File dbFile = getDbFile(); + // Create database folder + dbFile.getParentFile().mkdirs(); + // Check database folder if (dbFile.getParentFile().isDirectory()) Util.log(null, Log.WARN, "Database folder=" + dbFile.getParentFile()); @@ -112,6 +115,7 @@ public static void setupDatabase() { // Owner: rwx (system) // Group: rwx (system) // World: --- + Util.setPermissions(dbFile.getParentFile().getAbsolutePath(), 0770, Process.SYSTEM_UID, Process.SYSTEM_UID); File[] files = dbFile.getParentFile().listFiles(); if (files != null) for (File file : files) @@ -220,11 +224,13 @@ public static IPrivacyService getClient() { } private static File getDbFile() { - return new File(Environment.getDataDirectory() + File.separator + "system" + File.separator + "xprivacy.db"); + return new File(Environment.getDataDirectory() + File.separator + "system" + File.separator + "xprivacy" + + File.separator + "xprivacy.db"); } private static File getDbUsageFile() { - return new File(Environment.getDataDirectory() + File.separator + "system" + File.separator + "usage.db"); + return new File(Environment.getDataDirectory() + File.separator + "system" + File.separator + "xprivacy" + + File.separator + "usage.db"); } public static void reportErrorInternal(String message) {