summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2016-06-14 09:48:41 -0700
committerRoman Birg <roman@cyngn.com>2016-06-14 09:48:41 -0700
commitbaaba848f0dc34dd8e9b12c0b2921142b81dfdb6 (patch)
tree9cce8b235f8ac114455af07a864cf74adcea4e9e
parent27bf875e2a22480bde084dff48be154b874d26c7 (diff)
downloadandroid_packages_apps_AudioFX-baaba848f0dc34dd8e9b12c0b2921142b81dfdb6.tar.gz
android_packages_apps_AudioFX-baaba848f0dc34dd8e9b12c0b2921142b81dfdb6.tar.bz2
android_packages_apps_AudioFX-baaba848f0dc34dd8e9b12c0b2921142b81dfdb6.zip
AudioFX: iniitalize services with current device
If the user clears app data while not on the speaker device, we won't catch the state properly when the app comes back up and will not serve the proper values to the backend service. Ticket: AUDIO-152 Change-Id: I3ed48edb3bae51bd70bc1aad5b96216b9c77a335 Signed-off-by: Roman Birg <roman@cyngn.com>
-rw-r--r--src/com/cyngn/audiofx/service/AudioFxService.java5
-rw-r--r--src/com/cyngn/audiofx/service/DevicePreferenceManager.java3
-rw-r--r--src/com/cyngn/audiofx/service/SessionManager.java4
3 files changed, 8 insertions, 4 deletions
diff --git a/src/com/cyngn/audiofx/service/AudioFxService.java b/src/com/cyngn/audiofx/service/AudioFxService.java
index e824421..ce158b5 100644
--- a/src/com/cyngn/audiofx/service/AudioFxService.java
+++ b/src/com/cyngn/audiofx/service/AudioFxService.java
@@ -145,13 +145,14 @@ public class AudioFxService extends Service
mOutputListener = new AudioOutputChangeListener(getApplicationContext(), mHandler);
mOutputListener.addCallback(this);
- mDevicePrefs = new DevicePreferenceManager(getApplicationContext());
+ mDevicePrefs = new DevicePreferenceManager(getApplicationContext(), mCurrentDevice);
if (!mDevicePrefs.initDefaults()) {
stopSelf();
return;
}
- mSessionManager = new SessionManager(getApplicationContext(), mHandler, mDevicePrefs);
+ mSessionManager = new SessionManager(getApplicationContext(), mHandler, mDevicePrefs,
+ mCurrentDevice);
mOutputListener.addCallback(mDevicePrefs, mSessionManager);
final CMAudioManager cma = CMAudioManager.getInstance(getApplicationContext());
diff --git a/src/com/cyngn/audiofx/service/DevicePreferenceManager.java b/src/com/cyngn/audiofx/service/DevicePreferenceManager.java
index 345d074..11d4de5 100644
--- a/src/com/cyngn/audiofx/service/DevicePreferenceManager.java
+++ b/src/com/cyngn/audiofx/service/DevicePreferenceManager.java
@@ -51,8 +51,9 @@ class DevicePreferenceManager implements AudioOutputChangeListener.AudioOutputCh
private AudioDeviceInfo mCurrentDevice;
- public DevicePreferenceManager(Context context) {
+ public DevicePreferenceManager(Context context, AudioDeviceInfo device) {
mContext = context;
+ mCurrentDevice = device;
}
public boolean initDefaults() {
diff --git a/src/com/cyngn/audiofx/service/SessionManager.java b/src/com/cyngn/audiofx/service/SessionManager.java
index 5c62cf6..2a60cc2 100644
--- a/src/com/cyngn/audiofx/service/SessionManager.java
+++ b/src/com/cyngn/audiofx/service/SessionManager.java
@@ -65,10 +65,12 @@ class SessionManager implements AudioOutputChangeListener.AudioOutputChangedCall
private static final int MSG_UPDATE_FOR_SESSION = 103;
private static final int MSG_UPDATE_EQ_OVERRIDE = 104;
- public SessionManager(Context context, Handler handler, DevicePreferenceManager devicePrefs) {
+ public SessionManager(Context context, Handler handler, DevicePreferenceManager devicePrefs,
+ AudioDeviceInfo outputDevice) {
mContext = context;
mCMAudio = CMAudioManager.getInstance(context);
mDevicePrefs = devicePrefs;
+ mCurrentDevice = outputDevice;
mHandler = new Handler(handler.getLooper(), new AudioServiceHandler());
}