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
52e1b84d
Commit
52e1b84d
authored
Jan 30, 2021
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Symlink pre API 21
parent
8794141b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
XAndroid.kt
app/src/main/java/com/topjohnwu/magisk/ktx/XAndroid.kt
+9
-7
No files found.
app/src/main/java/com/topjohnwu/magisk/ktx/XAndroid.kt
View file @
52e1b84d
...
...
@@ -56,22 +56,24 @@ import kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
import
java.io.File
import
java.lang.reflect.Method
import
java.lang.reflect.Array
as
JArray
val
packageName
:
String
get
()
=
get
<
Context
>().
packageName
private
lateinit
var
osSymlink
:
Method
private
lateinit
var
os
:
Any
fun
symlink
(
oldPath
:
String
,
newPath
:
String
)
{
if
(
SDK_INT
>=
21
)
{
Os
.
symlink
(
oldPath
,
newPath
)
}
else
{
// Just copy the files pre 5.0
val
old
=
File
(
oldPath
)
val
newFile
=
File
(
newPath
)
old
.
copyTo
(
newFile
)
if
(
old
.
canExecute
())
newFile
.
setExecutable
(
true
)
if
(!
::
osSymlink
.
isInitialized
)
{
os
=
Class
.
forName
(
"libcore.io.Libcore"
).
getField
(
"os"
).
get
(
null
)
!!
osSymlink
=
os
.
javaClass
.
getMethod
(
"symlink"
,
String
::
class
.
java
,
String
::
class
.
java
)
}
osSymlink
.
invoke
(
os
,
oldPath
,
newPath
)
}
}
val
ServiceInfo
.
isIsolated
get
()
=
(
flags
and
FLAG_ISOLATED_PROCESS
)
!=
0
...
...
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