Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1565a2da
authored
Oct 24, 2022
by
Rohit Singh
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #183 from jasper-apps:bugfix/make-download-notification-appear-immediately
PiperOrigin-RevId: 482165983
parents
a5b09b8c
ed55d0b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
RELEASENOTES.md
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/DownloadNotificationHelper.java
RELEASENOTES.md
View file @
1565a2da
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
*
Fix potential infinite loop in
`ProgressiveDownloader`
caused by
*
Fix potential infinite loop in
`ProgressiveDownloader`
caused by
simultaneous download and playback with the same
`PriorityTaskManager`
simultaneous download and playback with the same
`PriorityTaskManager`
(
[
#10570
](
https://github.com/google/ExoPlayer/pull/10570
)
).
(
[
#10570
](
https://github.com/google/ExoPlayer/pull/10570
)
).
*
Make download notification appear immediately
(
[
#183
](
https://github.com/androidx/media/pull/183
)
)
*
Audio:
*
Audio:
*
Adds
`AudioOffloadListener.onExperimentalOffloadedPlayback`
for the
*
Adds
`AudioOffloadListener.onExperimentalOffloadedPlayback`
for the
AudioTrack offload state.
AudioTrack offload state.
...
...
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/offline/DownloadNotificationHelper.java
View file @
1565a2da
...
@@ -15,15 +15,21 @@
...
@@ -15,15 +15,21 @@
*/
*/
package
androidx
.
media3
.
exoplayer
.
offline
;
package
androidx
.
media3
.
exoplayer
.
offline
;
import
static
androidx
.
core
.
app
.
NotificationCompat
.
FOREGROUND_SERVICE_IMMEDIATE
;
import
android.annotation.SuppressLint
;
import
android.app.Notification
;
import
android.app.Notification
;
import
android.app.PendingIntent
;
import
android.app.PendingIntent
;
import
android.content.Context
;
import
android.content.Context
;
import
androidx.annotation.DoNotInline
;
import
androidx.annotation.DrawableRes
;
import
androidx.annotation.DrawableRes
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.RequiresApi
;
import
androidx.annotation.StringRes
;
import
androidx.annotation.StringRes
;
import
androidx.core.app.NotificationCompat
;
import
androidx.core.app.NotificationCompat
;
import
androidx.media3.common.C
;
import
androidx.media3.common.C
;
import
androidx.media3.common.util.UnstableApi
;
import
androidx.media3.common.util.UnstableApi
;
import
androidx.media3.common.util.Util
;
import
androidx.media3.exoplayer.R
;
import
androidx.media3.exoplayer.R
;
import
androidx.media3.exoplayer.scheduler.Requirements
;
import
androidx.media3.exoplayer.scheduler.Requirements
;
import
java.util.List
;
import
java.util.List
;
...
@@ -237,6 +243,19 @@ public final class DownloadNotificationHelper {
...
@@ -237,6 +243,19 @@ public final class DownloadNotificationHelper {
notificationBuilder
.
setProgress
(
maxProgress
,
currentProgress
,
indeterminateProgress
);
notificationBuilder
.
setProgress
(
maxProgress
,
currentProgress
,
indeterminateProgress
);
notificationBuilder
.
setOngoing
(
ongoing
);
notificationBuilder
.
setOngoing
(
ongoing
);
notificationBuilder
.
setShowWhen
(
showWhen
);
notificationBuilder
.
setShowWhen
(
showWhen
);
if
(
Util
.
SDK_INT
>=
31
)
{
Api31
.
setForegroundServiceBehavior
(
notificationBuilder
);
}
return
notificationBuilder
.
build
();
return
notificationBuilder
.
build
();
}
}
@RequiresApi
(
31
)
private
static
final
class
Api31
{
@SuppressLint
(
"WrongConstant"
)
// TODO(b/254277605): remove lint suppression
@DoNotInline
public
static
void
setForegroundServiceBehavior
(
NotificationCompat
.
Builder
notificationBuilder
)
{
notificationBuilder
.
setForegroundServiceBehavior
(
FOREGROUND_SERVICE_IMMEDIATE
);
}
}
}
}
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