From 082d9776530f6b7f9f075c0104d6abf8bd5bc915 Mon Sep 17 00:00:00 2001 From: Anna Galusza Date: Wed, 17 Feb 2016 15:18:15 -0800 Subject: [PATCH] Prevent Magnification video from being paused by the user and automatically pause the video on onPause and resume in onResume. b/26984643 b/26705583 Change-Id: I7b805cf001ba3097fec4e7bd178588c3b23b455f --- .../ToggleScreenMagnificationPreferenceFragment.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java index 041fed8704e..748dc15e40d 100644 --- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java +++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java @@ -55,7 +55,7 @@ public class ToggleScreenMagnificationPreferenceFragment view.setDividerAllowedBelow(false); final RelativeLayout background = (RelativeLayout) view.findViewById(R.id.video_background); - final VideoView videoView = (VideoView) view.findViewById(R.id.video); + VideoView videoView = (VideoView) view.findViewById(R.id.video); // Hacky adjustment for using VideoView in recycle view and positioning // it on the background image @@ -98,7 +98,8 @@ public class ToggleScreenMagnificationPreferenceFragment ContentResolver.SCHEME_ANDROID_RESOURCE, getPrefContext().getPackageName(), R.raw.accessibility_screen_magnification))); - videoView.setMediaController(new MediaController(getPrefContext())); + // Make sure video controls (e.g. for pausing) are not displayed. + videoView.setMediaController(null); videoView.start(); } } @@ -149,6 +150,11 @@ public class ToggleScreenMagnificationPreferenceFragment Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED, 0) == 0) { setMagnificationEnabled(1); } + + VideoView videoView = (VideoView) getView().findViewById(R.id.video); + if (videoView != null) { + videoView.start(); + } } @Override