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
803982a2
Commit
803982a2
authored
Feb 24, 2021
by
topjohnwu
Committed by
John Wu
Feb 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent multiple installation sessions running in parallel
parent
9164bf22
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
MagiskInstaller.kt
...n/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
+14
-1
FlashFragment.kt
.../main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt
+1
-0
FlashViewModel.kt
...main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt
+2
-6
No files found.
app/src/main/java/com/topjohnwu/magisk/core/tasks/MagiskInstaller.kt
View file @
803982a2
...
...
@@ -43,6 +43,8 @@ import java.security.SecureRandom
import
java.util.*
import
java.util.zip.ZipFile
private
var
haveActiveSession
:
Boolean
=
false
abstract
class
MagiskInstallImpl
protected
constructor
(
protected
val
console
:
MutableList
<
String
>
=
NOPList
.
getInstance
(),
private
val
logs
:
MutableList
<
String
>
=
NOPList
.
getInstance
()
...
...
@@ -415,7 +417,18 @@ abstract class MagiskInstallImpl protected constructor(
@WorkerThread
protected
abstract
suspend
fun
operations
():
Boolean
open
suspend
fun
exec
()
=
withContext
(
Dispatchers
.
IO
)
{
operations
()
}
open
suspend
fun
exec
():
Boolean
{
synchronized
(
haveActiveSession
)
{
if
(
haveActiveSession
)
return
false
haveActiveSession
=
true
}
val
result
=
withContext
(
Dispatchers
.
IO
)
{
operations
()
}
synchronized
(
haveActiveSession
)
{
haveActiveSession
=
false
}
return
result
}
}
abstract
class
MagiskInstaller
(
...
...
app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt
View file @
803982a2
...
...
@@ -50,6 +50,7 @@ class FlashFragment : BaseUIFragment<FlashViewModel, FragmentFlashMd2Binding>()
defaultOrientation
=
activity
.
requestedOrientation
activity
.
requestedOrientation
=
ActivityInfo
.
SCREEN_ORIENTATION_NOSENSOR
viewModel
.
startFlashing
()
}
@SuppressLint
(
"WrongConstant"
)
...
...
app/src/main/java/com/topjohnwu/magisk/ui/flash/FlashViewModel.kt
View file @
803982a2
package
com.topjohnwu.magisk.ui.flash
import
android.net.Uri
import
android.view.MenuItem
import
androidx.databinding.Bindable
import
androidx.lifecycle.LiveData
...
...
@@ -27,7 +26,7 @@ import com.topjohnwu.superuser.Shell
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
class
FlashViewModel
(
args
:
FlashFragmentArgs
)
:
BaseViewModel
()
{
class
FlashViewModel
(
private
val
args
:
FlashFragmentArgs
)
:
BaseViewModel
()
{
@get
:
Bindable
var
showReboot
=
Shell
.
rootAccess
()
...
...
@@ -49,14 +48,11 @@ class FlashViewModel(args: FlashFragmentArgs) : BaseViewModel() {
}
}
init
{
fun
startFlashing
()
{
val
(
action
,
uri
,
id
)
=
args
if
(
id
!=
-
1
)
Notifications
.
mgr
.
cancel
(
id
)
startFlashing
(
action
,
uri
)
}
private
fun
startFlashing
(
action
:
String
,
uri
:
Uri
?)
{
viewModelScope
.
launch
{
val
result
=
when
(
action
)
{
Const
.
Value
.
FLASH_ZIP
->
{
...
...
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