Provide layer id on surface creation

Allows for the layer state to be dumped on the client side with the layer's id so that they can then be associated with the respective layer dumped on the server side

Test: Check that the layer ID is provided on the client side when createSurface is called
Change-Id: I7ea851942c43fc48326bb8558a605ba6877600da
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 3e93e2f..524f4c6 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3836,7 +3836,7 @@
 }
 
 status_t SurfaceFlinger::mirrorLayer(const sp<Client>& client, const sp<IBinder>& mirrorFromHandle,
-                                     sp<IBinder>* outHandle) {
+                                     sp<IBinder>* outHandle, int32_t* outId) {
     if (!mirrorFromHandle) {
         return NAME_NOT_FOUND;
     }
@@ -3861,6 +3861,7 @@
         mirrorLayer->mClonedChild = mirrorFrom->createClone();
     }
 
+    *outId = mirrorLayer->sequence;
     return addClientLayer(client, *outHandle, nullptr, mirrorLayer, nullptr, nullptr, false,
                           nullptr /* outTransformHint */);
 }
@@ -3870,7 +3871,7 @@
                                      LayerMetadata metadata, sp<IBinder>* handle,
                                      sp<IGraphicBufferProducer>* gbp,
                                      const sp<IBinder>& parentHandle, const sp<Layer>& parentLayer,
-                                     uint32_t* outTransformHint) {
+                                     int32_t* outId, uint32_t* outTransformHint) {
     if (int32_t(w|h) < 0) {
         ALOGE("createLayer() failed, w or h is negative (w=%d, h=%d)",
                 int(w), int(h));
@@ -3936,6 +3937,7 @@
     mInterceptor->saveSurfaceCreation(layer);
 
     setTransactionFlags(eTransactionNeeded);
+    *outId = layer->sequence;
     return result;
 }