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

Commit 308b11e2 authored by Andreas Gampe's avatar Andreas Gampe Committed by android-build-merger
Browse files

Merge "Frameworks: Slightly refactor Parcel code"

am: 9d519d80

Change-Id: Ib02044d8823e3663461ec1387d2b454788771648
parents 1ee4d86b 9d519d80
Loading
Loading
Loading
Loading
+53 −51
Original line number Diff line number Diff line
@@ -2797,14 +2797,19 @@ public final class Parcel {
            return null;
        }
        Parcelable.Creator<?> creator;
        HashMap<String, Parcelable.Creator<?>> map;
        synchronized (mCreators) {
            HashMap<String,Parcelable.Creator<?>> map = mCreators.get(loader);
            map = mCreators.get(loader);
            if (map == null) {
                map = new HashMap<>();
                mCreators.put(loader, map);
            }
            creator = map.get(name);
            if (creator == null) {
        }
        if (creator != null) {
            return creator;
        }

        try {
            // If loader == null, explicitly emulate Class.forName(String) "caller
            // classloader" behavior.
@@ -2832,18 +2837,15 @@ public final class Parcel {
                        + "CREATOR on class " + name);
            }
            creator = (Parcelable.Creator<?>) f.get(null);
                }
                catch (IllegalAccessException e) {
        } catch (IllegalAccessException e) {
            Log.e(TAG, "Illegal access when unmarshalling: " + name, e);
            throw new BadParcelableException(
                    "IllegalAccessException when unmarshalling: " + name);
                }
                catch (ClassNotFoundException e) {
        } catch (ClassNotFoundException e) {
            Log.e(TAG, "Class not found when unmarshalling: " + name, e);
            throw new BadParcelableException(
                    "ClassNotFoundException when unmarshalling: " + name);
                }
                catch (NoSuchFieldException e) {
        } catch (NoSuchFieldException e) {
            throw new BadParcelableException("Parcelable protocol requires a "
                    + "Parcelable.Creator object called "
                    + "CREATOR on class " + name);
@@ -2854,9 +2856,9 @@ public final class Parcel {
                    + "CREATOR on class " + name);
        }

        synchronized (mCreators) {
            map.put(name, creator);
        }
        }

        return creator;
    }