summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2013-05-13 13:36:01 -0700
committerMangesh Ghiware <mghiware@google.com>2013-09-12 14:14:24 -0700
commite0321526805facb72b307be6120b20a881ee979d (patch)
tree22f598158d3696016cc0e1b57f7c3777d08d198b /src
parente10fd68874fa3cff0e5c3ca07f1e5b9d40be1299 (diff)
downloadandroid_packages_apps_Gallery2-e0321526805facb72b307be6120b20a881ee979d.tar.gz
android_packages_apps_Gallery2-e0321526805facb72b307be6120b20a881ee979d.tar.bz2
android_packages_apps_Gallery2-e0321526805facb72b307be6120b20a881ee979d.zip
Enable virtualization
When the Intent says to virtualize, and the right virtualizer is present on the device, enable virtualization. Bug: 8767565 Bug: 10727216 Change-Id: I8a98404b21c434966b7ae2dc341eb38f2a47eef2 (cherry picked from commit af6b0d2c08afd7803a92856c7c39b5e6144addfa)
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/MoviePlayer.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/app/MoviePlayer.java b/src/com/android/gallery3d/app/MoviePlayer.java
index ce9183483..f6bd36725 100644
--- a/src/com/android/gallery3d/app/MoviePlayer.java
+++ b/src/com/android/gallery3d/app/MoviePlayer.java
@@ -27,6 +27,8 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.media.MediaPlayer;
+import android.media.audiofx.AudioEffect;
+import android.media.audiofx.Virtualizer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@@ -66,6 +68,7 @@ public class MoviePlayer implements
private static final String CMDNAME = "command";
private static final String CMDPAUSE = "pause";
+ private static final String VIRTUALIZE_EXTRA = "virtualize";
private static final long BLACK_TIMEOUT = 500;
// If we resume the acitivty with in RESUMEABLE_TIMEOUT, we will keep playing.
@@ -92,6 +95,8 @@ public class MoviePlayer implements
// If the time bar is visible.
private boolean mShowing;
+ private Virtualizer mVirtualizer;
+
private final Runnable mPlayingChecker = new Runnable() {
@Override
public void run() {
@@ -127,6 +132,18 @@ public class MoviePlayer implements
mVideoView.setOnErrorListener(this);
mVideoView.setOnCompletionListener(this);
mVideoView.setVideoURI(mUri);
+
+ Intent ai = movieActivity.getIntent();
+ boolean virtualize = ai.getBooleanExtra(VIRTUALIZE_EXTRA, false);
+ if (virtualize) {
+ int session = mVideoView.getAudioSessionId();
+ if (session != 0) {
+ mVirtualizer = new Virtualizer(0, session);
+ mVirtualizer.setEnabled(true);
+ } else {
+ Log.w(TAG, "no audio session to virtualize");
+ }
+ }
mVideoView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
@@ -280,6 +297,10 @@ public class MoviePlayer implements
}
public void onDestroy() {
+ if (mVirtualizer != null) {
+ mVirtualizer.release();
+ mVirtualizer = null;
+ }
mVideoView.stopPlayback();
mAudioBecomingNoisyReceiver.unregister();
}