Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
533
Issue boards
Milestones
Wiki
Code
Merge requests
14
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
a6f62eeb
Commit
a6f62eeb
authored
7 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Fix race condition for scan feedback display
parent
315b8cf5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vlc-android/src/org/videolan/vlc/MediaParsingService.java
+15
-12
15 additions, 12 deletions
vlc-android/src/org/videolan/vlc/MediaParsingService.java
with
15 additions
and
12 deletions
vlc-android/src/org/videolan/vlc/MediaParsingService.java
+
15
−
12
View file @
a6f62eeb
...
...
@@ -84,14 +84,17 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
paused
=
false
;
break
;
case
Medialibrary
.
ACTION_IDLE
:
if
(
intent
.
getBooleanExtra
(
Medialibrary
.
STATE_IDLE
,
true
)
&&
!
paused
)
{
stopSelf
();
}
else
{
synchronized
(
this
)
{
mLastNotificationTime
=
0L
;
if
(
intent
.
getBooleanExtra
(
Medialibrary
.
STATE_IDLE
,
true
))
{
if
(!
paused
)
{
stopSelf
();
return
;
}
showNotification
();
}
synchronized
(
MediaParsingService
.
this
)
{
if
(
mLastNotificationTime
!=
-
1L
)
mLastNotificationTime
=
0L
;
}
showNotification
();
break
;
}
}
...
...
@@ -121,7 +124,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
synchronized
(
this
)
{
synchronized
(
MediaParsingService
.
this
)
{
if
(
mLastNotificationTime
<=
0L
)
mLastNotificationTime
=
System
.
currentTimeMillis
();
}
...
...
@@ -239,7 +242,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
private
final
Intent
notificationIntent
=
new
Intent
();
private
void
showNotification
()
{
final
long
currentTime
=
System
.
currentTimeMillis
();
synchronized
(
this
)
{
synchronized
(
MediaParsingService
.
this
)
{
if
(
mLastNotificationTime
==
-
1L
||
currentTime
-
mLastNotificationTime
<
NOTIFICATION_DELAY
)
return
;
mLastNotificationTime
=
currentTime
;
...
...
@@ -265,9 +268,6 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
}
String
progressText
=
sb
.
toString
();
builder
.
setContentText
(
progressText
);
mLocalBroadcastManager
.
sendBroadcast
(
progessIntent
.
putExtra
(
ACTION_PROGRESS_TEXT
,
progressText
)
.
putExtra
(
ACTION_PROGRESS_VALUE
,
mParsing
));
boolean
isWorking
=
mMedialibrary
.
isWorking
();
if
(
wasWorking
!=
isWorking
)
{
...
...
@@ -282,6 +282,9 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
final
Notification
notification
=
builder
.
build
();
synchronized
(
MediaParsingService
.
this
)
{
if
(
mLastNotificationTime
!=
-
1L
)
{
mLocalBroadcastManager
.
sendBroadcast
(
progessIntent
.
putExtra
(
ACTION_PROGRESS_TEXT
,
progressText
)
.
putExtra
(
ACTION_PROGRESS_VALUE
,
mParsing
));
try
{
startForeground
(
43
,
notification
);
}
catch
(
IllegalArgumentException
ignored
)
{}
...
...
@@ -292,7 +295,7 @@ public class MediaParsingService extends Service implements DevicesDiscoveryCb {
}
private
void
hideNotification
()
{
synchronized
(
this
)
{
synchronized
(
MediaParsingService
.
this
)
{
mLastNotificationTime
=
-
1L
;
NotificationManagerCompat
.
from
(
MediaParsingService
.
this
).
cancel
(
43
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment