summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorScott Mertz <scott@cyngn.com>2016-05-23 12:59:39 -0700
committerScott Mertz <scott@cyngn.com>2016-05-23 20:08:59 +0000
commitf5ebb43b7c6358bc79a6bf8b6aa141e30ef08e46 (patch)
tree9b18edc7833406a5ecebfd9aa1fc0e486773ba1a /src
parent7df1be0a591a8086a3478bc16a1182982cab1d0c (diff)
downloadandroid_packages_apps_AudioFX-f5ebb43b7c6358bc79a6bf8b6aa141e30ef08e46.tar.gz
android_packages_apps_AudioFX-f5ebb43b7c6358bc79a6bf8b6aa141e30ef08e46.tar.bz2
android_packages_apps_AudioFX-f5ebb43b7c6358bc79a6bf8b6aa141e30ef08e46.zip
AudioFX: create audio output change listener after it's dependencies
There is a chance the AudioOutputChangeListener calls back to AudioFxService via it's callbacks before the DevicePreferenceManager is insantiated. Ensure the DevicePreferenceManager is created before registering the callback. Fixes the following error: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.cyngn.audiofx.service.DevicePreferenceManager.isGlobalEnabled()' on a null object reference at com.cyngn.audiofx.service.AudioFxService.updateQsTile(AudioFxService.java:272) at com.cyngn.audiofx.service.AudioFxService.onAudioOutputChanged(AudioFxService.java:249) at com.cyngn.audiofx.service.AudioOutputChangeListener$1.run(AudioOutputChangeListener.java:80) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.os.HandlerThread.run(HandlerThread.java:61) OPO-743 Change-Id: I6cb52e676f4e91934e151b1d95b5f45a2dc85993
Diffstat (limited to 'src')
-rw-r--r--src/com/cyngn/audiofx/service/AudioFxService.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/com/cyngn/audiofx/service/AudioFxService.java b/src/com/cyngn/audiofx/service/AudioFxService.java
index 1def25c..754664f 100644
--- a/src/com/cyngn/audiofx/service/AudioFxService.java
+++ b/src/com/cyngn/audiofx/service/AudioFxService.java
@@ -142,15 +142,15 @@ public class AudioFxService extends Service
handlerThread.start();
mHandler = new Handler(handlerThread.getLooper());
- mOutputListener = new AudioOutputChangeListener(getApplicationContext(), mHandler);
- mOutputListener.addCallback(this);
-
mDevicePrefs = new DevicePreferenceManager(getApplicationContext());
if (!mDevicePrefs.initDefaults()) {
stopSelf();
return;
}
+ mOutputListener = new AudioOutputChangeListener(getApplicationContext(), mHandler);
+ mOutputListener.addCallback(this);
+
mSessionManager = new SessionManager(getApplicationContext(), mHandler, mDevicePrefs);
mOutputListener.addCallback(mDevicePrefs, mSessionManager);