Gallery: Kill media effect dialog on movies

* It doesn't work and we have an external app for that

Change-Id: I90d4f548d76b7e73815bb811de0377de7c23708e
diff --git a/res/drawable-hdpi/knob.png b/res/drawable-hdpi/knob.png
deleted file mode 100755
index 213c200..0000000
--- a/res/drawable-hdpi/knob.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/knob_toggle_off.png b/res/drawable-hdpi/knob_toggle_off.png
deleted file mode 100644
index a89595e..0000000
--- a/res/drawable-hdpi/knob_toggle_off.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/knob_toggle_on.png b/res/drawable-hdpi/knob_toggle_on.png
deleted file mode 100644
index ab8d3d7..0000000
--- a/res/drawable-hdpi/knob_toggle_on.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/switch_thumb_activated.png b/res/drawable-hdpi/switch_thumb_activated.png
deleted file mode 100755
index 5d6c7d8..0000000
--- a/res/drawable-hdpi/switch_thumb_activated.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/switch_thumb_activated_holo_dark.9.png b/res/drawable-hdpi/switch_thumb_activated_holo_dark.9.png
deleted file mode 100644
index 9c5147e..0000000
--- a/res/drawable-hdpi/switch_thumb_activated_holo_dark.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/switch_thumb_off.png b/res/drawable-hdpi/switch_thumb_off.png
deleted file mode 100755
index 733cef6..0000000
--- a/res/drawable-hdpi/switch_thumb_off.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/switch_thumb_activated_holo_dark.9.png b/res/drawable-mdpi/switch_thumb_activated_holo_dark.9.png
deleted file mode 100644
index 3d7c236..0000000
--- a/res/drawable-mdpi/switch_thumb_activated_holo_dark.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/switch_thumb_activated_holo_dark.9.png b/res/drawable-xhdpi/switch_thumb_activated_holo_dark.9.png
deleted file mode 100644
index ca48bd8..0000000
--- a/res/drawable-xhdpi/switch_thumb_activated_holo_dark.9.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/switch_inner_holo_dark.xml b/res/drawable/switch_inner_holo_dark.xml
deleted file mode 100644
index c0b00bb..0000000
--- a/res/drawable/switch_inner_holo_dark.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2012 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_enabled="false" android:drawable="@drawable/switch_thumb_disabled_holo_dark" />
-    <item android:state_pressed="true"  android:drawable="@drawable/switch_thumb_pressed_holo_dark" />
-    <item android:state_checked="true"  android:drawable="@drawable/switch_thumb_activated_holo_dark" />
-    <item                               android:drawable="@drawable/switch_thumb_holo_dark" />
-</selector>
diff --git a/res/layout/audio_effects_dialog.xml b/res/layout/audio_effects_dialog.xml
deleted file mode 100644
index ac7c85b..0000000
--- a/res/layout/audio_effects_dialog.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Copyright (c) 2013, 2016, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:custom="http://schemas.android.com/apk/res/org.codeaurora.gallery"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:orientation="vertical"
-    android:gravity="center">
-
-    <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:gravity="center_horizontal"
-        android:layout_marginStart="12dp"
-        android:layout_marginEnd="12dp">
-
-        <RelativeLayout
-            android:id="@+id/aEffectsPanel"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="12dp"
-            android:layout_marginBottom="10dp"
-            android:gravity="center_vertical">
-
-            <RelativeLayout
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginStart="24dp"
-                android:layout_weight="1">
-                <com.android.gallery3d.ui.Knob
-                    android:id="@+id/bBStrengthKnob"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_centerHorizontal="true"
-                    custom:foreground="@drawable/knob"/>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_centerHorizontal="true"
-                    android:layout_below="@id/bBStrengthKnob"
-                    android:layout_marginTop="12dp"
-                    android:textColor="@android:color/black"
-                    android:text="@string/bass_boost_strength"/>
-            </RelativeLayout>
-
-            <RelativeLayout
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginEnd="12dp"
-                android:layout_alignParentRight="true"
-                android:layout_weight="1">
-                <com.android.gallery3d.ui.Knob
-                    android:id="@+id/vIStrengthKnob"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_centerHorizontal="true"
-                    custom:foreground="@drawable/knob"/>
-                <TextView
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_below="@id/vIStrengthKnob"
-                    android:layout_marginTop="12dp"
-                    android:layout_centerHorizontal="true"
-                    android:textColor="@android:color/black"
-                    android:text="@string/virtualizer_strength"/>
-            </RelativeLayout>
-        </RelativeLayout>
-    </LinearLayout>
-</LinearLayout>
diff --git a/res/layout/audio_effects_title.xml b/res/layout/audio_effects_title.xml
deleted file mode 100644
index 6822fdf..0000000
--- a/res/layout/audio_effects_title.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Copyright (c) 2014, 2016, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:custom="http://schemas.android.com/apk/res/com.android.gallery3d"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:orientation="horizontal"
-    android:gravity="left|center_vertical">
-
-    <TextView
-        android:text="@string/audio_effects"
-        android:gravity="left|center_vertical"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="24dp"
-        android:layout_marginTop="10dp"
-        android:layout_marginBottom="10dp"
-        android:textColor="@android:color/black"
-        android:textSize="20dp" />
-
-    <View
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:layout_weight="1" />
-
-    <ToggleButton
-        android:id="@+id/audio_effects_switch"
-        android:textOn=""
-        android:textOff=""
-        android:background="@null"
-        android:gravity="center_vertical|right"
-        android:layout_width="72dp"
-        android:layout_height="34dp"/>
-</LinearLayout>
diff --git a/res/layout/knob.xml b/res/layout/knob.xml
deleted file mode 100644
index d504774..0000000
--- a/res/layout/knob.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-Copyright (c) 2013, The Linux Foundation. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of The Linux Foundation nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content">
-
-    <ImageView
-        android:id="@+id/knob_foreground"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content" />
-    <ImageView
-        android:id="@+id/knob_toggle_on"
-        android:layout_gravity="center_horizontal|center_vertical"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:src="@drawable/knob_toggle_on"
-        android:visibility="gone" />
-    <ImageView
-        android:id="@+id/knob_toggle_off"
-        android:layout_gravity="center_horizontal|center_vertical"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:src="@drawable/knob_toggle_off"
-        android:visibility="gone" />
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:layout_gravity="center_horizontal"
-        android:orientation="vertical"
-        android:gravity="center_horizontal">
-
-        <TextView
-            android:id="@+id/knob_value"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:visibility="gone" />
-        <TextView
-            android:id="@+id/knob_label"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:gravity="center"
-            android:ellipsize="marquee"
-            android:visibility="gone" />
-    </LinearLayout>
-
-</FrameLayout>
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index 52ac78f..7dde021 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -37,10 +37,6 @@
         <attr name="largeIcons" format="reference" />
         <attr name="images" format="reference" />
     </declare-styleable>
