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
22e73644
Commit
22e73644
authored
Jul 10, 2019
by
Viktor De Pasquale
Committed by
John Wu
Jul 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added option to run service in foreground right away
parent
6a0f6ab3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
CompoundDownloadService.kt
...opjohnwu/magisk/model/download/CompoundDownloadService.kt
+10
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/model/download/CompoundDownloadService.kt
View file @
22e73644
...
...
@@ -5,6 +5,7 @@ import android.annotation.SuppressLint
import
android.app.PendingIntent
import
android.content.Context
import
android.content.Intent
import
android.os.Build
import
androidx.annotation.RequiresPermission
import
androidx.core.app.NotificationCompat
import
com.topjohnwu.magisk.ClassMap
...
...
@@ -85,10 +86,17 @@ open class CompoundDownloadService : SubstrateDownloadService() {
companion
object
{
@RequiresPermission
(
allOf
=
[
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
])
fun
download
(
context
:
Context
,
subject
:
DownloadSubject
)
=
fun
download
(
context
:
Context
,
subject
:
DownloadSubject
)
{
Intent
(
context
,
ClassMap
[
CompoundDownloadService
::
class
.
java
])
.
putExtra
(
ARG_URL
,
subject
)
.
let
{
context
.
startService
(
it
);
Unit
}
.
let
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
context
.
startForegroundService
(
it
)
}
else
{
context
.
startService
(
it
)
}
}
}
}
...
...
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