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
2760f37e
Commit
2760f37e
authored
Oct 14, 2020
by
vvb2060
Committed by
John Wu
Oct 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add userspace reboot
parent
3fa34260
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
RebootEvent.kt
app/src/main/java/com/topjohnwu/magisk/events/RebootEvent.kt
+7
-0
menu_reboot.xml
app/src/main/res/menu/menu_reboot.xml
+9
-4
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/events/RebootEvent.kt
View file @
2760f37e
package
com.topjohnwu.magisk.events
package
com.topjohnwu.magisk.events
import
android.os.Build
import
android.os.PowerManager
import
android.view.ContextThemeWrapper
import
android.view.ContextThemeWrapper
import
android.view.MenuItem
import
android.view.MenuItem
import
android.widget.PopupMenu
import
android.widget.PopupMenu
import
androidx.core.content.getSystemService
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.base.BaseActivity
import
com.topjohnwu.magisk.core.base.BaseActivity
import
com.topjohnwu.superuser.Shell
import
com.topjohnwu.superuser.Shell
...
@@ -13,6 +16,7 @@ object RebootEvent {
...
@@ -13,6 +16,7 @@ object RebootEvent {
private
fun
reboot
(
item
:
MenuItem
):
Boolean
{
private
fun
reboot
(
item
:
MenuItem
):
Boolean
{
when
(
item
.
itemId
)
{
when
(
item
.
itemId
)
{
R
.
id
.
action_reboot_normal
->
systemReboot
()
R
.
id
.
action_reboot_normal
->
systemReboot
()
R
.
id
.
action_reboot_userspace
->
systemReboot
(
"userspace"
)
R
.
id
.
action_reboot_bootloader
->
systemReboot
(
"bootloader"
)
R
.
id
.
action_reboot_bootloader
->
systemReboot
(
"bootloader"
)
R
.
id
.
action_reboot_download
->
systemReboot
(
"download"
)
R
.
id
.
action_reboot_download
->
systemReboot
(
"download"
)
R
.
id
.
action_reboot_edl
->
systemReboot
(
"edl"
)
R
.
id
.
action_reboot_edl
->
systemReboot
(
"edl"
)
...
@@ -25,6 +29,9 @@ object RebootEvent {
...
@@ -25,6 +29,9 @@ object RebootEvent {
fun
inflateMenu
(
activity
:
BaseActivity
):
PopupMenu
{
fun
inflateMenu
(
activity
:
BaseActivity
):
PopupMenu
{
val
themeWrapper
=
ContextThemeWrapper
(
activity
,
R
.
style
.
Foundation_PopupMenu
)
val
themeWrapper
=
ContextThemeWrapper
(
activity
,
R
.
style
.
Foundation_PopupMenu
)
val
menu
=
PopupMenu
(
themeWrapper
,
activity
.
findViewById
(
R
.
id
.
action_reboot
))
val
menu
=
PopupMenu
(
themeWrapper
,
activity
.
findViewById
(
R
.
id
.
action_reboot
))
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
R
&&
activity
.
getSystemService
<
PowerManager
>()
?.
isRebootingUserspaceSupported
==
true
)
menu
.
menu
.
getItem
(
R
.
id
.
action_reboot_userspace
).
isVisible
=
true
activity
.
menuInflater
.
inflate
(
R
.
menu
.
menu_reboot
,
menu
.
menu
)
activity
.
menuInflater
.
inflate
(
R
.
menu
.
menu_reboot
,
menu
.
menu
)
menu
.
setOnMenuItemClickListener
(
::
reboot
)
menu
.
setOnMenuItemClickListener
(
::
reboot
)
return
menu
return
menu
...
...
app/src/main/res/menu/menu_reboot.xml
View file @
2760f37e
...
@@ -5,6 +5,15 @@
...
@@ -5,6 +5,15 @@
android:id=
"@+id/action_reboot_normal"
android:id=
"@+id/action_reboot_normal"
android:title=
"@string/reboot"
/>
android:title=
"@string/reboot"
/>
<item
android:id=
"@+id/action_reboot_userspace"
android:title=
"@string/reboot_userspace"
android:visible=
"false"
/>
<item
android:id=
"@+id/action_reboot_recovery"
android:title=
"@string/reboot_recovery"
/>
<item
<item
android:id=
"@+id/action_reboot_bootloader"
android:id=
"@+id/action_reboot_bootloader"
android:title=
"@string/reboot_bootloader"
/>
android:title=
"@string/reboot_bootloader"
/>
...
@@ -17,8 +26,4 @@
...
@@ -17,8 +26,4 @@
android:id=
"@+id/action_reboot_edl"
android:id=
"@+id/action_reboot_edl"
android:title=
"@string/reboot_edl"
/>
android:title=
"@string/reboot_edl"
/>
<item
android:id=
"@+id/action_reboot_recovery"
android:title=
"@string/reboot_recovery"
/>
</menu>
</menu>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
2760f37e
...
@@ -109,6 +109,7 @@
...
@@ -109,6 +109,7 @@
<!--Module -->
<!--Module -->
<string
name=
"no_info_provided"
>
(No info provided)
</string>
<string
name=
"no_info_provided"
>
(No info provided)
</string>
<string
name=
"reboot_userspace"
>
Soft reboot
</string>
<string
name=
"reboot_recovery"
>
Reboot to Recovery
</string>
<string
name=
"reboot_recovery"
>
Reboot to Recovery
</string>
<string
name=
"reboot_bootloader"
>
Reboot to Bootloader
</string>
<string
name=
"reboot_bootloader"
>
Reboot to Bootloader
</string>
<string
name=
"reboot_download"
>
Reboot to Download
</string>
<string
name=
"reboot_download"
>
Reboot to Download
</string>
...
...
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