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

Commit 06cca6e6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Convert bundle defuse logs to wtf" into main

parents 54e13f24 e17b1e12
Loading
Loading
Loading
Loading
+19 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.annotation.NonNull;
import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Intent;
import android.security.Flags;
import android.util.ArrayMap;
import android.util.Log;
import android.util.MathUtils;
@@ -446,7 +447,16 @@ public class BaseBundle implements Parcel.ClassLoaderProvider {
                object = ((BiFunction<Class<?>, Class<?>[], ?>) object).apply(clazz, itemTypes);
            } catch (BadParcelableException e) {
                if (sShouldDefuse) {
                    Log.w(TAG, "Failed to parse item " + mMap.keyAt(i) + ", returning null.", e);
                    if (Flags.wtfBundleDefuse()) {
                        Slog.wtf(TAG, "Failed to parse item " + mMap.keyAt(i) + ", returning null.",
                                e);
                    } else {
                        Log.w(TAG, "Failed to parse item " + mMap.keyAt(i) + ", returning null.",
                                e);
                    }
                    if (Flags.deprecateBundleDefuse()) {
                        throw e;
                    }
                    return null;
                } else {
                    throw e;
@@ -507,7 +517,14 @@ public class BaseBundle implements Parcel.ClassLoaderProvider {
                    /* lazy */ ownsParcel, this, numLazyValues);
        } catch (BadParcelableException e) {
            if (sShouldDefuse) {
                if (Flags.wtfBundleDefuse()) {
                    Slog.wtf(TAG, "Failed to parse Bundle, but defusing quietly", e);
                } else {
                    Log.w(TAG, "Failed to parse Bundle, but defusing quietly", e);
                }
                if (Flags.deprecateBundleDefuse()) {
                    throw e;
                }
                map.erase();
            } else {
                throw e;
+20 −0
Original line number Diff line number Diff line
@@ -179,3 +179,23 @@ flag {
    description: "Flag for failing instead of logging in case of parcel size mismatches"
    bug: "416031865"
}

flag {
    name: "wtf_bundle_defuse"
    namespace: "responsible_apis"
    description: "Flag for wtf logging when defuse is enabled."
    bug: "254848919"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "deprecate_bundle_defuse"
    namespace: "responsible_apis"
    description: "Flag for failing instead of logging when defuse is enabled."
    bug: "254848919"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}