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

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

Merge "SurfaceFlinger: add explicit register for DISPLAY_EVENT_CONFIG_CHANGED" into qt-r1-dev

parents e05c5a09 0f4a1b19
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -32,10 +32,11 @@ namespace android {


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


DisplayEventReceiver::DisplayEventReceiver(ISurfaceComposer::VsyncSource vsyncSource) {
DisplayEventReceiver::DisplayEventReceiver(ISurfaceComposer::VsyncSource vsyncSource,
                                           ISurfaceComposer::ConfigChanged configChanged) {
    sp<ISurfaceComposer> sf(ComposerService::getComposerService());
    sp<ISurfaceComposer> sf(ComposerService::getComposerService());
    if (sf != nullptr) {
    if (sf != nullptr) {
        mEventConnection = sf->createDisplayEventConnection(vsyncSource);
        mEventConnection = sf->createDisplayEventConnection(vsyncSource, configChanged);
        if (mEventConnection != nullptr) {
        if (mEventConnection != nullptr) {
            mDataChannel = std::make_unique<gui::BitTube>();
            mDataChannel = std::make_unique<gui::BitTube>();
            mEventConnection->stealReceiveChannel(mDataChannel.get());
            mEventConnection->stealReceiveChannel(mDataChannel.get());
+8 −4
Original line number Original line Diff line number Diff line
@@ -278,8 +278,8 @@ public:
        return NO_ERROR;
        return NO_ERROR;
    }
    }


    virtual sp<IDisplayEventConnection> createDisplayEventConnection(VsyncSource vsyncSource)
    virtual sp<IDisplayEventConnection> createDisplayEventConnection(VsyncSource vsyncSource,
    {
                                                                     ConfigChanged configChanged) {
        Parcel data, reply;
        Parcel data, reply;
        sp<IDisplayEventConnection> result;
        sp<IDisplayEventConnection> result;
        int err = data.writeInterfaceToken(
        int err = data.writeInterfaceToken(
@@ -288,6 +288,7 @@ public:
            return result;
            return result;
        }
        }
        data.writeInt32(static_cast<int32_t>(vsyncSource));
        data.writeInt32(static_cast<int32_t>(vsyncSource));
        data.writeInt32(static_cast<int32_t>(configChanged));
        err = remote()->transact(
        err = remote()->transact(
                BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION,
                BnSurfaceComposer::CREATE_DISPLAY_EVENT_CONNECTION,
                data, &reply);
                data, &reply);
@@ -1155,8 +1156,11 @@ status_t BnSurfaceComposer::onTransact(
        }
        }
        case CREATE_DISPLAY_EVENT_CONNECTION: {
        case CREATE_DISPLAY_EVENT_CONNECTION: {
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            CHECK_INTERFACE(ISurfaceComposer, data, reply);
            sp<IDisplayEventConnection> connection(createDisplayEventConnection(
            auto vsyncSource = static_cast<ISurfaceComposer::VsyncSource>(data.readInt32());
                    static_cast<ISurfaceComposer::VsyncSource>(data.readInt32())));
            auto configChanged = static_cast<ISurfaceComposer::ConfigChanged>(data.readInt32());

            sp<IDisplayEventConnection> connection(
                    createDisplayEventConnection(vsyncSource, configChanged));
            reply->writeStrongBinder(IInterface::asBinder(connection));
            reply->writeStrongBinder(IInterface::asBinder(connection));
            return NO_ERROR;
            return NO_ERROR;
        }
        }
+4 −1
Original line number Original line Diff line number Diff line
@@ -88,10 +88,13 @@ public:
     * DisplayEventReceiver creates and registers an event connection with
     * DisplayEventReceiver creates and registers an event connection with
     * SurfaceFlinger. VSync events are disabled by default. Call setVSyncRate
     * SurfaceFlinger. VSync events are disabled by default. Call setVSyncRate
     * or requestNextVsync to receive them.
     * or requestNextVsync to receive them.
     * To receive Config Changed events specify this in the constructor.
     * Other events start being delivered immediately.
     * Other events start being delivered immediately.
     */
     */
    explicit DisplayEventReceiver(
    explicit DisplayEventReceiver(
            ISurfaceComposer::VsyncSource vsyncSource = ISurfaceComposer::eVsyncSourceApp);
            ISurfaceComposer::VsyncSource vsyncSource = ISurfaceComposer::eVsyncSourceApp,
            ISurfaceComposer::ConfigChanged configChanged =
                    ISurfaceComposer::eConfigChangedSuppress);


    /*
    /*
     * ~DisplayEventReceiver severs the connection with SurfaceFlinger, new events
     * ~DisplayEventReceiver severs the connection with SurfaceFlinger, new events
+4 −1
Original line number Original line Diff line number Diff line
@@ -90,6 +90,8 @@ public:
        eVsyncSourceSurfaceFlinger = 1
        eVsyncSourceSurfaceFlinger = 1
    };
    };


    enum ConfigChanged { eConfigChangedSuppress = 0, eConfigChangedDispatch = 1 };

    /*
    /*
     * Create a connection with SurfaceFlinger.
     * Create a connection with SurfaceFlinger.
     */
     */
@@ -97,7 +99,8 @@ public:


    /* return an IDisplayEventConnection */
    /* return an IDisplayEventConnection */
    virtual sp<IDisplayEventConnection> createDisplayEventConnection(
    virtual sp<IDisplayEventConnection> createDisplayEventConnection(
            VsyncSource vsyncSource = eVsyncSourceApp) = 0;
            VsyncSource vsyncSource = eVsyncSourceApp,
            ConfigChanged configChanged = eConfigChangedSuppress) = 0;


    /* create a virtual display
    /* create a virtual display
     * requires ACCESS_SURFACE_FLINGER permission.
     * requires ACCESS_SURFACE_FLINGER permission.
+2 −2
Original line number Original line Diff line number Diff line
@@ -548,8 +548,8 @@ public:
    }
    }


    sp<ISurfaceComposerClient> createConnection() override { return nullptr; }
    sp<ISurfaceComposerClient> createConnection() override { return nullptr; }
    sp<IDisplayEventConnection> createDisplayEventConnection(ISurfaceComposer::VsyncSource)
    sp<IDisplayEventConnection> createDisplayEventConnection(
            override {
            ISurfaceComposer::VsyncSource, ISurfaceComposer::ConfigChanged) override {
        return nullptr;
        return nullptr;
    }
    }
    sp<IBinder> createDisplay(const String8& /*displayName*/,
    sp<IBinder> createDisplay(const String8& /*displayName*/,
Loading