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
01344c45
Commit
01344c45
authored
Dec 24, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move more logic to core module
parent
2c42c794
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
23 deletions
+30
-23
FlashActivity.java
app/src/full/java/com/topjohnwu/magisk/FlashActivity.java
+2
-23
MagiskInstaller.java
...c/main/java/com/topjohnwu/core/tasks/MagiskInstaller.java
+28
-0
No files found.
app/src/full/java/com/topjohnwu/magisk/FlashActivity.java
View file @
01344c45
...
@@ -19,7 +19,6 @@ import com.topjohnwu.core.utils.Utils;
...
@@ -19,7 +19,6 @@ import com.topjohnwu.core.utils.Utils;
import
com.topjohnwu.magisk.components.BaseActivity
;
import
com.topjohnwu.magisk.components.BaseActivity
;
import
com.topjohnwu.superuser.CallbackList
;
import
com.topjohnwu.superuser.CallbackList
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.ShellUtils
;
import
java.io.File
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.FileWriter
;
...
@@ -211,13 +210,7 @@ public class FlashActivity extends BaseActivity {
...
@@ -211,13 +210,7 @@ public class FlashActivity extends BaseActivity {
@Override
@Override
protected
boolean
operations
()
{
protected
boolean
operations
()
{
console
.
add
(
"- Detecting target image"
);
return
findImage
()
&&
extractZip
()
&&
patchBoot
()
&&
flashBoot
();
srcBoot
=
ShellUtils
.
fastCmd
(
"find_boot_image"
,
"echo \"$BOOTIMAGE\""
);
if
(
srcBoot
.
isEmpty
())
{
console
.
add
(
"! Unable to detect target image"
);
return
false
;
}
return
extractZip
()
&&
patchBoot
()
&&
flashBoot
();
}
}
}
}
...
@@ -225,21 +218,7 @@ public class FlashActivity extends BaseActivity {
...
@@ -225,21 +218,7 @@ public class FlashActivity extends BaseActivity {
@Override
@Override
protected
boolean
operations
()
{
protected
boolean
operations
()
{
String
slot
=
ShellUtils
.
fastCmd
(
"echo $SLOT"
);
return
findSecondaryImage
()
&&
extractZip
()
&&
patchBoot
()
&&
flashBoot
()
&&
postOTA
();
String
target
=
(
TextUtils
.
equals
(
slot
,
"_a"
)
?
"_b"
:
"_a"
);
console
.
add
(
"- Target slot: "
+
target
);
console
.
add
(
"- Detecting target image"
);
srcBoot
=
ShellUtils
.
fastCmd
(
"SLOT="
+
target
,
"find_boot_image"
,
"SLOT="
+
slot
,
"echo \"$BOOTIMAGE\""
);
if
(
srcBoot
.
isEmpty
())
{
console
.
add
(
"! Unable to detect target image"
);
return
false
;
}
return
extractZip
()
&&
patchBoot
()
&&
flashBoot
()
&&
postOTA
();
}
}
}
}
...
...
core/src/main/java/com/topjohnwu/core/tasks/MagiskInstaller.java
View file @
01344c45
...
@@ -79,6 +79,34 @@ public abstract class MagiskInstaller {
...
@@ -79,6 +79,34 @@ public abstract class MagiskInstaller {
installDir
.
mkdirs
();
installDir
.
mkdirs
();
}
}
protected
boolean
findImage
()
{
console
.
add
(
"- Detecting target image"
);
srcBoot
=
ShellUtils
.
fastCmd
(
"find_boot_image"
,
"echo \"$BOOTIMAGE\""
);
if
(
srcBoot
.
isEmpty
())
{
console
.
add
(
"! Unable to detect target image"
);
return
false
;
}
return
true
;
}
protected
boolean
findSecondaryImage
()
{
String
slot
=
ShellUtils
.
fastCmd
(
"echo $SLOT"
);
String
target
=
(
TextUtils
.
equals
(
slot
,
"_a"
)
?
"_b"
:
"_a"
);
console
.
add
(
"- Target slot: "
+
target
);
console
.
add
(
"- Detecting target image"
);
srcBoot
=
ShellUtils
.
fastCmd
(
"SLOT="
+
target
,
"find_boot_image"
,
"SLOT="
+
slot
,
"echo \"$BOOTIMAGE\""
);
if
(
srcBoot
.
isEmpty
())
{
console
.
add
(
"! Unable to detect target image"
);
return
false
;
}
return
true
;
}
protected
boolean
extractZip
()
{
protected
boolean
extractZip
()
{
String
arch
;
String
arch
;
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
...
...
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