Snap for 7989966 from fce1ac823fd1ac4cde91dc8dd80f8cd47c65a650 to sc-v2-release

Change-Id: I00500039cdbf630de21ea3db25624ba80c8aa89b
diff --git a/src/com/android/musicfx/ControlPanelEffect.java b/src/com/android/musicfx/ControlPanelEffect.java
index fdead1b..1c60ece 100644
--- a/src/com/android/musicfx/ControlPanelEffect.java
+++ b/src/com/android/musicfx/ControlPanelEffect.java
@@ -982,14 +982,6 @@
                 Context.MODE_PRIVATE);
         final SharedPreferences.Editor editor = prefs.edit();
 
-        final boolean isGlobalEnabled = prefs.getBoolean(Key.global_enabled.toString(),
-                GLOBAL_ENABLED_DEFAULT);
-        editor.putBoolean(Key.global_enabled.toString(), isGlobalEnabled);
-
-        if (!isGlobalEnabled) {
-            return;
-        }
-
         // Manage audioSession information
 
         // Retrieve AudioSession Id from map
@@ -1008,6 +1000,14 @@
             mPackageSessions.put(packageName, audioSession);
         }
 
+        final boolean isGlobalEnabled = prefs.getBoolean(Key.global_enabled.toString(),
+                GLOBAL_ENABLED_DEFAULT);
+        editor.putBoolean(Key.global_enabled.toString(), isGlobalEnabled);
+
+        if (!isGlobalEnabled) {
+            return;
+        }
+
         // Because the audioSession is new, get effects & settings from shared preferences
 
         // Virtualizer