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

Commit 421036dd authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-f4ecf242-5d1c-45e0-8c7c-ede48d1a9e82-for-git_oc-release-411165...

release-request-f4ecf242-5d1c-45e0-8c7c-ede48d1a9e82-for-git_oc-release-4111650 snap-temp-L02200000075283731

Change-Id: Iee5ced44440d132836c4fd1df09ec6f7f9d36ed3
parents 913dd036 a17b14eb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ public:
            const sp<SurfaceControl>& control, Parcel* parcel);

    sp<Surface> getSurface() const;
    sp<Surface> createSurface() const;
    sp<IBinder> getHandle() const;

    status_t clearLayerFrameStats() const;
@@ -155,6 +156,7 @@ private:

    ~SurfaceControl();

    sp<Surface> generateSurfaceLocked() const;
    status_t validate() const;
    void destroy();

+16 −3
Original line number Diff line number Diff line
@@ -237,17 +237,30 @@ status_t SurfaceControl::writeSurfaceToParcel(
    return parcel->writeStrongBinder(IInterface::asBinder(bp));
}

sp<Surface> SurfaceControl::getSurface() const
sp<Surface> SurfaceControl::generateSurfaceLocked() const
{
    Mutex::Autolock _l(mLock);
    if (mSurfaceData == 0) {
    // This surface is always consumed by SurfaceFlinger, so the
    // producerControlledByApp value doesn't matter; using false.
    mSurfaceData = new Surface(mGraphicBufferProducer, false);

    return mSurfaceData;
}

sp<Surface> SurfaceControl::getSurface() const
{
    Mutex::Autolock _l(mLock);
    if (mSurfaceData == 0) {
        return generateSurfaceLocked();
    }
    return mSurfaceData;
}

sp<Surface> SurfaceControl::createSurface() const
{
    Mutex::Autolock _l(mLock);
    return generateSurfaceLocked();
}

sp<IBinder> SurfaceControl::getHandle() const
{
    Mutex::Autolock lock(mLock);
+15 −4
Original line number Diff line number Diff line
@@ -57,9 +57,19 @@ Client::~Client()
}

void Client::setParentLayer(const sp<Layer>& parentLayer) {
    Mutex::Autolock _l(mLock);
    mParentLayer = parentLayer;
}

sp<Layer> Client::getParentLayer(bool* outParentDied) const {
    Mutex::Autolock _l(mLock);
    sp<Layer> parent = mParentLayer.promote();
    if (outParentDied != nullptr) {
        *outParentDied = (mParentLayer != nullptr && parent == nullptr);
    }
    return parent;
}

status_t Client::initCheck() const {
    return NO_ERROR;
}
@@ -108,7 +118,7 @@ status_t Client::onTransact(
     // We grant an exception in the case that the Client has a "parent layer", as its
     // effects will be scoped to that layer.
     if (CC_UNLIKELY(pid != self_pid && uid != AID_GRAPHICS && uid != AID_SYSTEM && uid != 0)
             && (mParentLayer.promote() == nullptr)) {
             && (getParentLayer() == nullptr)) {
         // we're called from a different process, do the real check
         if (!PermissionCache::checkCallingPermission(sAccessSurfaceFlinger))
         {
@@ -135,11 +145,12 @@ status_t Client::createSurface(
            return NAME_NOT_FOUND;
        }
    }
    if (parent == nullptr && mParentLayer != nullptr) {
        parent = mParentLayer.promote();
    if (parent == nullptr) {
        bool parentDied;
        parent = getParentLayer(&parentDied);
        // If we had a parent, but it died, we've lost all
        // our capabilities.
        if (parent == nullptr) {
        if (parentDied) {
            return NAME_NOT_FOUND;
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -71,12 +71,13 @@ private:
    virtual status_t onTransact(
        uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags);

    sp<Layer> getParentLayer(bool* outParentDied = nullptr) const;

    // constant
    sp<SurfaceFlinger> mFlinger;

    // protected by mLock
    DefaultKeyedVector< wp<IBinder>, wp<Layer> > mLayers;

    wp<Layer> mParentLayer;

    // thread-safe
+4 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <map>

namespace android {
    class Fence;
@@ -283,7 +284,9 @@ private:
    bool mIsConnected;
    DisplayType mType;
    std::unordered_map<hwc2_layer_t, std::weak_ptr<Layer>> mLayers;
    std::unordered_map<hwc2_config_t, std::shared_ptr<const Config>> mConfigs;
    // The ordering in this map matters, for getConfigs(), when it is
    // converted to a vector
    std::map<hwc2_config_t, std::shared_ptr<const Config>> mConfigs;
};

// Convenience C++ class to access hwc2_device_t Layer functions directly.
Loading