Skip to content

Commit 92b4778

Browse files
author
xausky
committed
修复导入导出登录信息时的权限问题
1 parent 05859c9 commit 92b4778

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "cn.xausky.umm"
99
minSdkVersion 21
1010
targetSdkVersion 23
11-
versionCode 410
12-
versionName "4.1.0"
11+
versionCode 411
12+
versionName "4.1.1"
1313
ndk{
1414
abiFilters "armeabi-v7a","x86"
1515
}

app/src/main/java/io/github/xausky/unitymodmanager/utils/BackupUtil.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static byte[] backupKuroGame(Context context) {
1717
String accountsDatabaseFile = context.getDatabasePath("zz_sdk_db").getAbsolutePath();
1818
String deviceIdFile = context.getFilesDir().getAbsolutePath() + "/shared_prefs/devicesyn.xml";
1919
try {
20-
unprotectFilesWithRoot(accountsDatabaseFile, deviceIdFile);
20+
unprotectFilesWithRoot(accountsDatabaseFile + "*", deviceIdFile);
2121
JSONObject root = new JSONObject();
2222
StringBuilder builder = new StringBuilder();
2323
try (SQLiteDatabase db = SQLiteDatabase.openDatabase(accountsDatabaseFile, null, SQLiteDatabase.OPEN_READONLY);
@@ -42,15 +42,15 @@ public static byte[] backupKuroGame(Context context) {
4242
} catch (Exception e) {
4343
throw new RuntimeException(e);
4444
} finally {
45-
protectFilesWithRoot(accountsDatabaseFile, deviceIdFile);
45+
protectFilesWithRoot(accountsDatabaseFile + "*", deviceIdFile);
4646
}
4747
}
4848

4949
public static void restoreKuroGame(Context context, byte[] data) {
5050
String accountsDatabaseFile = context.getDatabasePath("zz_sdk_db").getAbsolutePath();
5151
String deviceIdFile = context.getFilesDir().getAbsolutePath() + "/shared_prefs/devicesyn.xml";
5252
try {
53-
unprotectFilesWithRoot(accountsDatabaseFile, deviceIdFile);
53+
unprotectFilesWithRoot(accountsDatabaseFile + "*", deviceIdFile);
5454
JSONObject root = new JSONObject(new String(data));
5555
String accounts = root.getString("accounts");
5656
try (SQLiteDatabase db = SQLiteDatabase.openDatabase(accountsDatabaseFile, null, SQLiteDatabase.OPEN_READWRITE)) {
@@ -63,7 +63,7 @@ public static void restoreKuroGame(Context context, byte[] data) {
6363
} catch (Exception e) {
6464
throw new RuntimeException(e);
6565
} finally {
66-
protectFilesWithRoot(accountsDatabaseFile, deviceIdFile);
66+
protectFilesWithRoot(accountsDatabaseFile + "*", deviceIdFile);
6767
}
6868
}
6969

@@ -86,6 +86,6 @@ private static void protectFilesWithRoot(String ...files){
8686
builder.append(" ");
8787
}
8888
}
89-
Shell.su("setenforce 1", "chmod 644 " + builder.toString()).exec();
89+
Shell.su("setenforce 1", "chmod 600 " + builder.toString()).exec();
9090
}
9191
}

0 commit comments

Comments
 (0)