Improvements to SF's BackgroundExcecutor.

- stop using utils/Singleton.h (it's marked as DO NOT USE)
- add a low priority instance
- explicitly set the thread priorities for both the HP and LP instances.

Test: manual, libsurfaceflinger_unittest
Bug: http://b/336461947
Change-Id: Ie10f663ed43aad21ba2a5235cd86a1101dec0cd7
diff --git a/services/surfaceflinger/BackgroundExecutor.h b/services/surfaceflinger/BackgroundExecutor.h
index 66b7d7a..1b5fadd 100644
--- a/services/surfaceflinger/BackgroundExecutor.h
+++ b/services/surfaceflinger/BackgroundExecutor.h
@@ -18,7 +18,6 @@
 
 #include <ftl/small_vector.h>
 #include <semaphore.h>
-#include <utils/Singleton.h>
 #include <thread>
 
 #include "LocklessQueue.h"
@@ -26,10 +25,20 @@
 namespace android {
 
 // Executes tasks off the main thread.
-class BackgroundExecutor : public Singleton<BackgroundExecutor> {
+class BackgroundExecutor {
 public:
-    BackgroundExecutor();
     ~BackgroundExecutor();
+
+    static BackgroundExecutor& getInstance() {
+        static BackgroundExecutor instance(true);
+        return instance;
+    }
+
+    static BackgroundExecutor& getLowPriorityInstance() {
+        static BackgroundExecutor instance(false);
+        return instance;
+    }
+
     using Callbacks = ftl::SmallVector<std::function<void()>, 10>;
     // Queues callbacks onto a work queue to be executed by a background thread.
     // This is safe to call from multiple threads.
@@ -37,6 +46,8 @@
     void flushQueue();
 
 private:
+    BackgroundExecutor(bool highPriority);
+
     sem_t mSemaphore;
     std::atomic_bool mDone = false;