Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6cf6af02 authored by Albert Chaulk's avatar Albert Chaulk Committed by Daniel Nicoara
Browse files

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
parent 146abf38
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ public:
    status_t    setFlags(const sp<IBinder>& id, uint32_t flags, uint32_t mask);
    status_t    setTransparentRegionHint(const sp<IBinder>& id, const Region& transparent);
    status_t    setLayer(const sp<IBinder>& id, uint32_t layer);
    status_t    setLayerInfo(const sp<IBinder>& id, uint32_t type, uint32_t appid);
    status_t    setAlpha(const sp<IBinder>& id, float alpha=1.0f);
    status_t    setMatrix(const sp<IBinder>& id, float dsdx, float dtdx, float dsdy, float dtdy);
    status_t    setPosition(const sp<IBinder>& id, float x, float y);
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public:

    status_t    setLayerStack(uint32_t layerStack);
    status_t    setLayer(uint32_t layer);
    status_t    setLayerInfo(uint32_t type, uint32_t appid);
    status_t    setPosition(float x, float y);
    status_t    setSize(uint32_t w, uint32_t h);
    status_t    hide();
+4 −1
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ struct layer_state_t {
        eFinalCropChanged           = 0x00000400,
        eOverrideScalingModeChanged = 0x00000800,
        eGeometryAppliesWithResize  = 0x00001000,
        eLayerInfoChanged           = 0x00002000,
    };

    layer_state_t()
@@ -64,7 +65,7 @@ struct layer_state_t {
            alpha(0), flags(0), mask(0),
            reserved(0), crop(Rect::INVALID_RECT),
            finalCrop(Rect::INVALID_RECT), frameNumber(0),
            overrideScalingMode(-1)
            overrideScalingMode(-1), type(0), appid(0)
    {
        matrix.dsdx = matrix.dtdy = 1.0f;
        matrix.dsdy = matrix.dtdx = 0.0f;
@@ -97,6 +98,8 @@ struct layer_state_t {
            sp<IBinder>     handle;
            uint64_t        frameNumber;
            int32_t         overrideScalingMode;
            uint32_t        type;
            uint32_t        appid;
            // non POD must be last. see write/read
            Region          transparentRegion;
};
+4 −0
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ status_t layer_state_t::write(Parcel& output) const
    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 @@ status_t layer_state_t::read(const Parcel& input)
    handle = input.readStrongBinder();
    frameNumber = input.readUint64();
    overrideScalingMode = input.readInt32();
    type = input.readUint32();
    appid = input.readUint32();
    input.read(transparentRegion);
    return NO_ERROR;
}
+18 −0
Original line number Diff line number Diff line
@@ -149,6 +149,8 @@ public:
            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 @@ status_t Composer::setLayer(const sp<SurfaceComposerClient>& client,
    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 @@ status_t SurfaceComposerClient::setLayer(const sp<IBinder>& id, uint32_t z) {
    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,
Loading