Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ewout ter Hoeven
VLC-Android
Commits
73845dd1
Commit
73845dd1
authored
Mar 30, 2018
by
Geoffrey Métais
Browse files
Prevent crash on Oreo when app is in background
parent
e2aa54c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
View file @
73845dd1
...
...
@@ -44,13 +44,20 @@ public class RemoteControlClientReceiver extends MediaButtonReceiver {
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
final
String
action
=
intent
.
getAction
();
if
(
action
==
null
)
return
;
final
KeyEvent
event
=
intent
.
getParcelableExtra
(
Intent
.
EXTRA_KEY_EVENT
);
if
(
event
!=
null
&&
action
.
equalsIgnoreCase
(
Intent
.
ACTION_MEDIA_BUTTON
))
{
if
(
event
.
getKeyCode
()
!=
KeyEvent
.
KEYCODE_HEADSETHOOK
&&
event
.
getKeyCode
()
!=
KeyEvent
.
KEYCODE_MEDIA_PLAY_PAUSE
)
{
super
.
onReceive
(
context
,
intent
);
if
(!
AndroidUtil
.
isOOrLater
||
VLCApplication
.
isForeground
())
super
.
onReceive
(
context
,
intent
);
else
if
(
event
.
getAction
()
==
KeyEvent
.
ACTION_DOWN
&&
event
.
getKeyCode
()
==
KeyEvent
.
KEYCODE_MEDIA_PLAY
)
{
intent
=
new
Intent
(
context
,
PlaybackService
.
class
);
intent
.
setAction
(
Constants
.
ACTION_REMOTE_PLAYPAUSE
);
Util
.
startService
(
context
,
intent
);
}
return
;
}
...
...
Write
Preview
Supports
Markdown
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