audioserver: add automated audio power logging

We utilize the wakelock and batterystat logic to measure
by app the power used during audio playback.

This is integrated into audioserver to allow close tracking
of apps in and out of suspend.

This is default disabled for now. Before trying, use
$ adb shell setenforce 0
$ adb shell setprop persist.audio.power_stats.enabled true
$ adb shell aflags enable com.android.media.audioserver.power_stats true

Flag: com.android.media.audioserver.power_stats
Test: atest powerstats_collector_tests
Test: atest audio_powerstats_benchmark
Test: audio_powerstatscollector_benchmark
Test: atest audio_token_benchmark
Bug: 350114693
Change-Id: I6e0c04089fce72b1e3e22532e39f38f5d6657f28
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 7c58c96..ba2b920 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -38,6 +38,7 @@
 #include <media/audiohal/DevicesFactoryHalInterface.h>
 #include <mediautils/ServiceUtilities.h>
 #include <mediautils/Synchronization.h>
+#include <psh_utils/AudioPowerManager.h>
 
 // not needed with the includes above, added to prevent transitive include dependency.
 #include <utils/KeyedVector.h>
@@ -499,6 +500,7 @@
         const pid_t             mPid;
         const uid_t             mUid;
         const sp<media::IAudioFlingerClient> mAudioFlingerClient;
+        const std::unique_ptr<media::psh_utils::Token> mClientToken;
     };
 
     // --- MediaLogNotifier ---