-    <declare-styleable name="Knob">
-        <attr name="label" format="string" />
-        <attr name="foreground" format="integer" />
-    </declare-styleable>
     <declare-styleable name="FillColor">
         <attr name="fillColorSelector" format="color" />
     </declare-styleable>
diff --git a/res/values/codeaurora_strings.xml b/res/values/codeaurora_strings.xml
index 4aa1ba2..b6f5a73 100644
--- a/res/values/codeaurora_strings.xml
+++ b/res/values/codeaurora_strings.xml
@@ -92,17 +92,9 @@
         <item quantity="other">%1$d videos</item>
     </plurals>
 
-    <!-- The label for the bass boost knob of the audio effects dialog. -->
-    <string name="bass_boost_strength">Bass boost</string>
 
-    <!-- The label for the 3d effect knob of the audio effects dialog. -->
-    <string name="virtualizer_strength">3D effect</string>
 
-    <!-- The label for the audio effects menu. -->
-    <string name="audio_effects">Audio effects</string>
 
-    <!-- Toast if user attempts to control audio effects without headphones plugged in. -->
-    <string name="headset_plug">Plug in headphones for these effects.</string>
 
     <!-- Toast message for share items -->
     <string name="cannot_share_items">Max selected items for share is 300</string>
diff --git a/src/com/android/gallery3d/app/MovieActivity.java b/src/com/android/gallery3d/app/MovieActivity.java
index 2babbe7..119d6bd 100644
--- a/src/com/android/gallery3d/app/MovieActivity.java
+++ b/src/com/android/gallery3d/app/MovieActivity.java
@@ -19,19 +19,14 @@
 import android.annotation.TargetApi;
 import android.app.ActionBar;
 import android.app.ActionBar.OnMenuVisibilityListener;
-import android.app.AlertDialog;
 import android.app.KeyguardManager;
-import android.bluetooth.BluetoothClass;
-import android.bluetooth.BluetoothDevice;
 import android.content.AsyncQueryHandler;
 import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
 import android.content.Context;
-import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.res.Configuration;
-import android.content.SharedPreferences;
 import android.content.pm.ActivityInfo;
 import android.database.Cursor;
 //import android.drm.DrmHelper;
