summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author rongliu <rongliu@google.com> 2018-03-14 12:26:23 -0700
committer rongliu <rongliu@google.com> 2018-03-26 11:41:00 -0700
commitcfb187b458858013453019f62c8cbf29a0a8d623 (patch)
tree49288abc4598e44fff78658a9f03315f0a1b32ce
parent5b769bdacb1b83bf12c9d1fbbe8b09008f99eb60 (diff)
Manual merge of ag/3738015 because of conflicts.
Conflicts are in layers.proto, LayerProtoParser.h and LayerProtoPraser.cpp as master has more fields in layer proto than pi-dev. Original cl: Pass correct window type and app id to hw composer. 1. Set -1 as default value for window type and app id. 2. When send layer information to hal, layers inherit type and app id from parent node when parent node has valid type/appId. 3. Add window type and app id to SurfaceFlinger dumpsys. Bug: 74622357 Test: Manual test. Several things verified: 1. Android settings layer, status bar layer, nav bar layer have valid window type and appId when start android settings. 2. Layers without buffer have window type -1 and app id -1. 3. When send layers to hal, Chrome SurfaceView layer inherit type and app id from its parent (MainActivity layer). Change-Id: I8d6ad274ca18b61d1bbf6b28f7def5160b55b1e7
-rw-r--r--libs/gui/ISurfaceComposerClient.cpp4
-rw-r--r--libs/gui/SurfaceComposerClient.cpp8
-rw-r--r--libs/gui/include/gui/ISurfaceComposerClient.h4
-rw-r--r--libs/gui/include/gui/SurfaceComposerClient.h8
-rw-r--r--services/surfaceflinger/Client.cpp8
-rw-r--r--services/surfaceflinger/Client.h2
-rw-r--r--services/surfaceflinger/Layer.cpp10
-rw-r--r--services/surfaceflinger/Layer.h6
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp2
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h2
-rw-r--r--services/surfaceflinger/layerproto/LayerProtoParser.cpp5
-rw-r--r--services/surfaceflinger/layerproto/include/layerproto/LayerProtoParser.h2
-rw-r--r--services/surfaceflinger/layerproto/layers.proto2
13 files changed, 37 insertions, 26 deletions
diff --git a/libs/gui/ISurfaceComposerClient.cpp b/libs/gui/ISurfaceComposerClient.cpp
index 679f44b57b..a6890eeb19 100644
--- a/libs/gui/ISurfaceComposerClient.cpp
+++ b/libs/gui/ISurfaceComposerClient.cpp
@@ -47,8 +47,8 @@ public:
~BpSurfaceComposerClient() override;
status_t createSurface(const String8& name, uint32_t width, uint32_t height, PixelFormat format,
- uint32_t flags, const sp<IBinder>& parent, uint32_t windowType,
- uint32_t ownerUid, sp<IBinder>* handle,
+ uint32_t flags, const sp<IBinder>& parent, int32_t windowType,
+ int32_t ownerUid, sp<IBinder>* handle,
sp<IGraphicBufferProducer>* gbp) override {
return callRemote<decltype(&ISurfaceComposerClient::createSurface)>(Tag::CREATE_SURFACE,
name, width, height,
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 38f0eb7422..3cf49d6723 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -609,8 +609,8 @@ sp<SurfaceControl> SurfaceComposerClient::createSurface(
PixelFormat format,
uint32_t flags,
SurfaceControl* parent,
- uint32_t windowType,
- uint32_t ownerUid)
+ int32_t windowType,
+ int32_t ownerUid)
{
sp<SurfaceControl> s;
createSurfaceChecked(name, w, h, format, &s, flags, parent, windowType, ownerUid);
@@ -625,8 +625,8 @@ status_t SurfaceComposerClient::createSurfaceChecked(
sp<SurfaceControl>* outSurface,
uint32_t flags,
SurfaceControl* parent,
- uint32_t windowType,
- uint32_t ownerUid)
+ int32_t windowType,
+ int32_t ownerUid)
{
sp<SurfaceControl> sur;
status_t err = NO_ERROR;
diff --git a/libs/gui/include/gui/ISurfaceComposerClient.h b/libs/gui/include/gui/ISurfaceComposerClient.h
index d5bbef25f8..8dfc99a4b7 100644
--- a/libs/gui/include/gui/ISurfaceComposerClient.h
+++ b/libs/gui/include/gui/ISurfaceComposerClient.h
@@ -49,8 +49,8 @@ public:
* Requires ACCESS_SURFACE_FLINGER permission
*/
virtual status_t createSurface(const String8& name, uint32_t w, uint32_t h, PixelFormat format,
- uint32_t flags, const sp<IBinder>& parent, uint32_t windowType,
- uint32_t ownerUid, sp<IBinder>* handle,
+ uint32_t flags, const sp<IBinder>& parent, int32_t windowType,
+ int32_t ownerUid, sp<IBinder>* handle,
sp<IGraphicBufferProducer>* gbp) = 0;
/*
diff --git a/libs/gui/include/gui/SurfaceComposerClient.h b/libs/gui/include/gui/SurfaceComposerClient.h
index 5ce20adb89..b45ce4f86c 100644
--- a/libs/gui/include/gui/SurfaceComposerClient.h
+++ b/libs/gui/include/gui/SurfaceComposerClient.h
@@ -111,8 +111,8 @@ public:
PixelFormat format, // pixel-format desired
uint32_t flags = 0, // usage flags
SurfaceControl* parent = nullptr, // parent
- uint32_t windowType = 0, // from WindowManager.java (STATUS_BAR, INPUT_METHOD, etc.)
- uint32_t ownerUid = 0 // UID of the task
+ int32_t windowType = -1, // from WindowManager.java (STATUS_BAR, INPUT_METHOD, etc.)
+ int32_t ownerUid = -1 // UID of the task
);
status_t createSurfaceChecked(
@@ -123,8 +123,8 @@ public:
sp<SurfaceControl>* outSurface,
uint32_t flags = 0, // usage flags
SurfaceControl* parent = nullptr, // parent
- uint32_t windowType = 0, // from WindowManager.java (STATUS_BAR, INPUT_METHOD, etc.)
- uint32_t ownerUid = 0 // UID of the task
+ int32_t windowType = -1, // from WindowManager.java (STATUS_BAR, INPUT_METHOD, etc.)
+ int32_t ownerUid = -1 // UID of the task
);
//! Create a virtual display
diff --git a/services/surfaceflinger/Client.cpp b/services/surfaceflinger/Client.cpp
index 0c9f0e21e1..c90024b863 100644
--- a/services/surfaceflinger/Client.cpp
+++ b/services/surfaceflinger/Client.cpp
@@ -143,7 +143,7 @@ status_t Client::onTransact(
status_t Client::createSurface(
const String8& name,
uint32_t w, uint32_t h, PixelFormat format, uint32_t flags,
- const sp<IBinder>& parentHandle, uint32_t windowType, uint32_t ownerUid,
+ const sp<IBinder>& parentHandle, int32_t windowType, int32_t ownerUid,
sp<IBinder>* handle,
sp<IGraphicBufferProducer>* gbp)
{
@@ -180,13 +180,13 @@ status_t Client::createSurface(
PixelFormat format;
uint32_t flags;
sp<Layer>* parent;
- uint32_t windowType;
- uint32_t ownerUid;
+ int32_t windowType;
+ int32_t ownerUid;
public:
MessageCreateLayer(SurfaceFlinger* flinger,
const String8& name, Client* client,
uint32_t w, uint32_t h, PixelFormat format, uint32_t flags,
- sp<IBinder>* handle, uint32_t windowType, uint32_t ownerUid,
+ sp<IBinder>* handle, int32_t windowType, int32_t ownerUid,
sp<IGraphicBufferProducer>* gbp,
sp<Layer>* parent)
: flinger(flinger), client(client),
diff --git a/services/surfaceflinger/Client.h b/services/surfaceflinger/Client.h
index 2aab28f37d..c7df9f780f 100644
--- a/services/surfaceflinger/Client.h
+++ b/services/surfaceflinger/Client.h
@@ -58,7 +58,7 @@ private:
virtual status_t createSurface(
const String8& name,
uint32_t w, uint32_t h,PixelFormat format, uint32_t flags,
- const sp<IBinder>& parent, uint32_t windowType, uint32_t ownerUid,
+ const sp<IBinder>& parent, int32_t windowType, int32_t ownerUid,
sp<IBinder>* handle,
sp<IGraphicBufferProducer>* gbp);
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index b072213102..c520f54c36 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -555,8 +555,10 @@ void Layer::setGeometry(const sp<const DisplayDevice>& displayDevice, uint32_t z
sp<Layer> parent = mDrawingParent.promote();
if (parent.get()) {
auto& parentState = parent->getDrawingState();
- type = parentState.type;
- appId = parentState.appId;
+ if (parentState.type >= 0 || parentState.appId >= 0) {
+ type = parentState.type;
+ appId = parentState.appId;
+ }
}
getBE().compositionInfo.hwc.type = type;
@@ -1378,7 +1380,7 @@ bool Layer::setOverrideScalingMode(int32_t scalingMode) {
return true;
}
-void Layer::setInfo(uint32_t type, uint32_t appId) {
+void Layer::setInfo(int32_t type, int32_t appId) {
mCurrentState.appId = appId;
mCurrentState.type = type;
mCurrentState.modified = true;
@@ -1983,6 +1985,8 @@ void Layer::writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet)
layerInfo->set_queued_frames(getQueuedFrameCount());
layerInfo->set_refresh_pending(isBufferLatched());
+ layerInfo->set_window_type(state.type);
+ layerInfo->set_app_id(state.appId);
}
void Layer::writeToProto(LayerProto* layerInfo, int32_t hwcId) {
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 87f9489fa2..029f8acf1e 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -146,8 +146,8 @@ public:
Region requestedTransparentRegion;
android_dataspace dataSpace;
- uint32_t appId;
- uint32_t type;
+ int32_t appId;
+ int32_t type;
// If non-null, a Surface this Surface's Z-order is interpreted relative to.
wp<Layer> zOrderRelativeOf;
@@ -228,7 +228,7 @@ public:
void deferTransactionUntil(const sp<IBinder>& barrierHandle, uint64_t frameNumber);
void deferTransactionUntil(const sp<Layer>& barrierLayer, uint64_t frameNumber);
bool setOverrideScalingMode(int32_t overrideScalingMode);
- void setInfo(uint32_t type, uint32_t appId);
+ void setInfo(int32_t type, int32_t appId);
bool reparentChildren(const sp<IBinder>& layer);
void reparentChildrenForDrawing(const sp<Layer>& layer);
bool reparent(const sp<IBinder>& newParentHandle);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 4d9643c5ae..4ea7beec9e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3353,7 +3353,7 @@ status_t SurfaceFlinger::createLayer(
const String8& name,
const sp<Client>& client,
uint32_t w, uint32_t h, PixelFormat format, uint32_t flags,
- uint32_t windowType, uint32_t ownerUid, sp<IBinder>* handle,
+ int32_t windowType, int32_t ownerUid, sp<IBinder>* handle,
sp<IGraphicBufferProducer>* gbp, sp<Layer>* parent)
{
if (int32_t(w|h) < 0) {
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index c7ffea7327..3b807569b4 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -491,7 +491,7 @@ private:
*/
status_t createLayer(const String8& name, const sp<Client>& client,
uint32_t w, uint32_t h, PixelFormat format, uint32_t flags,
- uint32_t windowType, uint32_t ownerUid, sp<IBinder>* handle,
+ int32_t windowType, int32_t ownerUid, sp<IBinder>* handle,
sp<IGraphicBufferProducer>* gbp, sp<Layer>* parent);
status_t createBufferLayer(const sp<Client>& client, const String8& name,
diff --git a/services/surfaceflinger/layerproto/LayerProtoParser.cpp b/services/surfaceflinger/layerproto/LayerProtoParser.cpp
index 7483abde45..e4545e4494 100644
--- a/services/surfaceflinger/layerproto/LayerProtoParser.cpp
+++ b/services/surfaceflinger/layerproto/LayerProtoParser.cpp
@@ -118,6 +118,8 @@ LayerProtoParser::Layer* LayerProtoParser::generateLayer(const LayerProto& layer
layer->hwcFrame = generateRect(layerProto.hwc_frame());
layer->hwcCrop = generateFloatRect(layerProto.hwc_crop());
layer->hwcTransform = layerProto.hwc_transform();
+ layer->windowType = layerProto.window_type();
+ layer->appId = layerProto.app_id();
return layer;
}
@@ -309,7 +311,8 @@ std::string LayerProtoParser::Layer::to_string() const {
StringAppendF(&result, " zOrderRelativeOf=%s\n",
zOrderRelativeOf == nullptr ? "none" : zOrderRelativeOf->name.c_str());
StringAppendF(&result, " activeBuffer=%s,", activeBuffer.to_string().c_str());
- StringAppendF(&result, " queued-frames=%d, mRefreshPending=%d", queuedFrames, refreshPending);
+ StringAppendF(&result, " queued-frames=%d, mRefreshPending=%d,", queuedFrames, refreshPending);
+ StringAppendF(&result, " windowType=%d, appId=%d", windowType, appId);
return result;
}
diff --git a/services/surfaceflinger/layerproto/include/layerproto/LayerProtoParser.h b/services/surfaceflinger/layerproto/include/layerproto/LayerProtoParser.h
index 474727567c..44663263c2 100644
--- a/services/surfaceflinger/layerproto/include/layerproto/LayerProtoParser.h
+++ b/services/surfaceflinger/layerproto/include/layerproto/LayerProtoParser.h
@@ -109,6 +109,8 @@ public:
LayerProtoParser::Rect hwcFrame;
LayerProtoParser::FloatRect hwcCrop;
int32_t hwcTransform;
+ int32_t windowType;
+ int32_t appId;
std::string to_string() const;
};
diff --git a/services/surfaceflinger/layerproto/layers.proto b/services/surfaceflinger/layerproto/layers.proto
index e232f055fc..6675aae797 100644
--- a/services/surfaceflinger/layerproto/layers.proto
+++ b/services/surfaceflinger/layerproto/layers.proto
@@ -71,6 +71,8 @@ message LayerProto {
optional FloatRectProto hwc_crop = 31;
// The layer's composer backend transform
optional int32 hwc_transform = 32;
+ optional int32 window_type = 33;
+ optional int32 app_id = 34;
}
message PositionProto {