hqd: add qservice binder for blocking dpps

Dpps should wait opening driver before composer comes up.
Add a wservice binder call to query composer init status.
Add util function to block dpps until composer is up.

Change-Id: I82c025011e23a0b159ef2449b00b868a365d681a
CRs-fixed: 2102579
diff --git a/libqdutils/display_config.cpp b/libqdutils/display_config.cpp
index 83d912e..87ca401 100644
--- a/libqdutils/display_config.cpp
+++ b/libqdutils/display_config.cpp
@@ -366,3 +366,25 @@
     return err;
 }
 
+// returns 0 if composer is up
+extern "C" int waitForComposerInit() {
+    int status = false;
+    sp<IQService> binder = getBinder();
+    if (binder == NULL) {
+        sleep(2);
+        binder = getBinder();
+    }
+
+    if (binder != NULL) {
+        Parcel inParcel, outParcel;
+        binder->dispatch(IQService::GET_COMPOSER_STATUS, &inParcel, &outParcel);
+        status = !!outParcel.readInt32();
+        if (!status) {
+            sleep(2);
+            binder->dispatch(IQService::GET_COMPOSER_STATUS, &inParcel, &outParcel);
+            status = !!outParcel.readInt32();
+        }
+    }
+
+    return !status;
+}