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

Commit 1b7202f5 authored by William Loh's avatar William Loh
Browse files

Add error logging for IntentFilter parcel errors

Bug: 335196436
Test: presubmit
Flag: EXEMPT log only update
Change-Id: I505ce3168ca764463a58e7465638cd2ee88e222f
parent c6146d09
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3141,6 +3141,14 @@ public class IntentFilter implements Parcelable {
            for (int i = 0; i < N; i++) {
                mUriRelativeFilterGroups.add(new UriRelativeFilterGroup(source));
            }
            if (source.dataAvail() > 0) {
                Log.e(TAG, "Parcel data not fully consumed after completed reading"
                        + " UriRelativeFilterGroup data");
            }
        }
        if (source.dataAvail() > 0) {
            Log.e(TAG, "Parcel data not fully consumed when unparceling intent filter",
                    new Exception());
        }
    }

+8 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import java.util.Objects;
 */
@FlaggedApi(Flags.FLAG_RELATIVE_REFERENCE_INTENT_FILTERS)
public final class UriRelativeFilterGroup {
    private static final String TAG = "UriRelativeFilterGroup";
    private static final String ALLOW_STR = "allow";
    private static final String URI_RELATIVE_FILTER_GROUP_STR = "uriRelativeFilterGroup";

@@ -233,9 +234,16 @@ public final class UriRelativeFilterGroup {
        final int n = mUriRelativeFilters.size();
        if (n > 0) {
            dest.writeInt(n);
            int i = 0;
            Iterator<UriRelativeFilter> it = mUriRelativeFilters.iterator();
            while (it.hasNext()) {
                it.next().writeToParcel(dest, flags);
                i++;
            }
            if (i != n) {
                Log.e(TAG, "UriRelativeFilters was unexpectedly"
                        + " modified while writing to parcel. Expected "
                        + n + " but found " + i + " filters", new Exception());
            }
        } else {
            dest.writeInt(0);