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

Commit e04a8005 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Add a re-parent function to re-parent a specific child."

parents f47f71ba 06178941
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -45,6 +45,8 @@ status_t layer_state_t::write(Parcel& output) const
    output.writeInt32(overrideScalingMode);
    output.writeStrongBinder(IInterface::asBinder(barrierGbp));
    output.writeStrongBinder(relativeLayerHandle);
    output.writeStrongBinder(parentHandleForChild);
    output.writeStrongBinder(childHandle);
    output.write(transparentRegion);
    return NO_ERROR;
}
@@ -77,6 +79,8 @@ status_t layer_state_t::read(const Parcel& input)
    barrierGbp =
        interface_cast<IGraphicBufferProducer>(input.readStrongBinder());
    relativeLayerHandle = input.readStrongBinder();
    parentHandleForChild = input.readStrongBinder();
    childHandle = input.readStrongBinder();
    input.read(transparentRegion);
    return NO_ERROR;
}
+23 −0
Original line number Diff line number Diff line
@@ -176,6 +176,9 @@ public:
    status_t reparentChildren(const sp<SurfaceComposerClient>& client,
            const sp<IBinder>& id,
            const sp<IBinder>& newParentHandle);
    status_t reparentChild(const sp<SurfaceComposerClient>& client,
            const sp<IBinder>& id, const sp<IBinder>& newParentHandle,
            const sp<IBinder>& childHandle);
    status_t detachChildren(const sp<SurfaceComposerClient>& client,
            const sp<IBinder>& id);
    status_t setOverrideScalingMode(const sp<SurfaceComposerClient>& client,
@@ -493,6 +496,21 @@ status_t Composer::reparentChildren(
    return NO_ERROR;
}

status_t Composer::reparentChild(const sp<SurfaceComposerClient>& client,
        const sp<IBinder>& id,
        const sp<IBinder>& newParentHandle,
        const sp<IBinder>& childHandle) {
    Mutex::Autolock lock(mLock);
    layer_state_t* s = getLayerStateLocked(client, id);
    if (!s) {
        return BAD_INDEX;
    }
    s->what |= layer_state_t::eReparentChild;
    s->parentHandleForChild = newParentHandle;
    s->childHandle = childHandle;
    return NO_ERROR;
}

status_t Composer::detachChildren(
        const sp<SurfaceComposerClient>& client,
        const sp<IBinder>& id) {
@@ -831,6 +849,11 @@ status_t SurfaceComposerClient::reparentChildren(const sp<IBinder>& id,
    return getComposer().reparentChildren(this, id, newParentHandle);
}

status_t SurfaceComposerClient::reparentChild(const sp<IBinder>& id,
        const sp<IBinder>& newParentHandle, const sp<IBinder>& childHandle) {
    return getComposer().reparentChild(this, id, newParentHandle, childHandle);
}

status_t SurfaceComposerClient::detachChildren(const sp<IBinder>& id) {
    return getComposer().detachChildren(this, id);
}
+7 −0
Original line number Diff line number Diff line
@@ -191,6 +191,13 @@ status_t SurfaceControl::reparentChildren(const sp<IBinder>& newParentHandle) {
    return mClient->reparentChildren(mHandle, newParentHandle);
}

status_t SurfaceControl::reparentChild(const sp<IBinder>& newParentHandle,
        const sp<IBinder>& childHandle) {
    status_t err = validate();
    if (err < 0) return err;
    return mClient->reparentChild(mHandle, newParentHandle, childHandle);
}

status_t SurfaceControl::detachChildren() {
    status_t err = validate();
    if (err < 0) return err;
+2 −0
Original line number Diff line number Diff line
@@ -161,6 +161,8 @@ public:
            const sp<Surface>& handle, uint64_t frameNumber);
    status_t    reparentChildren(const sp<IBinder>& id,
            const sp<IBinder>& newParentHandle);
    status_t    reparentChild(const sp<IBinder>& id, const sp<IBinder>& newParentHandle,
            const sp<IBinder>& childHandle);
    status_t    detachChildren(const sp<IBinder>& id);
    status_t    setOverrideScalingMode(const sp<IBinder>& id,
            int32_t overrideScalingMode);
+6 −0
Original line number Diff line number Diff line
@@ -124,6 +124,12 @@ public:
    // Reparents all children of this layer to the new parent handle.
    status_t reparentChildren(const sp<IBinder>& newParentHandle);

    // Reparents a specified child from this layer to the new parent handle.
    // The child, parent, and new parent must all have the same client.
    // This can be used instead of reparentChildren if the caller wants to
    // only re-parent specific children.
    status_t reparentChild(const sp<IBinder>& newParentHandle, const sp<IBinder>& childHandle);

    // Detaches all child surfaces (and their children recursively)
    // from their SurfaceControl.
    // The child SurfaceControl's will not throw exceptions or return errors,
Loading