Revert "Clean up ParcelableCompatCreatorHoneycombMR2."

This reverts commit cf557d1ba3b9914d9aca16a72143242969a9c752.

Bug: 31526811
Bug: 31486438
Bug: 30948701
Change-Id: I527d1e9ba71ef51b18e71f9d0c8cdc970b880b27
diff --git a/compat/gingerbread/android/support/v4/os/ParcelableCompatCreatorBase.java b/compat/gingerbread/android/support/v4/os/ParcelableCompatCreatorBase.java
deleted file mode 100644
index afac122..0000000
--- a/compat/gingerbread/android/support/v4/os/ParcelableCompatCreatorBase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v4.os;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-class ParcelableCompatCreatorBase<T> implements Parcelable.Creator<T> {
-    final ParcelableCompatCreatorCallbacks<T> mCallbacks;
-
-    public ParcelableCompatCreatorBase(ParcelableCompatCreatorCallbacks<T> callbacks) {
-        mCallbacks = callbacks;
-    }
-
-    @Override
-    public T createFromParcel(Parcel source) {
-        return mCallbacks.createFromParcel(source, null);
-    }
-
-    @Override
-    public T[] newArray(int size) {
-        return mCallbacks.newArray(size);
-    }
-}
diff --git a/compat/gingerbread/android/support/v4/os/ParcelableCompatCreatorCallbacks.java b/compat/honeycomb_mr2/android/support/v4/os/ParcelableCompatCreatorCallbacks.java
similarity index 100%
rename from compat/gingerbread/android/support/v4/os/ParcelableCompatCreatorCallbacks.java
rename to compat/honeycomb_mr2/android/support/v4/os/ParcelableCompatCreatorCallbacks.java
diff --git a/compat/honeycomb_mr2/android/support/v4/os/ParcelableCompatCreatorHoneycombMR2.java b/compat/honeycomb_mr2/android/support/v4/os/ParcelableCompatCreatorHoneycombMR2.java
deleted file mode 100644
index 61a5924..0000000
--- a/compat/honeycomb_mr2/android/support/v4/os/ParcelableCompatCreatorHoneycombMR2.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2011 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.support.v4.os;
-
-import android.os.Parcel;
-
-class ParcelableCompatCreatorHoneycombMR2<T> extends ParcelableCompatCreatorBase<T> {
-
-    public ParcelableCompatCreatorHoneycombMR2(ParcelableCompatCreatorCallbacks<T> callbacks) {
-        super(callbacks);
-    }
-
-    public T createFromParcel(Parcel in, ClassLoader loader) {
-        return mCallbacks.createFromParcel(in, loader);
-    }
-}
diff --git a/compat/honeycomb_mr2/android/support/v4/os/ParcelableCompatHoneycombMR2.java b/compat/honeycomb_mr2/android/support/v4/os/ParcelableCompatHoneycombMR2.java
new file mode 100644
index 0000000..08acb55
--- /dev/null
+++ b/compat/honeycomb_mr2/android/support/v4/os/ParcelableCompatHoneycombMR2.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.support.v4.os;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+class ParcelableCompatCreatorHoneycombMR2Stub {
+    static <T> Parcelable.Creator<T> instantiate(ParcelableCompatCreatorCallbacks<T> callbacks) {
+        return new ParcelableCompatCreatorHoneycombMR2<T>(callbacks);
+    }
+}
+
+class ParcelableCompatCreatorHoneycombMR2<T> implements Parcelable.ClassLoaderCreator<T> {
+    private final ParcelableCompatCreatorCallbacks<T> mCallbacks;
+
+    public ParcelableCompatCreatorHoneycombMR2(ParcelableCompatCreatorCallbacks<T> callbacks) {
+        mCallbacks = callbacks;
+    }
+
+    public T createFromParcel(Parcel in) {
+        return mCallbacks.createFromParcel(in, null);
+    }
+
+    public T createFromParcel(Parcel in, ClassLoader loader) {
+        return mCallbacks.createFromParcel(in, loader);
+    }
+
+    public T[] newArray(int size) {
+        return mCallbacks.newArray(size);
+    }
+}
diff --git a/compat/java/android/support/v4/os/ParcelableCompat.java b/compat/java/android/support/v4/os/ParcelableCompat.java
index 6c8820ca..10c03b5 100644
--- a/compat/java/android/support/v4/os/ParcelableCompat.java
+++ b/compat/java/android/support/v4/os/ParcelableCompat.java
@@ -16,6 +16,7 @@
 
 package android.support.v4.os;
 
+import android.os.Parcel;
 import android.os.Parcelable;
 
 /**
@@ -23,6 +24,7 @@
  * introduced after API level 4 in a backwards compatible fashion.
  */
 public final class ParcelableCompat {
+
     /**
      * Factory method for {@link Parcelable.Creator}.
      *
@@ -32,9 +34,27 @@
     public static <T> Parcelable.Creator<T> newCreator(
             ParcelableCompatCreatorCallbacks<T> callbacks) {
         if (android.os.Build.VERSION.SDK_INT >= 13) {
-            return new ParcelableCompatCreatorHoneycombMR2<T>(callbacks);
+            return ParcelableCompatCreatorHoneycombMR2Stub.instantiate(callbacks);
         }
-        return new ParcelableCompatCreatorBase<T>(callbacks);
+        return new CompatCreator<T>(callbacks);
+    }
+
+    static class CompatCreator<T> implements Parcelable.Creator<T> {
+        final ParcelableCompatCreatorCallbacks<T> mCallbacks;
+
+        public CompatCreator(ParcelableCompatCreatorCallbacks<T> callbacks) {
+            mCallbacks = callbacks;
+        }
+
+        @Override
+        public T createFromParcel(Parcel source) {
+            return mCallbacks.createFromParcel(source, null);
+        }
+
+        @Override
+        public T[] newArray(int size) {
+            return mCallbacks.newArray(size);
+        }
     }
 
     private ParcelableCompat() {}