[Android] PlaybackService: safer way to access app context

Geoffrey Métais git at videolan.org
Fri Feb 9 09:21:51 CET 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb  9 09:20:02 2018 +0100| [845a4c1f938d442354fd903e06da2f171aabfaf7] | committer: Geoffrey Métais

PlaybackService: safer way to access app context

(cherry picked from commit c70ae7c773deedddc75b5ed8d0e79663794c0120)

> https://code.videolan.org/videolan/vlc-android/commit/845a4c1f938d442354fd903e06da2f171aabfaf7
---

 vlc-android/src/org/videolan/vlc/PlaybackService.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 6a83d0f1c..7cfd96ed6 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -187,7 +187,7 @@ public class PlaybackService extends MediaBrowserServiceCompat{
 
         // Make sure the audio player will acquire a wake-lock while playing. If we don't do
         // that, the CPU might go to sleep while the song is playing, causing playback to stop.
-        final PowerManager pm = (PowerManager) VLCApplication.getAppContext().getSystemService(Context.POWER_SERVICE);
+        final PowerManager pm = (PowerManager) getApplicationContext().getSystemService(Context.POWER_SERVICE);
         mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
 
         updateHasWidget();



More information about the Android mailing list