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

Commit b21272e8 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Remove container layer

Change-Id: Ib7a58820134705746415b1007a1ae75f27331830
parent 29810f75
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -145,7 +145,6 @@ filegroup {
        "ClientCache.cpp",
        "Client.cpp",
        "EffectLayer.cpp",
        "ContainerLayer.cpp",
        "DisplayDevice.cpp",
        "DisplayHardware/AidlComposerHal.cpp",
        "DisplayHardware/HidlComposerHal.cpp",
+0 −47
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wconversion"

// #define LOG_NDEBUG 0
#undef LOG_TAG
#define LOG_TAG "ContainerLayer"

#include "ContainerLayer.h"

namespace android {

ContainerLayer::ContainerLayer(const LayerCreationArgs& args) : Layer(args) {}

ContainerLayer::~ContainerLayer() = default;

bool ContainerLayer::isVisible() const {
    return false;
}

sp<Layer> ContainerLayer::createClone() {
    sp<ContainerLayer> layer = mFlinger->getFactory().createContainerLayer(
            LayerCreationArgs(mFlinger.get(), nullptr, mName + " (Mirror)", 0, LayerMetadata()));
    layer->setInitialValuesForClone(this);
    return layer;
}

} // namespace android

// TODO(b/129481165): remove the #pragma below and fix conversion issues
#pragma clang diagnostic pop // ignored "-Wconversion"
+0 −41
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#pragma once

#include <sys/types.h>

#include <cstdint>

#include "Layer.h"

namespace android {

class ContainerLayer : public Layer {
public:
    explicit ContainerLayer(const LayerCreationArgs&);
    ~ContainerLayer() override;

    const char* getType() const override { return "ContainerLayer"; }
    bool isVisible() const override;

    bool isCreatedFromMainThread() const override { return true; }

protected:
    bool canDrawShadows() const override { return false; }
    sp<Layer> createClone() override;
};

} // namespace android
+4 −3
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@
#include <ui/GraphicTypes.h>
#include <ui/Transform.h>

#include "ContainerLayer.h"
#include "DisplayDevice.h"
#include "EffectLayer.h"
#include "Layer.h"
#include "LayerRenderArea.h"
#include "SurfaceFlinger.h"
@@ -110,8 +110,9 @@ void LayerRenderArea::render(std::function<void()> drawLayers) {
        // layer which has no properties set and which does not draw.
        //  We hold the statelock as the reparent-for-drawing operation modifies the
        //  hierarchy and there could be readers on Binder threads, like dump.
        sp<ContainerLayer> screenshotParentLayer = mFlinger.getFactory().createContainerLayer(
                  {&mFlinger, nullptr, "Screenshot Parent"s, 0, LayerMetadata()});
        sp<EffectLayer> screenshotParentLayer = mFlinger.getFactory().createEffectLayer(
                {&mFlinger, nullptr, "Screenshot Parent"s, ISurfaceComposerClient::eNoColorFill,
                 LayerMetadata()});
        {
            Mutex::Autolock _l(mFlinger.mStateLock);
            reparentForDrawing(mLayer, screenshotParentLayer, sourceCrop);
+3 −9
Original line number Diff line number Diff line
@@ -108,7 +108,6 @@
#include "BufferStateLayer.h"
#include "Client.h"
#include "Colorizer.h"
#include "ContainerLayer.h"
#include "DisplayDevice.h"
#include "DisplayHardware/ComposerHal.h"
#include "DisplayHardware/FramebufferSurface.h"
@@ -4584,7 +4583,9 @@ status_t SurfaceFlinger::mirrorLayer(const LayerCreationArgs& args,
        if (!mirrorFrom) {
            return NAME_NOT_FOUND;
        }
        status_t result = createContainerLayer(args, outHandle, &mirrorLayer);
        LayerCreationArgs mirrorArgs = args;
        mirrorArgs.flags |= ISurfaceComposerClient::eNoColorFill;
        status_t result = createEffectLayer(mirrorArgs, outHandle, &mirrorLayer);
        if (result != NO_ERROR) {
            return result;
        }
@@ -4684,13 +4685,6 @@ status_t SurfaceFlinger::createEffectLayer(const LayerCreationArgs& args, sp<IBi
    return NO_ERROR;
}

status_t SurfaceFlinger::createContainerLayer(const LayerCreationArgs& args, sp<IBinder>* handle,
                                              sp<Layer>* outLayer) {
    *outLayer = getFactory().createContainerLayer(args);
    *handle = (*outLayer)->getHandle();
    return NO_ERROR;
}

void SurfaceFlinger::markLayerPendingRemovalLocked(const sp<Layer>& layer) {
    mLayersPendingRemoval.add(layer);
    mLayersRemoved = true;
Loading