[Android] Benchmark: disable picture in picture
Duncan McNamara
git at videolan.org
Tue Oct 29 17:11:04 CET 2019
vlc-android | branch: master | Duncan McNamara <dcn.mcnamara at gmail.com> | Mon Oct 21 18:44:01 2019 +0200| [c5a45215b65da94d63fa6f0734aa4f37e97cd59a] | committer: Duncan McNamara
Benchmark: disable picture in picture
When picture in picture is activated it breaks the benchmark, by
interfearing with the normal vlc finish process.
> https://code.videolan.org/videolan/vlc-android/commit/c5a45215b65da94d63fa6f0734aa4f37e97cd59a
---
.../videolan/vlc/gui/video/VideoPlayerActivity.kt | 52 +++++++++++-----------
1 file changed, 27 insertions(+), 25 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
index 1a02dd4a5..753a2270f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.kt
@@ -616,37 +616,39 @@ open class VideoPlayerActivity : AppCompatActivity(), IPlaybackSettingsControlle
@TargetApi(Build.VERSION_CODES.O)
fun switchToPopup() {
- val mw = service?.currentMediaWrapper
- if (mw == null || !AndroidDevices.pipAllowed
- || !lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED))
- return
+ if (!isBenchmark) {
+ val mw = service?.currentMediaWrapper
+ if (mw == null || !AndroidDevices.pipAllowed
+ || !lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED))
+ return
+
+ val forceLegacy = Settings.getInstance(this).getBoolean(POPUP_FORCE_LEGACY, false)
+ if (AndroidDevices.hasPiP && !forceLegacy) {
+ if (AndroidUtil.isOOrLater)
+ try {
+ videoLayout?.findViewById<View>(R.id.surface_video)?.run {
+ val height = if (height != 0) height else mw.height
+ val width = Math.min(if (width != 0) width else mw.width, (height * 2.39f).toInt())
+ enterPictureInPictureMode(PictureInPictureParams.Builder().setAspectRatio(Rational(width, height)).build())
+ }
+ } catch (e: IllegalArgumentException) { // Fallback with default parameters
- val forceLegacy = Settings.getInstance(this).getBoolean(POPUP_FORCE_LEGACY, false)
- if (AndroidDevices.hasPiP && !forceLegacy) {
- if (AndroidUtil.isOOrLater)
- try {
- videoLayout?.findViewById<View>(R.id.surface_video)?.run {
- val height = if (height != 0) height else mw.height
- val width = Math.min(if (width != 0) width else mw.width, (height * 2.39f).toInt())
- enterPictureInPictureMode(PictureInPictureParams.Builder().setAspectRatio(Rational(width, height)).build())
+ enterPictureInPictureMode()
}
- } catch (e: IllegalArgumentException) { // Fallback with default parameters
+ else {
enterPictureInPictureMode()
}
- else {
-
- enterPictureInPictureMode()
+ } else {
+ if (Permissions.canDrawOverlays(this)) {
+ switchingView = true
+ switchToPopup = true
+ if (service?.isPlaying != true) mw.addFlags(AbstractMediaWrapper.MEDIA_PAUSED)
+ cleanUI()
+ exitOK()
+ } else
+ Permissions.checkDrawOverlaysPermission(this)
}
- } else {
- if (Permissions.canDrawOverlays(this)) {
- switchingView = true
- switchToPopup = true
- if (service?.isPlaying != true) mw.addFlags(AbstractMediaWrapper.MEDIA_PAUSED)
- cleanUI()
- exitOK()
- } else
- Permissions.checkDrawOverlaysPermission(this)
}
}
More information about the Android
mailing list