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
0726a00e
Commit
0726a00e
authored
Jan 27, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix download notifications
parent
5a88984d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
+13
-12
App.kt
app/src/main/java/com/topjohnwu/magisk/core/App.kt
+2
-2
DownloadService.kt
...ava/com/topjohnwu/magisk/core/download/DownloadService.kt
+4
-3
ManagerHandler.kt
...java/com/topjohnwu/magisk/core/download/ManagerHandler.kt
+2
-2
Subject.kt
...c/main/java/com/topjohnwu/magisk/core/download/Subject.kt
+5
-5
No files found.
app/src/main/java/com/topjohnwu/magisk/core/App.kt
View file @
0726a00e
...
@@ -64,7 +64,7 @@ open class App() : Application() {
...
@@ -64,7 +64,7 @@ open class App() : Application() {
}
}
base
.
resources
.
patch
()
base
.
resources
.
patch
()
app
.
registerActivityLifecycleCallbacks
(
Foreground
Tracker
)
app
.
registerActivityLifecycleCallbacks
(
Activity
Tracker
)
}
}
override
fun
onCreate
()
{
override
fun
onCreate
()
{
...
@@ -86,7 +86,7 @@ open class App() : Application() {
...
@@ -86,7 +86,7 @@ open class App() : Application() {
}
}
@SuppressLint
(
"StaticFieldLeak"
)
@SuppressLint
(
"StaticFieldLeak"
)
object
Foreground
Tracker
:
Application
.
ActivityLifecycleCallbacks
{
object
Activity
Tracker
:
Application
.
ActivityLifecycleCallbacks
{
@Volatile
@Volatile
var
foreground
:
Activity
?
=
null
var
foreground
:
Activity
?
=
null
...
...
app/src/main/java/com/topjohnwu/magisk/core/download/DownloadService.kt
View file @
0726a00e
...
@@ -11,7 +11,7 @@ import android.os.IBinder
...
@@ -11,7 +11,7 @@ import android.os.IBinder
import
androidx.lifecycle.LifecycleOwner
import
androidx.lifecycle.LifecycleOwner
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.MutableLiveData
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.
Foreground
Tracker
import
com.topjohnwu.magisk.core.
Activity
Tracker
import
com.topjohnwu.magisk.core.base.BaseService
import
com.topjohnwu.magisk.core.base.BaseService
import
com.topjohnwu.magisk.core.intent
import
com.topjohnwu.magisk.core.intent
import
com.topjohnwu.magisk.core.utils.ProgressInputStream
import
com.topjohnwu.magisk.core.utils.ProgressInputStream
...
@@ -68,9 +68,10 @@ class DownloadService : BaseService() {
...
@@ -68,9 +68,10 @@ class DownloadService : BaseService() {
is
Subject
.
Manager
->
handleAPK
(
subject
,
stream
)
is
Subject
.
Manager
->
handleAPK
(
subject
,
stream
)
else
->
stream
.
toModule
(
subject
.
file
,
service
.
fetchInstaller
().
byteStream
())
else
->
stream
.
toModule
(
subject
.
file
,
service
.
fetchInstaller
().
byteStream
())
}
}
if
(
ForegroundTracker
.
hasForeground
)
{
val
activity
=
ActivityTracker
.
foreground
if
(
activity
!=
null
&&
subject
.
autoStart
)
{
remove
(
subject
.
notifyId
)
remove
(
subject
.
notifyId
)
subject
.
pendingIntent
(
this
@DownloadService
)
?
.
send
()
subject
.
pendingIntent
(
activity
)
.
send
()
}
else
{
}
else
{
notifyFinish
(
subject
)
notifyFinish
(
subject
)
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/core/download/ManagerHandler.kt
View file @
0726a00e
...
@@ -7,7 +7,7 @@ import androidx.core.content.getSystemService
...
@@ -7,7 +7,7 @@ import androidx.core.content.getSystemService
import
androidx.core.net.toFile
import
androidx.core.net.toFile
import
com.topjohnwu.magisk.DynAPK
import
com.topjohnwu.magisk.DynAPK
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.
Foreground
Tracker
import
com.topjohnwu.magisk.core.
Activity
Tracker
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.isRunningAsStub
import
com.topjohnwu.magisk.core.isRunningAsStub
import
com.topjohnwu.magisk.core.tasks.HideAPK
import
com.topjohnwu.magisk.core.tasks.HideAPK
...
@@ -64,7 +64,7 @@ suspend fun DownloadService.handleAPK(subject: Subject.Manager, stream: InputStr
...
@@ -64,7 +64,7 @@ suspend fun DownloadService.handleAPK(subject: Subject.Manager, stream: InputStr
//noinspection InlinedApi
//noinspection InlinedApi
val
flag
=
PendingIntent
.
FLAG_IMMUTABLE
or
PendingIntent
.
FLAG_UPDATE_CURRENT
val
flag
=
PendingIntent
.
FLAG_IMMUTABLE
or
PendingIntent
.
FLAG_UPDATE_CURRENT
val
pending
=
PendingIntent
.
getActivity
(
this
,
id
,
intent
,
flag
)
val
pending
=
PendingIntent
.
getActivity
(
this
,
id
,
intent
,
flag
)
if
(
Foreground
Tracker
.
hasForeground
)
{
if
(
Activity
Tracker
.
hasForeground
)
{
val
alarm
=
getSystemService
<
AlarmManager
>()
val
alarm
=
getSystemService
<
AlarmManager
>()
alarm
!!
.
set
(
AlarmManager
.
RTC
,
System
.
currentTimeMillis
()
+
1000
,
pending
)
alarm
!!
.
set
(
AlarmManager
.
RTC
,
System
.
currentTimeMillis
()
+
1000
,
pending
)
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/core/download/Subject.kt
View file @
0726a00e
...
@@ -34,8 +34,9 @@ sealed class Subject : Parcelable {
...
@@ -34,8 +34,9 @@ sealed class Subject : Parcelable {
abstract
val
file
:
Uri
abstract
val
file
:
Uri
abstract
val
title
:
String
abstract
val
title
:
String
abstract
val
notifyId
:
Int
abstract
val
notifyId
:
Int
open
val
autoStart
:
Boolean
get
()
=
true
abstract
fun
pendingIntent
(
context
:
Context
):
PendingIntent
?
abstract
fun
pendingIntent
(
context
:
Context
):
PendingIntent
@Parcelize
@Parcelize
class
Module
(
class
Module
(
...
@@ -45,16 +46,15 @@ sealed class Subject : Parcelable {
...
@@ -45,16 +46,15 @@ sealed class Subject : Parcelable {
)
:
Subject
()
{
)
:
Subject
()
{
override
val
url
:
String
get
()
=
module
.
zipUrl
override
val
url
:
String
get
()
=
module
.
zipUrl
override
val
title
:
String
get
()
=
module
.
downloadFilename
override
val
title
:
String
get
()
=
module
.
downloadFilename
override
val
autoStart
:
Boolean
get
()
=
action
==
Action
.
Flash
@IgnoredOnParcel
@IgnoredOnParcel
override
val
file
by
lazy
{
override
val
file
by
lazy
{
MediaStoreUtils
.
getFile
(
title
).
uri
MediaStoreUtils
.
getFile
(
title
).
uri
}
}
override
fun
pendingIntent
(
context
:
Context
)
=
when
(
action
)
{
override
fun
pendingIntent
(
context
:
Context
)
=
Action
.
Flash
->
FlashFragment
.
installIntent
(
context
,
file
)
FlashFragment
.
installIntent
(
context
,
file
)
else
->
null
}
}
}
@Parcelize
@Parcelize
...
...
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