Refactor how layer metadata for use by VR is propagated
from WindowManager based on feedback in frameworks/base.

Since windowType and ownerUid are immutable, they are sent
on creation instead of separate IPC.

Bug: 30984984
Test: built locally

Change-Id: I380b3cdcf6aec471fc23f1e27846ab80492e8add
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index ece07a3..ae81c8f 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -149,8 +149,6 @@
             uint32_t w, uint32_t h);
     status_t setLayer(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
             int32_t z);
-    status_t setLayerInfo(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
-            uint32_t type, uint32_t appid);
     status_t setFlags(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
             uint32_t flags, uint32_t mask);
     status_t setTransparentRegionHint(
@@ -340,18 +338,6 @@
     return NO_ERROR;
 }
 
-status_t Composer::setLayerInfo(const sp<SurfaceComposerClient>& client,
-        const sp<IBinder>& id, uint32_t type, uint32_t appid) {
-    Mutex::Autolock _l(mLock);
-    layer_state_t* s = getLayerStateLocked(client, id);
-    if (!s)
-        return BAD_INDEX;
-    s->what |= layer_state_t::eLayerInfoChanged;
-    s->type = type;
-    s->appid = appid;
-    return NO_ERROR;
-}
-
 status_t Composer::setFlags(const sp<SurfaceComposerClient>& client,
         const sp<IBinder>& id, uint32_t flags,
         uint32_t mask) {
@@ -636,7 +622,9 @@
         uint32_t h,
         PixelFormat format,
         uint32_t flags,
-        SurfaceControl* parent)
+        SurfaceControl* parent,
+        uint32_t windowType,
+        uint32_t ownerUid)
 {
     sp<SurfaceControl> sur;
     if (mStatus == NO_ERROR) {
@@ -648,7 +636,7 @@
             parentHandle = parent->getHandle();
         }
         status_t err = mClient->createSurface(name, w, h, format, flags, parentHandle,
-                &handle, &gbp);
+                windowType, ownerUid, &handle, &gbp);
         ALOGE_IF(err, "SurfaceComposerClient::createSurface error %s", strerror(-err));
         if (err == NO_ERROR) {
             sur = new SurfaceControl(this, handle, gbp);
@@ -749,10 +737,6 @@
     return getComposer().setLayer(this, id, z);
 }
 
-status_t SurfaceComposerClient::setLayerInfo(const sp<IBinder>& id, uint32_t type, uint32_t appid) {
-    return getComposer().setLayerInfo(this, id, type, appid);
-}
-
 status_t SurfaceComposerClient::hide(const sp<IBinder>& id) {
     return getComposer().setFlags(this, id,
             layer_state_t::eLayerHidden,