Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb2fd5f5 authored by Teng-Hui Zhu's avatar Teng-Hui Zhu
Browse files

Double check the permission before setting the Wake Lock

bug:53617329
Change-Id: Ia9092b25d62c4a14cba885f5e3fac0326d0fde1c
parent ea1c7f3c
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line

package android.webkit;

import android.Manifest.permission;
import android.content.pm.PackageManager;
import android.graphics.SurfaceTexture;
import android.media.MediaPlayer;
import android.webkit.HTML5VideoView;
@@ -52,8 +54,13 @@ public class HTML5VideoInline extends HTML5VideoView{
    public void prepareDataAndDisplayMode(HTML5VideoViewProxy proxy) {
        super.prepareDataAndDisplayMode(proxy);
        setFrameAvailableListener(proxy);
        // TODO: This is a workaround, after b/5375681 fixed, we should switch
        // to the better way.
        if (mProxy.getContext().checkCallingOrSelfPermission(permission.WAKE_LOCK)
                == PackageManager.PERMISSION_GRANTED) {
            mPlayer.setWakeMode(proxy.getContext(), PowerManager.FULL_WAKE_LOCK);
        }
    }

    // Pause the play and update the play/pause button
    @Override