audioflinger: Fix battery accounting for offload tracks

Ensure that the list of wakelock UIDs is only cleared if
the offload playback wakelock is released during async completion
wait.

Bug: 30830106
Change-Id: Icf18b9e88e55c27bc03d8a904cc91f593cc95815
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index aa2561e..5e0a7ac 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -3106,9 +3106,9 @@
                 if (!keepWakeLock()) {
                     releaseWakeLock_l();
                     released = true;
+                    mWakeLockUids.clear();
+                    mActiveTracksGeneration++;
                 }
-                mWakeLockUids.clear();
-                mActiveTracksGeneration++;
                 ALOGV("wait async completion");
                 mWaitWorkCV.wait(mLock);
                 ALOGV("async completion/wake");