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

Commit 563888b0 authored by Alan Ding's avatar Alan Ding
Browse files

screenrecord: Cleanup SF APIs for creating / destroying virtual display

Follow-up CL for cleanup requested by SF owner in http://ag/27202517.
Use static const for compile-time efficiency.

Bug: 339525838
Bug: 137375833
Bug: 194863377
Test: atest libsurfaceflinger_unittest
Change-Id: Idc599f877de0c352bc759ba0b61dafc226093117
parent 7f97aa65
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -362,8 +362,8 @@ static status_t prepareVirtualDisplay(
        const ui::DisplayState& displayState,
        const sp<IGraphicBufferProducer>& bufferProducer,
        sp<IBinder>* pDisplayHandle, sp<SurfaceControl>* mirrorRoot) {
    sp<IBinder> dpy = SurfaceComposerClient::createDisplay(
            String8("ScreenRecorder"), gSecureDisplay);
    static const std::string kDisplayName("ScreenRecorder");
    sp<IBinder> dpy = SurfaceComposerClient::createVirtualDisplay(kDisplayName, gSecureDisplay);
    SurfaceComposerClient::Transaction t;
    t.setDisplaySurface(dpy, bufferProducer);
    setDisplayProjection(t, dpy, displayState);
@@ -797,7 +797,7 @@ struct RecordingData {
    sp<Overlay> overlay;

    ~RecordingData() {
        if (dpy != nullptr) SurfaceComposerClient::destroyDisplay(dpy);
        if (dpy != nullptr) SurfaceComposerClient::destroyVirtualDisplay(dpy);
        if (overlay != nullptr) overlay->stop();
        if (encoder != nullptr) {
            encoder->stop();