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
86481c74
Commit
86481c74
authored
Sep 08, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow user to select recovery mode
Close #1674
parent
5b937fb1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
HomeViewModel.kt
...c/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+4
-0
fragment_magisk.xml
app/src/main/res/layout/fragment_magisk.xml
+12
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-0
boot_patch.sh
scripts/boot_patch.sh
+5
-3
No files found.
app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
View file @
86481c74
...
...
@@ -41,6 +41,7 @@ class HomeViewModel(
val
isForceEncryption
=
KObservableField
(
Info
.
keepEnc
)
val
isKeepVerity
=
KObservableField
(
Info
.
keepVerity
)
val
isRecovery
=
KObservableField
(
Info
.
recovery
)
private
val
_magiskState
=
KObservableField
(
MagiskState
.
LOADING
)
val
magiskState
=
Observer
(
_magiskState
,
isConnected
)
{
...
...
@@ -112,6 +113,9 @@ class HomeViewModel(
isKeepVerity
.
addOnPropertyChangedCallback
{
Info
.
keepVerity
=
it
?:
return
@addOnPropertyChangedCallback
}
isRecovery
.
addOnPropertyChangedCallback
{
Info
.
recovery
=
it
?:
return
@addOnPropertyChangedCallback
}
isConnected
.
addOnPropertyChangedCallback
{
if
(
it
==
true
)
refresh
()
}
...
...
app/src/main/res/layout/fragment_magisk.xml
View file @
86481c74
...
...
@@ -185,6 +185,18 @@
app:layout_constraintWidth_default=
"wrap"
app:layout_constraintWidth_min=
"300dp"
/>
<CheckBox
android:id=
"@+id/recovery_mode"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:checked=
"@={viewModel.isRecovery}"
android:text=
"@string/recovery_mode"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/keep_verity"
app:layout_constraintWidth_default=
"wrap"
app:layout_constraintWidth_min=
"300dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
...
...
app/src/main/res/values/strings.xml
View file @
86481c74
...
...
@@ -24,6 +24,7 @@
<string
name=
"advanced_settings_title"
>
Advanced Settings
</string>
<string
name=
"keep_force_encryption"
>
Preserve force encryption
</string>
<string
name=
"keep_dm_verity"
>
Preserve AVB 2.0/dm-verity
</string>
<string
name=
"recovery_mode"
>
Recovery Mode
</string>
<string
name=
"current_installed"
>
Installed: %1$s
</string>
<string
name=
"latest_version"
>
Latest: %1$s
</string>
<string
name=
"uninstall"
>
Uninstall
</string>
...
...
scripts/boot_patch.sh
View file @
86481c74
...
...
@@ -7,7 +7,7 @@
# Usage: boot_patch.sh <bootimage>
#
# The following flags can be set in environment variables:
# KEEPVERITY, KEEPFORCEENCRYPT
# KEEPVERITY, KEEPFORCEENCRYPT
, RECOVERYMODE
#
# This script should be placed in a directory with the following files:
#
...
...
@@ -84,6 +84,8 @@ case $? in
;;
esac
[
-f
recovery_dtbo
]
&&
RECOVERYMODE
=
true
##########################################################################################
# Ramdisk restores
##########################################################################################
...
...
@@ -101,7 +103,7 @@ case $((STATUS & 3)) in
0
)
# Stock boot
ui_print
"- Stock boot image detected"
ui_print
"- Backing up stock boot image"
SHA1
=
`
./magiskboot
--
sha1
"
$BOOTIMAGE
"
2>/dev/null
`
SHA1
=
`
./magiskboot sha1
"
$BOOTIMAGE
"
2>/dev/null
`
STOCKDUMP
=
stock_boot_
${
SHA1
}
.img.gz
./magiskboot compress
"
$BOOTIMAGE
"
$STOCKDUMP
cp
-af
ramdisk.cpio ramdisk.cpio.orig 2>/dev/null
...
...
@@ -133,8 +135,8 @@ ui_print "- Patching ramdisk"
echo
"KEEPVERITY=
$KEEPVERITY
"
>
config
echo
"KEEPFORCEENCRYPT=
$KEEPFORCEENCRYPT
"
>>
config
echo
"RECOVERYMODE=
$RECOVERYMODE
"
>>
config
[
!
-z
$SHA1
]
&&
echo
"SHA1=
$SHA1
"
>>
config
[
-f
recovery_dtbo
]
&&
echo
"RECOVERYMODE=true"
>>
config
./magiskboot cpio ramdisk.cpio
\
"add 750 init magiskinit"
\
...
...
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