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

Commit 9d519d80 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Frameworks: Slightly refactor Parcel code"

parents 79e58ad9 4c0df5c7
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;
    }