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

Commit 7dcda801 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SurfaceFlinger: Add parent-less relative layering." into oc-dev

parents a30e1cbf db66e627
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ 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, int32_t layer);
    status_t    setRelativeLayer(const sp<IBinder>& id,
            const sp<IBinder>& relativeTo, int32_t layer);
    status_t    setAlpha(const sp<IBinder>& id, float alpha=1.0f);
    status_t    setMatrix(const sp<IBinder>& id, float dsdx, float dtdx, float dtdy, float dsdy);
    status_t    setPosition(const sp<IBinder>& id, float x, float y);
+21 −0
Original line number Diff line number Diff line
@@ -62,6 +62,27 @@ public:

    status_t    setLayerStack(uint32_t layerStack);
    status_t    setLayer(int32_t layer);

    // Sets a Z order relative to the Surface specified by "relativeTo" but
    // without becoming a full child of the relative. Z-ordering works exactly
    // as if it were a child however.
    //
    // As a nod to sanity, only non-child surfaces may have a relative Z-order.
    //
    // This overrides any previous and is overriden by any future calls
    // to setLayer.
    //
    // If the relative dissapears, the Surface will have no layer and be
    // invisible, until the next time set(Relative)Layer is called.
    //
    // TODO: This is probably a hack. Currently it exists only to work around
    // some framework usage of the hidden APPLICATION_MEDIA_OVERLAY window type
    // which allows inserting a window between a SurfaceView and it's main application
    // window. However, since we are using child windows for the SurfaceView, but not using
    // child windows elsewhere in O, the WindowManager can't set the layer appropriately.
    // This is only used by the "TvInputService" and following the port of ViewRootImpl
    // to child surfaces, we can then port this and remove this method.
    status_t    setRelativeLayer(const sp<IBinder>& relativeTo, int32_t layer);
    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
@@ -58,7 +58,8 @@ struct layer_state_t {
        eOverrideScalingModeChanged = 0x00000800,
        eGeometryAppliesWithResize  = 0x00001000,
        eReparentChildren           = 0x00002000,
        eDetachChildren             = 0x00004000
        eDetachChildren             = 0x00004000,
        eRelativeLayerChanged       = 0x00008000
    };

    layer_state_t()
@@ -104,6 +105,8 @@ struct layer_state_t {

            sp<IGraphicBufferProducer> barrierGbp;

            sp<IBinder>     relativeLayerHandle;

            // non POD must be last. see write/read
            Region          transparentRegion;
};
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ status_t layer_state_t::write(Parcel& output) const
    output.writeUint64(frameNumber);
    output.writeInt32(overrideScalingMode);
    output.writeStrongBinder(IInterface::asBinder(barrierGbp));
    output.writeStrongBinder(relativeLayerHandle);
    output.write(transparentRegion);
    return NO_ERROR;
}
@@ -75,6 +76,7 @@ status_t layer_state_t::read(const Parcel& input)
    overrideScalingMode = input.readInt32();
    barrierGbp =
        interface_cast<IGraphicBufferProducer>(input.readStrongBinder());
    relativeLayerHandle = input.readStrongBinder();
    input.read(transparentRegion);
    return NO_ERROR;
}
+21 −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,
            int32_t z);
    status_t setRelativeLayer(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
            const sp<IBinder>& relativeTo, int32_t z);
    status_t setFlags(const sp<SurfaceComposerClient>& client, const sp<IBinder>& id,
            uint32_t flags, uint32_t mask);
    status_t setTransparentRegionHint(
@@ -343,6 +345,20 @@ status_t Composer::setLayer(const sp<SurfaceComposerClient>& client,
    return NO_ERROR;
}

status_t Composer::setRelativeLayer(const sp<SurfaceComposerClient>& client,
        const sp<IBinder>& id, const sp<IBinder>& relativeTo,
        int32_t z) {
    Mutex::Autolock _l(mLock);
    layer_state_t* s = getLayerStateLocked(client, id);
    if (!s) {
        return BAD_INDEX;
    }
    s->what |= layer_state_t::eRelativeLayerChanged;
    s->relativeLayerHandle = relativeTo;
    s->z = z;
    return NO_ERROR;
}

status_t Composer::setFlags(const sp<SurfaceComposerClient>& client,
        const sp<IBinder>& id, uint32_t flags,
        uint32_t mask) {
@@ -760,6 +776,11 @@ status_t SurfaceComposerClient::setLayer(const sp<IBinder>& id, int32_t z) {
    return getComposer().setLayer(this, id, z);
}

status_t SurfaceComposerClient::setRelativeLayer(const sp<IBinder>& id,
        const sp<IBinder>& relativeTo, int32_t z) {
    return getComposer().setRelativeLayer(this, id, relativeTo, z);
}

status_t SurfaceComposerClient::hide(const sp<IBinder>& id) {
    return getComposer().setFlags(this, id,
            layer_state_t::eLayerHidden,
Loading