[Android] Videoplayer: Sanity check

Geoffrey Métais git at videolan.org
Wed Mar 20 11:35:31 CET 2019


vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 20 11:34:06 2019 +0100| [5d05f1ec3c1a2f65cb4e393d98bf1aaa3c055995] | committer: Geoffrey Métais

Videoplayer: Sanity check

setRequestedOrientation can fail on Oreo

> https://code.videolan.org/videolan/vlc-android/commit/5d05f1ec3c1a2f65cb4e393d98bf1aaa3c055995
---

 vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index f98549e66..ab7675954 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -350,7 +350,11 @@ public class VideoPlayerActivity extends AppCompatActivity implements IPlaybackS
         this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
 
         // 100 is the value for screen_orientation_start_lock
-        setRequestedOrientation(getScreenOrientation(mScreenOrientation));
+        try {
+            setRequestedOrientation(getScreenOrientation(mScreenOrientation));
+        } catch (IllegalStateException ignored) {
+            Log.w(TAG, "onCreate: failed to set orientation");
+        }
         // Extra initialization when no secondary display is detected
         mIsTv = AndroidDevices.showTvUi(this);
         if (mDisplayManager.isPrimary()) {



More information about the Android mailing list