OSDN Git Service

Fix issue #35813125: API Review: android.os > Bundle
authorDianne Hackborn <hackbod@google.com>
Sat, 4 Mar 2017 01:01:38 +0000 (17:01 -0800)
committerDianne Hackborn <hackbod@google.com>
Sat, 4 Mar 2017 01:02:29 +0000 (17:02 -0800)
- Renamed deepcopy to deepCopy.
- Clarified docs about when a shallow vs. deep copy happens.

Test: booted and ran

Change-Id: I2b4400770d781ff51423cd1c860454742e1d3c9c

api/current.txt
api/system-current.txt
api/test-current.txt
core/java/android/app/job/JobInfo.java
core/java/android/os/BaseBundle.java
core/java/android/os/Bundle.java
core/java/android/os/PersistableBundle.java

index 9c443f8..bd29ee4 100644 (file)
@@ -30261,7 +30261,7 @@ package android.os {
     ctor public Bundle(android.os.Bundle);
     ctor public Bundle(android.os.PersistableBundle);
     method public java.lang.Object clone();
-    method public android.os.Bundle deepcopy();
+    method public android.os.Bundle deepCopy();
     method public int describeContents();
     method public android.os.IBinder getBinder(java.lang.String);
     method public android.os.Bundle getBundle(java.lang.String);
@@ -30996,7 +30996,7 @@ package android.os {
     ctor public PersistableBundle(int);
     ctor public PersistableBundle(android.os.PersistableBundle);
     method public java.lang.Object clone();
-    method public android.os.PersistableBundle deepcopy();
+    method public android.os.PersistableBundle deepCopy();
     method public int describeContents();
     method public android.os.PersistableBundle getPersistableBundle(java.lang.String);
     method public void putPersistableBundle(java.lang.String, android.os.PersistableBundle);
index eb237fa..ebce4e6 100644 (file)
@@ -32863,7 +32863,7 @@ package android.os {
     ctor public Bundle(android.os.Bundle);
     ctor public Bundle(android.os.PersistableBundle);
     method public java.lang.Object clone();
-    method public android.os.Bundle deepcopy();
+    method public android.os.Bundle deepCopy();
     method public int describeContents();
     method public android.os.IBinder getBinder(java.lang.String);
     method public android.os.Bundle getBundle(java.lang.String);
@@ -33619,7 +33619,7 @@ package android.os {
     ctor public PersistableBundle(int);
     ctor public PersistableBundle(android.os.PersistableBundle);
     method public java.lang.Object clone();
-    method public android.os.PersistableBundle deepcopy();
+    method public android.os.PersistableBundle deepCopy();
     method public int describeContents();
     method public android.os.PersistableBundle getPersistableBundle(java.lang.String);
     method public void putPersistableBundle(java.lang.String, android.os.PersistableBundle);
index ccf688c..bd76ef5 100644 (file)
@@ -30357,7 +30357,7 @@ package android.os {
     ctor public Bundle(android.os.Bundle);
     ctor public Bundle(android.os.PersistableBundle);
     method public java.lang.Object clone();
-    method public android.os.Bundle deepcopy();
+    method public android.os.Bundle deepCopy();
     method public int describeContents();
     method public android.os.IBinder getBinder(java.lang.String);
     method public android.os.Bundle getBundle(java.lang.String);
@@ -31113,7 +31113,7 @@ package android.os {
     ctor public PersistableBundle(int);
     ctor public PersistableBundle(android.os.PersistableBundle);
     method public java.lang.Object clone();
-    method public android.os.PersistableBundle deepcopy();
+    method public android.os.PersistableBundle deepCopy();
     method public int describeContents();
     method public android.os.PersistableBundle getPersistableBundle(java.lang.String);
     method public void putPersistableBundle(java.lang.String, android.os.PersistableBundle);
index 3887556..6652eee 100644 (file)
@@ -425,8 +425,8 @@ public class JobInfo implements Parcelable {
 
     private JobInfo(JobInfo.Builder b) {
         jobId = b.mJobId;
-        extras = b.mExtras.deepcopy();
-        transientExtras = b.mTransientExtras.deepcopy();
+        extras = b.mExtras.deepCopy();
+        transientExtras = b.mTransientExtras.deepCopy();
         service = b.mJobService;
         constraintFlags = b.mConstraintFlags;
         triggerContentUris = b.mTriggerContentUris != null
index 14760ab..e82fe03 100644 (file)
@@ -341,7 +341,7 @@ public class BaseBundle {
                     final int N = fromMap.size();
                     mMap = new ArrayMap<>(N);
                     for (int i = 0; i < N; i++) {
-                        mMap.append(fromMap.keyAt(i), deepcopyValue(fromMap.valueAt(i)));
+                        mMap.append(fromMap.keyAt(i), deepCopyValue(fromMap.valueAt(i)));
                     }
                 }
             } else {
@@ -352,14 +352,14 @@ public class BaseBundle {
         }
     }
 
-    Object deepcopyValue(Object value) {
+    Object deepCopyValue(Object value) {
         if (value == null) {
             return null;
         }
         if (value instanceof Bundle) {
-            return ((Bundle)value).deepcopy();
+            return ((Bundle)value).deepCopy();
         } else if (value instanceof PersistableBundle) {
-            return ((PersistableBundle)value).deepcopy();
+            return ((PersistableBundle)value).deepCopy();
         } else if (value instanceof ArrayList) {
             return deepcopyArrayList((ArrayList) value);
         } else if (value.getClass().isArray()) {
@@ -388,7 +388,7 @@ public class BaseBundle {
         final int N = from.size();
         ArrayList out = new ArrayList(N);
         for (int i=0; i<N; i++) {
-            out.add(deepcopyValue(from.get(i)));
+            out.add(deepCopyValue(from.get(i)));
         }
         return out;
     }
index d04d6c2..c1292e7 100644 (file)
@@ -98,9 +98,12 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
 
     /**
      * Constructs a Bundle containing a copy of the mappings from the given
-     * Bundle.
+     * Bundle.  Does only a shallow copy of the original Bundle -- see
+     * {@link #deepCopy()} if that is not what you want.
      *
      * @param b a Bundle to be copied.
+     *
+     * @see #deepCopy()
      */
     public Bundle(Bundle b) {
         super(b);
@@ -109,9 +112,10 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
 
     /**
      * Constructs a Bundle containing a copy of the mappings from the given
-     * PersistableBundle.
+     * PersistableBundle.  Does only a shallow copy of the PersistableBundle -- see
+     * {@link PersistableBundle#deepCopy()} if you don't want that.
      *
-     * @param b a Bundle to be copied.
+     * @param b a PersistableBundle to be copied.
      */
     public Bundle(PersistableBundle b) {
         super(b);
@@ -209,7 +213,7 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
      * primitive arrays.  Other types of objects (such as Parcelable or Serializable)
      * are referenced as-is and not copied in any way.
      */
-    public Bundle deepcopy() {
+    public Bundle deepCopy() {
         Bundle b = new Bundle(false);
         b.copyInternal(this, true);
         return b;
index 9b60783..75f9c11 100644 (file)
@@ -76,9 +76,12 @@ public final class PersistableBundle extends BaseBundle implements Cloneable, Pa
 
     /**
      * Constructs a PersistableBundle containing a copy of the mappings from the given
-     * PersistableBundle.
+     * PersistableBundle.  Does only a shallow copy of the original PersistableBundle -- see
+     * {@link #deepCopy()} if that is not what you want.
      *
      * @param b a PersistableBundle to be copied.
+     *
+     * @see #deepCopy()
      */
     public PersistableBundle(PersistableBundle b) {
         super(b);
@@ -87,7 +90,7 @@ public final class PersistableBundle extends BaseBundle implements Cloneable, Pa
 
 
     /**
-     * Constructs a PersistableBundle from a Bundle.
+     * Constructs a PersistableBundle from a Bundle.  Does only a shallow copy of the Bundle.
      *
      * @param b a Bundle to be copied.
      *
@@ -167,7 +170,7 @@ public final class PersistableBundle extends BaseBundle implements Cloneable, Pa
      * primitive arrays.  Other types of objects (such as Parcelable or Serializable)
      * are referenced as-is and not copied in any way.
      */
-    public PersistableBundle deepcopy() {
+    public PersistableBundle deepCopy() {
         PersistableBundle b = new PersistableBundle(false);
         b.copyInternal(this, true);
         return b;