diff options
author | Roman Birg <roman@cyngn.com> | 2016-09-08 10:33:08 -0700 |
---|---|---|
committer | Zhao Wei Liew <zhaoweiliew@gmail.com> | 2016-10-16 02:05:33 -0700 |
commit | 98931b9e1d5d76513a94f8a999cbd0c04c1c87b4 (patch) | |
tree | 5dae15beb60636535d245f5041a1c7319707c749 | |
parent | 4bf669ace4c1e10f29f25f4034828813b871fa40 (diff) | |
download | android_packages_apps_AudioFX-98931b9e1d5d76513a94f8a999cbd0c04c1c87b4.tar.gz android_packages_apps_AudioFX-98931b9e1d5d76513a94f8a999cbd0c04c1c87b4.tar.bz2 android_packages_apps_AudioFX-98931b9e1d5d76513a94f8a999cbd0c04c1c87b4.zip |
AudioFX: fix missing 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>
4 files changed, 11 insertions, 9 deletions
diff --git a/src/org/cyanogenmod/audiofx/Constants.java b/src/org/cyanogenmod/audiofx/Constants.java index 2ecd7cc..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 = 3; - // 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 85be248..19b9249 100644 --- a/src/org/cyanogenmod/audiofx/activity/ActivityMusic.java +++ b/src/org/cyanogenmod/audiofx/activity/ActivityMusic.java @@ -34,6 +34,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; public class ActivityMusic extends Activity { @@ -101,7 +102,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 6ab4870..6419d2b 100644 --- a/src/org/cyanogenmod/audiofx/backends/AndroidEffects.java +++ b/src/org/cyanogenmod/audiofx/backends/AndroidEffects.java @@ -125,7 +125,7 @@ class AndroidEffects extends EffectSetWithAndroidEq { @Override public boolean hasVirtualizer() { - return mVirtualizer != null && mVirtualizer.getStrengthSupported(); + return mVirtualizer != null; } @Override diff --git a/src/org/cyanogenmod/audiofx/service/DevicePreferenceManager.java b/src/org/cyanogenmod/audiofx/service/DevicePreferenceManager.java index f377f3c..9909132 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 = 4; 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(); } |