Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
c231e88a
Commit
c231e88a
authored
Jun 11, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small tweak in setting up magisk DB
parent
79c71509
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
12 deletions
+4
-12
MagiskDatabaseHelper.java
...a/com/topjohnwu/magisk/database/MagiskDatabaseHelper.java
+2
-9
utils.sh
src/full/res/raw/utils.sh
+2
-2
Const.java
src/main/java/com/topjohnwu/magisk/utils/Const.java
+0
-1
No files found.
src/full/java/com/topjohnwu/magisk/database/MagiskDatabaseHelper.java
View file @
c231e88a
...
...
@@ -78,7 +78,7 @@ public class MagiskDatabaseHelper {
if
(
mm
.
magiskVersionCode
<
Const
.
MAGISK_VER
.
FBE_AWARE
)
{
// Super old legacy mode
return
mm
.
openOrCreateDatabase
(
"su.db"
,
Context
.
MODE_PRIVATE
,
null
);
}
else
if
(
mm
.
magiskVersionCode
<
Const
.
MAGISK_VER
.
LEGACY_GLOBAL_DB
)
{
}
else
if
(
mm
.
magiskVersionCode
<
Const
.
MAGISK_VER
.
HIDDEN_PATH
)
{
// Legacy mode with FBE aware
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
de
.
moveDatabaseFrom
(
mm
,
"su.db"
);
...
...
@@ -89,13 +89,6 @@ public class MagiskDatabaseHelper {
final
SuFile
GLOBAL_DB
=
new
SuFile
(
"/data/adb/magisk.db"
,
true
);
mm
.
deleteDatabase
(
"su.db"
);
de
.
deleteDatabase
(
"su.db"
);
if
(
mm
.
magiskVersionCode
<
Const
.
MAGISK_VER
.
HIDDEN_PATH
)
{
// Link to new path
File
oldDB
=
new
File
(
de
.
getFilesDir
().
getParentFile
().
getParentFile
(),
"magisk.db"
);
Shell
.
Sync
.
su
(
Utils
.
fmt
(
"mv -f %s %s; ln -s %s %s"
,
oldDB
,
GLOBAL_DB
,
GLOBAL_DB
,
oldDB
));
}
if
(
mm
.
magiskVersionCode
<
Const
.
MAGISK_VER
.
SEPOL_REFACTOR
)
{
// We need some additional policies on old versions
Shell
.
Sync
.
su
(
"db_sepatch"
);
...
...
@@ -105,8 +98,8 @@ public class MagiskDatabaseHelper {
SQLiteDatabase
.
openOrCreateDatabase
(
GLOBAL_DB
,
null
).
close
();
Shell
.
Sync
.
su
(
"db_restore"
);
}
Shell
.
Sync
.
su
(
"db_setup "
+
Process
.
myUid
());
}
Shell
.
Sync
.
su
(
"db_setup "
+
Process
.
myUid
());
}
// Not using legacy mode, open the mounted global DB
return
SQLiteDatabase
.
openOrCreateDatabase
(
DB_FILE
,
null
);
...
...
src/full/res/raw/utils.sh
View file @
c231e88a
...
...
@@ -13,14 +13,14 @@ db_clean() {
}
db_init
()
{
ADB_CONTEXT
=
`
/system/bin/ls
-dZ
/data/adb |
awk
'{print $1}'
`
# Temporary let the folder rw by anyone
chcon
u:object_r:magisk_file:s0 /data/adb
chmod
777 /data/adb
}
db_restore
()
{
chcon
$ADB_CONTEXT
/data/adb
chmod
700 /data/adb
magisk
--restorecon
}
db_setup
()
{
...
...
src/main/java/com/topjohnwu/magisk/utils/Const.java
View file @
c231e88a
...
...
@@ -57,7 +57,6 @@ public class Const {
public
static
final
int
RESETPROP_PERSIST
=
1436
;
public
static
final
int
MANAGER_HIDE
=
1440
;
public
static
final
int
DTBO_SUPPORT
=
1446
;
public
static
final
int
LEGACY_GLOBAL_DB
=
1450
;
public
static
final
int
HIDDEN_PATH
=
1460
;
public
static
final
int
REMOVE_LEGACY_LINK
=
1630
;
public
static
final
int
SEPOL_REFACTOR
=
1640
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment