Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(821)

Unified Diff: media/base/android/java/src/org/chromium/media/MediaPlayerListener.java

Issue 11362018: check the permission for wake lock before calling setWakeMode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/java/src/org/chromium/media/MediaPlayerListener.java
diff --git a/media/base/android/java/src/org/chromium/media/MediaPlayerListener.java b/media/base/android/java/src/org/chromium/media/MediaPlayerListener.java
index 7ab0fe8ba64332361190c95eeebd351c2e65f77a..7381ee1ec022ec059f2610279a07ce6cc985818f 100644
--- a/media/base/android/java/src/org/chromium/media/MediaPlayerListener.java
+++ b/media/base/android/java/src/org/chromium/media/MediaPlayerListener.java
@@ -5,6 +5,8 @@
package org.chromium.media;
import android.content.Context;
+import android.content.pm.PackageManager;
+import android.Manifest.permission;
import android.media.MediaPlayer;
import org.chromium.base.CalledByNative;
@@ -93,7 +95,10 @@ class MediaPlayerListener implements MediaPlayer.OnPreparedListener,
mediaPlayer.setOnPreparedListener(listener);
mediaPlayer.setOnSeekCompleteListener(listener);
mediaPlayer.setOnVideoSizeChangedListener(listener);
- mediaPlayer.setWakeMode(context, android.os.PowerManager.FULL_WAKE_LOCK);
+ if (PackageManager.PERMISSION_GRANTED ==
Yaron 2012/10/31 19:26:39 Shouldn't we just add the WAKE_LOCK permission? Is
+ context.checkCallingPermission(permission.WAKE_LOCK)) {
+ mediaPlayer.setWakeMode(context, android.os.PowerManager.FULL_WAKE_LOCK);
+ }
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698