VR: Add API to plumb surface type and owner through to SurfaceFlinger
This is a cherry-pick of
https://googleplex-android-review.git.corp.google.com/c/1648886/
Test: None
Bug: None
Change-Id: I338c84c2576ab85fa4f6d8e759c9e7ce912cdd61
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index d1c576e..3949186 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -42,6 +42,8 @@
output.writeStrongBinder(handle);
output.writeUint64(frameNumber);
output.writeInt32(overrideScalingMode);
+ output.writeUint32(type);
+ output.writeUint32(appid);
output.write(transparentRegion);
return NO_ERROR;
}
@@ -70,6 +72,8 @@
handle = input.readStrongBinder();
frameNumber = input.readUint64();
overrideScalingMode = input.readInt32();
+ type = input.readUint32();
+ appid = input.readUint32();
input.read(transparentRegion);
return NO_ERROR;
}
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 58b2a87..3346a83 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -149,6 +149,8 @@
uint32_t w, uint32_t h);
status_t setLayer(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
uint32_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(
@@ -335,6 +337,18 @@
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) {
@@ -704,6 +718,10 @@
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,
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index 33c1d90..b47e434 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -107,6 +107,11 @@
if (err < 0) return err;
return mClient->setLayer(mHandle, layer);
}
+status_t SurfaceControl::setLayerInfo(uint32_t type, uint32_t appid) {
+ status_t err = validate();
+ if (err < 0) return err;
+ return mClient->setLayerInfo(mHandle, type, appid);
+}
status_t SurfaceControl::setPosition(float x, float y) {
status_t err = validate();
if (err < 0) return err;