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

Commit 6517ae69 authored by Michael Wachenschwanz's avatar Michael Wachenschwanz Committed by android-build-merger
Browse files

Merge "WTF Logging for catching memory issue in Parcel" into oc-dev am: 92543221

am: c7373d1f

Change-Id: If27d23f8423337bf7c9290d9e00a55fb021679ff
parents d7637ece c7373d1f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -427,7 +427,13 @@ public final class Parcel {
     * @param size The new number of bytes in the Parcel.
     */
    public final void setDataSize(int size) {
        // STOPSHIP: Try/catch for exception is for temporary debug. Remove once bug resolved
        try {
            updateNativeSize(nativeSetDataSize(mNativePtr, size));
        } catch (IllegalArgumentException iae) {
            Log.e(TAG,"Caught Exception representing a known bug in Parcel",iae);
            Log.wtfStack(TAG, "This flow is using SetDataSize incorrectly");
        }
    }

    /**
+5 −1
Original line number Diff line number Diff line
@@ -119,7 +119,11 @@ static jlong android_os_Parcel_setDataSize(JNIEnv* env, jclass clazz, jlong nati
    Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
    if (parcel != NULL) {
        const status_t err = parcel->setDataSize(size);
        if (err != NO_ERROR) {
        //STOPSHIP: check for BADFLO is for a temporary debug using wtf. Remove once bug resolved.
        if (err == UNKNOWN_ERROR + 0xBADF10) {
            jniThrowExceptionFmt(env, "java/lang/IllegalArgumentException",
                         "Attempt to resize (size = %d) Parcel would corrupt object memory", size);
        } else if (err != NO_ERROR) {
            signalExceptionForError(env, clazz, err);
        }
        return parcel->getOpenAshmemSize();