Create hint session asynchronously

Sends createHintSession asynchronously inside worker thread

Consistency is maintained by returning the session with a std::future
which we only check when we try to do hint session operations within
renderthread, to avoid races or mutexes necessary with a callback fn.

Bug: 272002264
Test: manual
Change-Id: I9b64f20f1abdac91993742b9f9aea7824288fdd3
diff --git a/libs/hwui/renderthread/HintSessionWrapper.h b/libs/hwui/renderthread/HintSessionWrapper.h
index f2f1298..b7a433f 100644
--- a/libs/hwui/renderthread/HintSessionWrapper.h
+++ b/libs/hwui/renderthread/HintSessionWrapper.h
@@ -18,6 +18,8 @@
 
 #include <android/performance_hint.h>
 
+#include <future>
+
 #include "utils/TimeUtils.h"
 
 namespace android {
@@ -38,6 +40,7 @@
 
 private:
     APerformanceHintSession* mHintSession = nullptr;
+    std::future<APerformanceHintSession*> mHintSessionFuture;
 
     nsecs_t mLastFrameNotification = 0;
     nsecs_t mLastTargetWorkDuration = 0;