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

Commit bf9a49a2 authored by Peiyong Lin's avatar Peiyong Lin Committed by Android (Google) Code Review
Browse files

Merge "Eliminate the usage of ConfigStore in native/libs/gui."

parents 178679db 4f3fddf2
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -142,8 +142,6 @@ cc_library_shared {
        "libhidltransport",
        "android.hidl.token@1.0-utils",
        "android.hardware.graphics.bufferqueue@1.0",
        "android.hardware.configstore@1.0",
        "android.hardware.configstore-utils",
    ],

    // bufferhub is not used when building libgui for vendors
+35 −0
Original line number Diff line number Diff line
@@ -731,6 +731,26 @@ public:

        return remote()->transact(BnSurfaceComposer::UNCACHE_BUFFER, data, &reply);
    }

    virtual status_t isWideColorDisplay(const sp<IBinder>& token,
                                        bool* outIsWideColorDisplay) const {
        Parcel data, reply;
        status_t error = data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
        if (error != NO_ERROR) {
            return error;
        }
        error = data.writeStrongBinder(token);
        if (error != NO_ERROR) {
            return error;
        }

        error = remote()->transact(BnSurfaceComposer::IS_WIDE_COLOR_DISPLAY, data, &reply);
        if (error != NO_ERROR) {
            return error;
        }
        error = reply.readBool(outIsWideColorDisplay);
        return error;
    }
};

// Out-of-line virtual method definition to trigger vtable emission in this
@@ -1167,6 +1187,7 @@ status_t BnSurfaceComposer::onTransact(
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            bool result;
            status_t error = getProtectedContentSupport(&result);
            reply->writeInt32(error);
            if (error == NO_ERROR) {
                reply->writeBool(result);
            }
@@ -1214,6 +1235,20 @@ status_t BnSurfaceComposer::onTransact(

            return uncacheBuffer(token, bufferId);
        }
        case IS_WIDE_COLOR_DISPLAY: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IBinder> display = nullptr;
            status_t error = data.readStrongBinder(&display);
            if (error != NO_ERROR) {
                return error;
            }
            bool result;
            error = isWideColorDisplay(display, &result);
            if (error == NO_ERROR) {
                reply->writeBool(result);
            }
            return error;
        }
        default: {
            return BBinder::onTransact(code, data, reply, flags);
        }
+2 −32
Original line number Diff line number Diff line
@@ -39,9 +39,6 @@
#include <gui/ISurfaceComposer.h>
#include <private/gui/ComposerService.h>

#include <android/hardware/configstore/1.0/ISurfaceFlingerConfigs.h>
#include <configstore/Utils.h>

namespace android {

using ui::ColorMode;
@@ -321,41 +318,14 @@ status_t Surface::getFrameTimestamps(uint64_t frameNumber,
    return NO_ERROR;
}

using namespace android::hardware::configstore;
using namespace android::hardware::configstore::V1_0;

status_t Surface::getWideColorSupport(bool* supported) {
    ATRACE_CALL();

    sp<IBinder> display(
        composerService()->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain));
    Vector<ColorMode> colorModes;
    status_t err =
        composerService()->getDisplayColorModes(display, &colorModes);

    if (err)
        return err;

    bool wideColorBoardConfig =
        getBool<ISurfaceFlingerConfigs,
                &ISurfaceFlingerConfigs::hasWideColorDisplay>(false);

    *supported = false;
    for (ColorMode colorMode : colorModes) {
        switch (colorMode) {
            case ColorMode::DISPLAY_P3:
            case ColorMode::ADOBE_RGB:
            case ColorMode::DCI_P3:
                if (wideColorBoardConfig) {
                    *supported = true;
                }
                break;
            default:
                break;
        }
    }

    return NO_ERROR;
    status_t error = composerService()->isWideColorDisplay(display, supported);
    return error;
}

status_t Surface::getHdrSupport(bool* supported) {
+6 −0
Original line number Diff line number Diff line
@@ -1363,6 +1363,12 @@ status_t SurfaceComposerClient::getDisplayedContentSample(const sp<IBinder>& dis
                                                                            timestamp, outStats);
}

status_t SurfaceComposerClient::isWideColorDisplay(const sp<IBinder>& display,
                                                   bool* outIsWideColorDisplay) {
    return ComposerService::getComposerService()->isWideColorDisplay(display,
                                                                     outIsWideColorDisplay);
}

// ----------------------------------------------------------------------------

status_t ScreenshotClient::capture(const sp<IBinder>& display, const ui::Dataspace reqDataSpace,
+9 −0
Original line number Diff line number Diff line
@@ -321,6 +321,13 @@ public:
                                 int32_t* outBufferId) = 0;

    virtual status_t uncacheBuffer(const sp<IBinder>& token, int32_t bufferId) = 0;

    /*
     * Queries whether the given display is a wide color display.
     * Requires the ACCESS_SURFACE_FLINGER permission.
     */
    virtual status_t isWideColorDisplay(const sp<IBinder>& token,
                                        bool* outIsWideColorDisplay) const = 0;
};

// ----------------------------------------------------------------------------
@@ -365,6 +372,8 @@ public:
        GET_PROTECTED_CONTENT_SUPPORT,
        CACHE_BUFFER,
        UNCACHE_BUFFER,
        IS_WIDE_COLOR_DISPLAY,
        // Always append new enum to the end.
    };

    virtual status_t onTransact(uint32_t code, const Parcel& data,
Loading