@@ -39,44 +34,30 @@
 import android.graphics.Color;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.ColorDrawable;
-import android.media.AudioManager;
-import android.media.audiofx.AudioEffect;
-import android.media.audiofx.AudioEffect.Descriptor;
-import android.media.audiofx.BassBoost;
-import android.media.audiofx.Virtualizer;
 import android.media.MediaPlayer;
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Bundle;
-import android.os.SystemProperties;
 import android.provider.MediaStore;
 import android.provider.OpenableColumns;
-import android.view.Gravity;
 import android.view.KeyEvent;
-import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.Window;
 import android.view.WindowManager;
-import android.widget.CompoundButton;
 import android.widget.ImageView;
-import android.widget.ToggleButton;
-import android.widget.Toast;
 
 import org.codeaurora.gallery.R;
 import com.android.gallery3d.common.ApiHelper;
 import com.android.gallery3d.common.Utils;
-import com.android.gallery3d.ui.Knob;
 import org.codeaurora.gallery3d.ext.IActivityHooker;
 import org.codeaurora.gallery3d.ext.IMovieItem;
 import org.codeaurora.gallery3d.ext.MovieItem;
 import org.codeaurora.gallery3d.ext.MovieUtils;
 import org.codeaurora.gallery3d.video.ExtensionHelper;
 import org.codeaurora.gallery3d.video.MovieTitleHelper;
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothProfile;
 
 /**
  * This activity plays a video from a specified URI.
@@ -101,26 +82,8 @@
     private boolean     mFinishOnCompletion;
     private Uri         mUri;
     private ImageView   mLiveImg;
+    private boolean     mUserPresentReceived = false;
 
-    private static final short BASSBOOST_MAX_STRENGTH   = 1000;
-    private static final short VIRTUALIZER_MAX_STRENGTH = 1000;
-
-    private boolean mIsHeadsetOn = false;
-    private boolean mVirtualizerSupported = false;
-    private boolean mBassBoostSupported = false;
-
-    static enum Key {
-        global_enabled, bb_strength, virt_strength
-    };
-
-    private BassBoost   mBassBoostEffect;
-    private Virtualizer mVirtualizerEffect;
-    private AlertDialog mEffectDialog;
-    private ToggleButton mSwitch;
-    private Knob        mBassBoostKnob;
-    private Knob        mVirtualizerKnob;
-
-    private SharedPreferences   mPrefs;
     private IMovieItem          mMovieItem;
     private IActivityHooker     mMovieHooker;
     private KeyguardManager     mKeyguardManager;
@@ -131,39 +94,6 @@
 
     private Intent mShareIntent;
 
-    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(final Context context, final Intent intent) {
-            final String action = intent.getAction();
-            final AudioManager audioManager =
-                (AudioManager) getSystemService(Context.AUDIO_SERVICE);
-            if (action.equals(Intent.ACTION_HEADSET_PLUG)) {
-                mIsHeadsetOn = (intent.getIntExtra("state", 0) == 1)
-                        || audioManager.isBluetoothA2dpOn();
-            } else if (action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)
-                    || action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) {
-                final BluetoothClass bc =  ((BluetoothDevice)
-                        intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE))
-                        .getBluetoothClass();
-                if (bc == null) return;
-                final int deviceClass = bc.getDeviceClass();
-                if ((deviceClass == BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES)
-                        || (deviceClass == BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET)) {
-                    mIsHeadsetOn = action.equals(BluetoothDevice.ACTION_ACL_CONNECTED)
-                            || audioManager.isWiredHeadsetOn();
-                }
-            } else if (action.equals(AudioManager.ACTION_AUDIO_BECOMING_NOISY)) {
-                mIsHeadsetOn = false;
-            }
-            if (mEffectDialog != null) {
-                if (!mIsHeadsetOn && !isBtHeadsetConnected() && mEffectDialog.isShowing()) {
-                    mEffectDialog.dismiss();
-                    showHeadsetPlugToast();
-                }
-            }
-        }
-    };
-
     @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
     private void setSystemUiVisibility(View rootView) {
         if (ApiHelper.HAS_VIEW_SYSTEM_UI_FLAG_LAYOUT_STABLE) {
@@ -192,8 +122,6 @@
         initializeActionBar(intent);
         mFinishOnCompletion = intent.getBooleanExtra(
                 MediaStore.EXTRA_FINISH_ON_COMPLETION, true);
-        mPrefs = getSharedPreferences(getApplicationContext().getPackageName(),
-                Context.MODE_PRIVATE);
         mSavedInstanceState = savedInstanceState;
         if (isPermissionGranted()) {
             init(intent, rootView, savedInstanceState);
@@ -242,23 +170,11 @@
         // But for the performance (and battery), we remove the background here.
         win.setBackgroundDrawable(null);
         initMovieHooker(intent, savedInstanceState);
-        if (!SystemProperties.getBoolean("persist.sys.galley.disable_audioeffects", false)) {
-            // Determine available/supported effects
-            final Descriptor[] effects = AudioEffect.queryEffects();
-            for (final Descriptor effect : effects) {
-                if (effect.type.equals(AudioEffect.EFFECT_TYPE_VIRTUALIZER)) {
-                    mVirtualizerSupported = true;
-                } else if (effect.type.equals(AudioEffect.EFFECT_TYPE_BASS_BOOST)) {
-                    mBassBoostSupported = true;
-                }
-            }
-        }
 
         mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
             @Override
             public void onPrepared(MediaPlayer mp) {
                 mPlayer.onPrepared(mp);
-                initEffects(mp.getAudioSessionId());
             }
         });
     }
@@ -373,14 +289,6 @@
             });
         }
 
-        final MenuItem mi = menu.add(R.string.audio_effects);
-        mi.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
-            @Override
-            public boolean onMenuItemClick(MenuItem item) {
-                onAudioEffectsMenuItemClick();
-                return true;
-            }
-        });
         if (isPermissionGranted()) {
             refreshShareProvider(mMovieItem);
             mMovieHooker.onCreateOptionsMenu(menu);
@@ -404,159 +312,6 @@
         return true;
     }
 
-    private void onAudioEffectsMenuItemClick() {
-        if (!mIsHeadsetOn && !isBtHeadsetConnected()) {
-            showHeadsetPlugToast();
-        } else {
-            LayoutInflater factory = LayoutInflater.from(this);
-            final View content = factory.inflate(R.layout.audio_effects_dialog, null);
-            final View title = factory.inflate(R.layout.audio_effects_title, null);
-
-            boolean enabled = mPrefs.getBoolean(Key.global_enabled.toString(), false);
-
-            mSwitch = (ToggleButton) title.findViewById(R.id.audio_effects_switch);
-            mSwitch.setChecked(enabled);
-            mSwitch.setButtonDrawable(enabled ?
-                    R.drawable.switch_thumb_activated : R.drawable.switch_thumb_off);
-
-            mSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
-                @Override
-                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
-                    mSwitch.setButtonDrawable(isChecked ?
-                            R.drawable.switch_thumb_activated : R.drawable.switch_thumb_off);
-                    if(mBassBoostEffect != null) {
-                        mBassBoostEffect.setEnabled(isChecked);
-                    }
-                    if(mVirtualizerEffect != null) {
-                        mVirtualizerEffect.setEnabled(isChecked);
-                    }
-                    mBassBoostKnob.setEnabled(isChecked);
-                    mVirtualizerKnob.setEnabled(isChecked);
-                }
-            });
-
-            mBassBoostKnob = (Knob) content.findViewById(R.id.bBStrengthKnob);
-            mBassBoostKnob.setEnabled(enabled);
-            mBassBoostKnob.setMax(BASSBOOST_MAX_STRENGTH);
-            mBassBoostKnob.setValue(mPrefs.getInt(Key.bb_strength.toString(), 0));
-            mBassBoostKnob.setOnKnobChangeListener(new Knob.OnKnobChangeListener() {
-                @Override
-                public void onValueChanged(Knob knob, int value, boolean fromUser) {
-                    if(mBassBoostEffect != null) {
-                        mBassBoostEffect.setStrength((short) value);
-                    }
-                }
-
-                @Override
-                public boolean onSwitchChanged(Knob knob, boolean enabled) {
-                    return false;
-                }
-            });
-
-            mVirtualizerKnob = (Knob) content.findViewById(R.id.vIStrengthKnob);
-            mVirtualizerKnob.setEnabled(enabled);
-            mVirtualizerKnob.setMax(VIRTUALIZER_MAX_STRENGTH);
-            mVirtualizerKnob.setValue(mPrefs.getInt(Key.virt_strength.toString(), 0));
-            mVirtualizerKnob.setOnKnobChangeListener(new Knob.OnKnobChangeListener() {
-                @Override
-                public void onValueChanged(Knob knob, int value, boolean fromUser) {
-                    if(mVirtualizerEffect != null) {
-                        mVirtualizerEffect.setStrength((short) value);
-                    }
-                }
-
-                @Override
-                public boolean onSwitchChanged(Knob knob, boolean enabled) {
-                    return false;
-                }
-            });
-
-            mEffectDialog = new AlertDialog.Builder(MovieActivity.this,
-                    AlertDialog.THEME_DEVICE_DEFAULT_LIGHT)
-                .setCustomTitle(title)
-                .setView(content)
-                .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-                        SharedPreferences.Editor editor = mPrefs.edit();
-                        editor.putBoolean(Key.global_enabled.toString(), mSwitch.isChecked());
-                        editor.putInt(Key.bb_strength.toString(), mBassBoostKnob.getValue());
-                        editor.putInt(Key.virt_strength.toString(),
-                                mVirtualizerKnob.getValue());
-                        editor.commit();
-                    }
-                })
-                .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-                        boolean enabled = mPrefs.getBoolean(Key.global_enabled.toString(), false);
-                        if(mBassBoostEffect != null) {
-                            mBassBoostEffect.setStrength((short)
-                                    mPrefs.getInt(Key.bb_strength.toString(), 0));
-                            mBassBoostEffect.setEnabled(enabled);
-                        }
-                        if(mVirtualizerEffect != null) {
-                            mVirtualizerEffect.setStrength((short)
-                                mPrefs.getInt(Key.virt_strength.toString(), 0));
-                            mVirtualizerEffect.setEnabled(enabled);
-                        }
-                    }
-                })
-                .setCancelable(false)
-                .create();
-            mEffectDialog.show();
-        }
-    }
-
-    public void initEffects(int sessionId) {
-        // Singleton instance
-        if ((mBassBoostEffect == null) && mBassBoostSupported) {
-            mBassBoostEffect = new BassBoost(0, sessionId);
-        }
-
-        if ((mVirtualizerEffect == null) && mVirtualizerSupported) {
-            mVirtualizerEffect = new Virtualizer(0, sessionId);
-        }
-
-        if (mIsHeadsetOn || isBtHeadsetConnected()) {
-            if (mPrefs.getBoolean(Key.global_enabled.toString(), false)) {
-                if (mBassBoostSupported) {
-                    mBassBoostEffect.setStrength((short)
-                        mPrefs.getInt(Key.bb_strength.toString(), 0));
-                    mBassBoostEffect.setEnabled(true);
-                }
-                if (mVirtualizerSupported) {
-                    mVirtualizerEffect.setStrength((short)
-                        mPrefs.getInt(Key.virt_strength.toString(), 0));
-                    mVirtualizerEffect.setEnabled(true);
-                }
-            } else {
-                if (mBassBoostSupported) {
-                    mBassBoostEffect.setStrength((short)
-                        mPrefs.getInt(Key.bb_strength.toString(), 0));
-                }
-                if (mVirtualizerSupported) {
-                    mVirtualizerEffect.setStrength((short)
-                        mPrefs.getInt(Key.virt_strength.toString(), 0));
-                }
-            }
-        }
-
-    }
-
-    public void releaseEffects() {
-        if (mBassBoostEffect != null) {
-            mBassBoostEffect.setEnabled(false);
-            mBassBoostEffect.release();
-            mBassBoostEffect = null;
-        }
-        if (mVirtualizerEffect != null) {
-            mVirtualizerEffect.setEnabled(false);
-            mVirtualizerEffect.release();
-            mVirtualizerEffect = null;
-        }
-    }
-
     private Intent createShareIntent() {
         Intent intent = new Intent(Intent.ACTION_SEND);
         intent.setType("video/*");
@@ -580,13 +335,6 @@
         return mMovieHooker.onOptionsItemSelected(item);
     }
 
-    public void showHeadsetPlugToast() {
-        final Toast toast = Toast.makeText(getApplicationContext(), R.string.headset_plug,
-                Toast.LENGTH_LONG);
-        toast.setGravity(Gravity.CENTER, toast.getXOffset() / 2, toast.getYOffset() / 2);
-        toast.show();
-    }
-
     @Override
     public void onStart() {
         if (!isPermissionGranted()) {
@@ -619,14 +367,6 @@
             super.onPause();
             return;
         }
-        // Audio track will be deallocated for local video playback,
-        // thus recycle effect here.
-        releaseEffects();
-        try {
-            unregisterReceiver(mReceiver);
-        } catch (IllegalArgumentException e) {
-            // Do nothing
-        }
         mResumed = false;
         if (mControlResumed && mPlayer != null) {
             mControlResumed = !mPlayer.onPause();
@@ -637,21 +377,12 @@
 
     @Override
     public void onResume() {
-        if ((mVirtualizerSupported) || (mBassBoostSupported)) {
-            final IntentFilter intentFilter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
-            intentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
-            intentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
-            intentFilter.addAction(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
-            registerReceiver(mReceiver, intentFilter);
-        }
-
         mResumed = true;
         if (isPermissionGranted()) {
             invalidateOptionsMenu();
             if (!isKeyguardLocked() && !mControlResumed && mPlayer != null) {
                 mPlayer.onResume();
                 mControlResumed = true;
-                //initEffects(mPlayer.getAudioSessionId());
             }
             enhanceActionBar();
             super.onResume();
@@ -672,18 +403,6 @@
         }
     }
 
-    private boolean isBtHeadsetConnected() {
-        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
-        if (adapter != null)
-            {
-            if ((BluetoothProfile.STATE_CONNECTED == adapter.getProfileConnectionState(BluetoothProfile.HEADSET))
-            || (BluetoothProfile.STATE_CONNECTED == adapter.getProfileConnectionState(BluetoothProfile.A2DP))) {
-            return true;
-           }
-        }
-        return false;
-    }
-
     @Override
     public void onSaveInstanceState(Bundle outState) {
         super.onSaveInstanceState(outState);
@@ -696,7 +415,6 @@
             super.onDestroy();
             return;
         }
-        releaseEffects();
         mPlayer.onDestroy();
         super.onDestroy();
         mMovieHooker.onDestroy();
diff --git a/src/com/android/gallery3d/app/MoviePlayer.java b/src/com/android/gallery3d/app/MoviePlayer.java
index 8bf0d0d..7db8dcf 100755
--- a/src/com/android/gallery3d/app/MoviePlayer.java
+++ b/src/com/android/gallery3d/app/MoviePlayer.java
@@ -311,7 +311,6 @@
             mHasPaused = true;
             doStartVideo(true, mVideoPosition, mVideoLastDuration,false);
             mVideoView.start();
-            mActivityContext.initEffects(mVideoView.getAudioSessionId());
         } else {
             mTState = TState.PLAYING;
             mFirstBePlayed = true;
@@ -604,7 +603,6 @@
         }
         if (start) {
             mVideoView.start();
-            mActivityContext.initEffects(mVideoView.getAudioSessionId());
         }
         //we may start video from stopVideo,
         //this case, we should reset canReplay flag according canReplay and loop
@@ -1124,7 +1122,6 @@
                 mVideoView.stopPlayback();
                 mVideoView.setVisibility(View.INVISIBLE);
                 clearVideoInfo();
-                mActivityContext.releaseEffects();
                 mMovieItem = next;
                 mActivityContext.refreshMovieInfo(mMovieItem);
                 doStartVideo(false, 0, 0);
@@ -1160,7 +1157,6 @@
             mVideoView.setResumed(false);
             mVideoView.setVisibility(View.INVISIBLE);
             clearVideoInfo();
-            mActivityContext.releaseEffects();
             mFirstBePlayed = false;
             mController.setCanReplay(true);
             mController.showEnded();
diff --git a/src/com/android/gallery3d/ui/Knob.java b/src/com/android/gallery3d/ui/Knob.java
deleted file mode 100644
index cab7c6f..0000000
--- a/src/com/android/gallery3d/ui/Knob.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *       * Redistributions in binary form must reproduce the above
- *         copyright notice, this list of conditions and the following
- *         disclaimer in the documentation and/or other materials provided
- *         with the distribution.
- *       * Neither the name of The Linux Foundation nor the names of its
- *         contributors may be used to endorse or promote products derived
- *         from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-package com.android.gallery3d.ui;
-
-import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.RectF;
-import android.util.AttributeSet;
-import android.util.TypedValue;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import java.lang.Math;
-
-import org.codeaurora.gallery.R;
-
-public class Knob extends FrameLayout {
-    private static final int STROKE_WIDTH = 6;
-    private static final float TEXT_SIZE = 0.20f;
-    private static final float TEXT_PADDING = 0.31f;
-    private static final float LABEL_PADDING = 0.05f;
-    private static final float LABEL_SIZE = 0.09f;
-    private static final float LABEL_WIDTH = 0.80f;
-    private static final float INDICATOR_RADIUS = 0.38f;
-
-    public interface OnKnobChangeListener {
-        void onValueChanged(Knob knob, int value, boolean fromUser);
-        boolean onSwitchChanged(Knob knob, boolean on);
-    }
-
-    private OnKnobChangeListener mOnKnobChangeListener = null;
-
-    private float mProgress = 0.0f;
-    private int mMax = 100;
-    private boolean mOn = false;
-    private boolean mEnabled = false;
-
-    private int mHighlightColor;
-    private int mLowlightColor;
-    private int mDisabledColor;
-
-    private final Paint mPaint;
-
-    private final TextView mLabelTV;
-    private final TextView mProgressTV;
-
-    private final ImageView mKnobOn;
-    private final ImageView mKnobOff;
-
-    private float mLastX;
-    private float mLastY;
-    private boolean mMoved;
-
-    private int mWidth = 0;
-    private int mIndicatorWidth = 0;
-
-    private RectF mRectF;
-
-    public Knob(Context context, AttributeSet attrs, int defStyle) {
-        super(context, attrs, defStyle);
-
-        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Knob, 0, 0);
-
-        String label;
-        int foreground;
-        try {
-            label = a.getString(R.styleable.Knob_label);
-            foreground = a.getResourceId(R.styleable.Knob_foreground, R.drawable.knob);
-        } finally {
-            a.recycle();
-        }
-
-        LayoutInflater li = (LayoutInflater)
-                context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-        li.inflate(R.layout.knob, this, true);
-
-        Resources res = getResources();
-        mHighlightColor = res.getColor(R.color.highlight);
-        mLowlightColor = res.getColor(R.color.lowlight);
-        mDisabledColor = res.getColor(R.color.disabled_knob);
-
-        ((ImageView) findViewById(R.id.knob_foreground)).setImageResource(foreground);
-        ((ImageView) findViewById(R.id.knob_foreground)).setAlpha(0.35f);
-
-        mLabelTV = (TextView) findViewById(R.id.knob_label);
-        mLabelTV.setText(label);
-        mProgressTV = (TextView) findViewById(R.id.knob_value);
-
-        mKnobOn = (ImageView) findViewById(R.id.knob_toggle_on);
-        mKnobOff = (ImageView) findViewById(R.id.knob_toggle_off);
-
-        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
-        mPaint.setColor(mHighlightColor);
-        mPaint.setStrokeWidth(STROKE_WIDTH);
-        mPaint.setStrokeCap(Paint.Cap.ROUND);
-        mPaint.setStyle(Paint.Style.STROKE);
-
-        setWillNotDraw(false);
-    }
-
-    public Knob(Context context, AttributeSet attrs) {
-        this(context, attrs, 0);
-    }
-
-    public Knob(Context context) {
-        this(context, null);
-    }
-
-    public void setOnKnobChangeListener(OnKnobChangeListener l) {
-        mOnKnobChangeListener = l;
-    }
-
-    public void setValue(int value) {
-        if (mMax != 0) {
-            setProgress(((float) value) / mMax);
-        }
-    }
-
-    public int getValue() {
-        return (int) (mProgress * mMax);
-    }
-
-    public void setProgress(float progress) {
-        setProgress(progress, false);
-    }
-
-    private void setProgressText(boolean on) {
-        if (on) {
-            mProgressTV.setText((int) (mProgress * 100) + "%");
-        } else {
-            mProgressTV.setText("--%");
-        }
-    }
-
-    private void setProgress(float progress, boolean fromUser) {
-        if (progress > 1.0f) {
-            progress = 1.0f;
-        }
-        if (progress < 0.0f) {
-            progress = 0.0f;
-        }
-        mProgress = progress;
-        setProgressText(mOn && mEnabled);
-
-        invalidate();
-
-        if (mOnKnobChangeListener != null) {
-            mOnKnobChangeListener.onValueChanged(this, (int) (progress * mMax), fromUser);
-        }
-    }
-
-    public void setMax(int max) {
-        mMax = max;
-    }
-
-    public float getProgress() {
-        return mProgress;
-    }
-
-    private void drawIndicator() {
-        float r = mWidth * INDICATOR_RADIUS;
-        ImageView view = mOn ? mKnobOn : mKnobOff;
-        view.setTranslationX((float) Math.sin(mProgress * 2 * Math.PI) * r - mIndicatorWidth / 2);
-        view.setTranslationY((float) -Math.cos(mProgress * 2 * Math.PI) * r - mIndicatorWidth / 2);
-    }
-
-    @Override
-    public void setEnabled(boolean enabled) {
-        mEnabled = enabled;
-        setOn(enabled);
-    }
-
-    public void setOn(boolean on) {
-        if (on != mOn) {
-            mOn = on;
-        }
-        on = on && mEnabled;
-        mLabelTV.setTextColor(on ? mHighlightColor : mDisabledColor);
-        mProgressTV.setTextColor(on ? mHighlightColor : mDisabledColor);
-        setProgressText(on);
-        mPaint.setColor(on ? mHighlightColor : mDisabledColor);
-        mKnobOn.setVisibility(on ? View.VISIBLE : View.GONE);
-        mKnobOff.setVisibility(on ? View.GONE : View.VISIBLE);
-        invalidate();
-    }
-
-    @Override
-    protected void onDraw(Canvas canvas) {
-        super.onDraw(canvas);
-        drawIndicator();
-        if (mOn && mEnabled) {
-            canvas.drawArc(mRectF, -90, mProgress * 360, false, mPaint);
-        }
-    }
-
-    @Override
-    protected void onSizeChanged(int w, int h, int oldW, int oldH) {
-        int size = w > h ? h : w;
-        mWidth = size;
-        mIndicatorWidth = mKnobOn.getWidth();
-
-        int diff;
-        if (w > h) {
-            diff = (w - h) / 2;
-            mRectF = new RectF(STROKE_WIDTH + diff, STROKE_WIDTH,
-                    w - STROKE_WIDTH - diff, h - STROKE_WIDTH);
-        } else {
-            diff = (h - w) / 2;
-            mRectF = new RectF(STROKE_WIDTH, STROKE_WIDTH + diff,
-                    w - STROKE_WIDTH, h - STROKE_WIDTH - diff);
-        }
-
-        mProgressTV.setTextSize(TypedValue.COMPLEX_UNIT_PX, size * TEXT_SIZE);
-        mProgressTV.setPadding(0, (int) (size * TEXT_PADDING), 0, 0);
-        mProgressTV.setVisibility(View.VISIBLE);
-        mLabelTV.setTextSize(TypedValue.COMPLEX_UNIT_PX, size * LABEL_SIZE);
-        mLabelTV.setPadding(0, (int) (size * LABEL_PADDING), 0, 0);
-        mLabelTV.setLayoutParams(new LinearLayout.LayoutParams((int) (w * LABEL_WIDTH),
-                    LayoutParams.WRAP_CONTENT));
-        mLabelTV.setVisibility(View.VISIBLE);
-    }
-
-    @Override
-    public boolean onInterceptTouchEvent(MotionEvent ev) {
-        return true;
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent event) {
-        switch (event.getAction()) {
-            case MotionEvent.ACTION_DOWN:
-                if (mOn) {
-                    mLastX = event.getX();
-                    mLastY = event.getY();
-                    getParent().requestDisallowInterceptTouchEvent(true);
-                }
-                break;
-            case MotionEvent.ACTION_MOVE:
-                if (mOn) {
-                    float x = event.getX();
-                    float y = event.getY();
-                    float center = mWidth / 2;
-                    if (mMoved || (x - center) * (x - center) + (y - center) * (y - center)
-                            > center * center / 4) {
-                        float delta = getDelta(x, y);
-                        setProgress(mProgress + delta / 360, true);
-                        mMoved = true;
-                    }
-                    mLastX = x;
-                    mLastY = y;
-                }
-                break;
-            case MotionEvent.ACTION_UP:
-                if (!mMoved) {
-                    if (mOnKnobChangeListener == null
-                            || mOnKnobChangeListener.onSwitchChanged(this, !mOn)) {
-                        if (mEnabled) {
-                            setOn(!mOn);
-                            invalidate();
-                        }
-                    }
-                }
-                mMoved = false;
-                break;
-            default:
-                break;
-        }
-        return true;
-    }
-
-    private float getDelta(float x, float y) {
-        float angle = angle(x, y);
-        float oldAngle = angle(mLastX, mLastY);
-        float delta = angle - oldAngle;
-        if (delta >= 180.0f) {
-            delta = -oldAngle;
-        } else if (delta <= -180.0f) {
-            delta = 360 - oldAngle;
-        }
-        return delta;
-    }
-
-    private float angle(float x, float y) {
-        float center = mWidth / 2.0f;
-        x -= center;
-        y -= center;
-
-        if (x == 0.0f) {
-            if (y > 0.0f) {
-                return 180.0f;
-            } else {
-                return 0.0f;
-            }
-        }
-
-        float angle = (float) (Math.atan(y / x) / Math.PI * 180.0);
-        if (x > 0.0f) {
-            angle += 90;
-        } else {
-            angle += 270;
-        }
-        return angle;
-    }
-}