display: Clean up binder interface

The current binder implementation is inflexible when it comes to
adding new input/output parameters. It also needs a lot of
boilerplate code written when adding a simple enable/disable type
command.
Instead, let clients specify the parcels they want to pass and
unparcel them at the end points only.
Please note that it is assumed that all commands coming in
need the same permission checks. If this is no longer the case,
some commands need to be split out on the receiver end in
IQService.cpp.
This change also simplifies the code end clients need to write.
They should be able to include QServiceUtils and call a single
function to set the binder up and make the call.

Change-Id: I4db66f2427ecf16d7a6264462ae85815217a16b1
diff --git a/libqservice/IQService.h b/libqservice/IQService.h
index 9cd122e..7ad443d 100644
--- a/libqservice/IQService.h
+++ b/libqservice/IQService.h
@@ -29,35 +29,39 @@
 #include <binder/IBinder.h>
 #include <IQClient.h>
 
+
 namespace qService {
 // ----------------------------------------------------------------------------
+
 class IQService : public android::IInterface
 {
 public:
     DECLARE_META_INTERFACE(QService);
     enum {
-        // Hardware securing start/end notification
-        SECURING = android::IBinder::FIRST_CALL_TRANSACTION,
-        UNSECURING, // Hardware unsecuring start/end notification
-        CONNECT,
-        SCREEN_REFRESH,
-        EXTERNAL_ORIENTATION,
-        BUFFER_MIRRORMODE,
-        //VPU command codes - list is defined in vpu.h
-        VPU_COMMAND_LIST_START = 100,
-        VPU_COMMAND_LIST_END = 200,
+        COMMAND_LIST_START = android::IBinder::FIRST_CALL_TRANSACTION,
+        SECURING,                // Hardware securing start/end notification
+        UNSECURING,              // Hardware unsecuring start/end notification
+        CONNECT,                 // Connect to qservice
+        SCREEN_REFRESH,          // Refresh screen through SF invalidate
+        EXTERNAL_ORIENTATION,    // Set external orientation
+        BUFFER_MIRRORMODE,       // Buffer mirrormode
+        VPU_COMMAND_LIST_START = 100, //Reserved block for VPU commands
+        VPU_COMMAND_LIST_END   = 200,
+        COMMAND_LIST_END = 400,
     };
+
     enum {
         END = 0,
         START,
     };
-    virtual void securing(uint32_t startEnd) = 0;
-    virtual void unsecuring(uint32_t startEnd) = 0;
+
+    // Register a client that can be notified
     virtual void connect(const android::sp<qClient::IQClient>& client) = 0;
-    virtual android::status_t screenRefresh() = 0;
-    virtual void setExtOrientation(uint32_t orientation) = 0;
-    virtual void setBufferMirrorMode(uint32_t enable) = 0;
-    virtual android::status_t vpuCommand(uint32_t command, uint32_t setting) = 0;
+    // Generic function to dispatch binder commands
+    // The type of command decides how the data is parceled
+    virtual android::status_t dispatch(uint32_t command,
+            const android::Parcel* inParcel,
+            android::Parcel* outParcel) = 0;
 };
 
 // ----------------------------------------------------------------------------