[Android] fix onSaveInstanceState crash when locking the device with audio player in landscape mode

Sébastien Toque git at videolan.org
Mon Nov 18 20:10:34 CET 2013


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Mon Nov 18 20:10:23 2013 +0100| [81adc80b66bdd066103ccb3f4aeac4b6fac9c5f4] | committer: Sébastien Toque

fix onSaveInstanceState crash when locking the device with audio player in landscape mode

when locking the device in landscape, some device returns to the default orientation.
This may trigger onConfigurationChanged while no activity is displayed (since the screen is off).
So avoid any fragment transaction in this case.

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=81adc80b66bdd066103ccb3f4aeac4b6fac9c5f4
---

 vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
index bd04c88..086ef51 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerFragment.java
@@ -236,7 +236,8 @@ public class AudioPlayerFragment extends SherlockFragment implements IAudioPlaye
     public synchronized void update() {
         // Exit the player and return to the main menu when there is no media
         if (!mAudioController.hasMedia()) {
-            getActivity().getSupportFragmentManager().popBackStackImmediate(); // remove this fragment from view
+            if (!mOrientationChanged)
+                getActivity().getSupportFragmentManager().popBackStackImmediate(); // remove this fragment from view
             return;
         }
 



More information about the Android mailing list