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

Commit af1e11b8 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

one step toward fixing [2501808] sapphire: OOM in GPU Surface area

when a surface was returned from a remote process through the binder we
would leak its resources until a GC happened.

implement writeToParcel to release the source when PARCELABLE_WRITE_RETURN_VALUE
is set

Change-Id: I6a9fa369b0d164a9ca1229b8a2944d3c132a3720
parent 1a26c9aa
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -35,6 +35,11 @@

namespace android {

enum {
    // should match Parcelable.java
    PARCELABLE_WRITE_RETURN_VALUE = 0x0001
};

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

static const char* const OutOfResourcesException =
@@ -612,6 +617,9 @@ static void Surface_writeToParcel(

    const sp<SurfaceControl>& control(getSurfaceControl(env, clazz));
    SurfaceControl::writeSurfaceToParcel(control, parcel);
    if (flags & PARCELABLE_WRITE_RETURN_VALUE) {
        setSurfaceControl(env, clazz, 0);
    }
}

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