summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2016-09-08 10:33:08 -0700
committerRoman Birg <roman@cyngn.com>2016-09-08 10:38:00 -0700
commit88b8993b8a610ce91e46d586d4e5eccfd8df508f (patch)
tree3463c118128c666700de5fc26cf087c195a074d2
parent5d47be947a8e11495189ed8cafa6c7dc5b0e769a (diff)
downloadandroid_packages_apps_AudioFX-88b8993b8a610ce91e46d586d4e5eccfd8df508f.tar.gz
android_packages_apps_AudioFX-88b8993b8a610ce91e46d586d4e5eccfd8df508f.tar.bz2
android_packages_apps_AudioFX-88b8993b8a610ce91e46d586d4e5eccfd8df508f.zip
AudioFX: fix missing bassboost/virtualizer
If the device doesn't have headphones plugged in, and the speaker reports that it doesn't support virtualizer strength in speaker mode, we made the assumption it was never available. Just check for a valid refernce to the effect, all AndroidEffects _should_ have a virtualizer. Also moved the prefs version to the prefs manager. Change-Id: Id44087c509ece3d55b42c985660a61222bbdfe17 Ticket: AUDIO-152 Signed-off-by: Roman Birg <roman@cyngn.com>
-rw-r--r--src/org/cyanogenmod/audiofx/Constants.java3
-rw-r--r--src/org/cyanogenmod/audiofx/activity/ActivityMusic.java3
-rw-r--r--src/org/cyanogenmod/audiofx/backends/AndroidEffects.java4
-rw-r--r--src/org/cyanogenmod/audiofx/service/DevicePreferenceManager.java12
4 files changed, 12 insertions, 10 deletions
diff --git a/src/org/cyanogenmod/audiofx/Constants.java b/src/org/cyanogenmod/audiofx/Constants.java
index 4c1fafb..04ca721 100644
--- a/src/org/cyanogenmod/audiofx/Constants.java
+++ b/src/org/cyanogenmod/audiofx/Constants.java
@@ -24,9 +24,6 @@ import java.util.List;
public class Constants {
- // current pref version, bump to rebuild prefs
- public static final int CURRENT_PREFS_INT_VERSION = 2;
-
// effect type identifiers
public static final int EFFECT_TYPE_ANDROID = 1;
public static final int EFFECT_TYPE_MAXXAUDIO = 2;
diff --git a/src/org/cyanogenmod/audiofx/activity/ActivityMusic.java b/src/org/cyanogenmod/audiofx/activity/ActivityMusic.java
index d879b69..411ba45 100644
--- a/src/org/cyanogenmod/audiofx/activity/ActivityMusic.java
+++ b/src/org/cyanogenmod/audiofx/activity/ActivityMusic.java
@@ -35,6 +35,7 @@ import org.cyanogenmod.audiofx.R;
import org.cyanogenmod.audiofx.fragment.AudioFxFragment;
import org.cyanogenmod.audiofx.knobs.KnobCommander;
import org.cyanogenmod.audiofx.service.AudioFxService;
+import org.cyanogenmod.audiofx.service.DevicePreferenceManager;
import org.cyanogenmod.audiofx.stats.AppState;
import org.cyanogenmod.audiofx.stats.UserSession;
@@ -107,7 +108,7 @@ public class ActivityMusic extends Activity {
}
private boolean defaultsSetup() {
- final int targetVersion = Constants.CURRENT_PREFS_INT_VERSION;
+ final int targetVersion = DevicePreferenceManager.CURRENT_PREFS_INT_VERSION;
final SharedPreferences prefs = Constants.getGlobalPrefs(this);
final int currentVersion = prefs.getInt(Constants.AUDIOFX_GLOBAL_PREFS_VERSION_INT, 0);
final boolean defaultsSaved = prefs.getBoolean(Constants.SAVED_DEFAULTS, false);
diff --git a/src/org/cyanogenmod/audiofx/backends/AndroidEffects.java b/src/org/cyanogenmod/audiofx/backends/AndroidEffects.java
index fafcd34..6419d2b 100644
--- a/src/org/cyanogenmod/audiofx/backends/AndroidEffects.java
+++ b/src/org/cyanogenmod/audiofx/backends/AndroidEffects.java
@@ -125,12 +125,12 @@ class AndroidEffects extends EffectSetWithAndroidEq {
@Override
public boolean hasVirtualizer() {
- return mVirtualizer != null && mVirtualizer.getStrengthSupported();
+ return mVirtualizer != null;
}
@Override
public boolean hasBassBoost() {
- return mBassBoost != null && mBassBoost.getStrengthSupported();
+ return mBassBoost != null;
}
@Override
diff --git a/src/org/cyanogenmod/audiofx/service/DevicePreferenceManager.java b/src/org/cyanogenmod/audiofx/service/DevicePreferenceManager.java
index f377f3c..2d99b21 100644
--- a/src/org/cyanogenmod/audiofx/service/DevicePreferenceManager.java
+++ b/src/org/cyanogenmod/audiofx/service/DevicePreferenceManager.java
@@ -57,7 +57,11 @@ import java.util.Arrays;
import java.util.List;
import java.util.Locale;
-class DevicePreferenceManager implements AudioOutputChangeListener.AudioOutputChangedCallback {
+public class DevicePreferenceManager
+ implements AudioOutputChangeListener.AudioOutputChangedCallback {
+
+ // current pref version, bump to rebuild prefs
+ public static final int CURRENT_PREFS_INT_VERSION = 3;
private static final String TAG = AudioFxService.TAG;
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
@@ -119,12 +123,12 @@ class DevicePreferenceManager implements AudioOutputChangeListener.AudioOutputCh
SharedPreferences prefs = Constants.getGlobalPrefs(mContext);
final int currentPrefVer = prefs.getInt(Constants.AUDIOFX_GLOBAL_PREFS_VERSION_INT, 0);
- boolean needsPrefsUpdate = currentPrefVer < Constants.CURRENT_PREFS_INT_VERSION
+ boolean needsPrefsUpdate = currentPrefVer < CURRENT_PREFS_INT_VERSION
|| overridePrevious;
if (needsPrefsUpdate) {
Log.d(TAG, "rebuilding presets due to preference upgrade from " + currentPrefVer
- + " to " + Constants.CURRENT_PREFS_INT_VERSION);
+ + " to " + CURRENT_PREFS_INT_VERSION);
}
if (prefs.getBoolean(SAVED_DEFAULTS, false) && !needsPrefsUpdate) {
@@ -193,7 +197,7 @@ class DevicePreferenceManager implements AudioOutputChangeListener.AudioOutputCh
prefs
.edit()
.putInt(Constants.AUDIOFX_GLOBAL_PREFS_VERSION_INT,
- Constants.CURRENT_PREFS_INT_VERSION)
+ CURRENT_PREFS_INT_VERSION)
.putBoolean(Constants.SAVED_DEFAULTS, true)
.commit();
}