Merge "Add Bundle APIs for putting/getting Binder objects." into jb-mr2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4b141acde0
@ -15862,6 +15862,7 @@ package android.os {
|
||||
method public boolean containsKey(java.lang.String);
|
||||
method public int describeContents();
|
||||
method public java.lang.Object get(java.lang.String);
|
||||
method public android.os.IBinder getBinder(java.lang.String);
|
||||
method public boolean getBoolean(java.lang.String);
|
||||
method public boolean getBoolean(java.lang.String, boolean);
|
||||
method public boolean[] getBooleanArray(java.lang.String);
|
||||
@ -15906,6 +15907,7 @@ package android.os {
|
||||
method public boolean isEmpty();
|
||||
method public java.util.Set<java.lang.String> keySet();
|
||||
method public void putAll(android.os.Bundle);
|
||||
method public void putBinder(java.lang.String, android.os.IBinder);
|
||||
method public void putBoolean(java.lang.String, boolean);
|
||||
method public void putBooleanArray(java.lang.String, boolean[]);
|
||||
method public void putBundle(java.lang.String, android.os.Bundle);
|
||||
|
@ -741,6 +741,25 @@ public final class Bundle implements Parcelable, Cloneable {
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an {@link IBinder} value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key. Either key or value may be null.
|
||||
*
|
||||
* <p class="note">You should be very careful when using this function. In many
|
||||
* places where Bundles are used (such as inside of Intent objects), the Bundle
|
||||
* can live longer inside of another process than the process that had originally
|
||||
* created it. In that case, the IBinder you supply here will become invalid
|
||||
* when your process goes away, and no longer usable, even if a new process is
|
||||
* created for you later on.</p>
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @param value an IBinder object, or null
|
||||
*/
|
||||
public void putBinder(String key, IBinder value) {
|
||||
unparcel();
|
||||
mMap.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an IBinder value into the mapping of this Bundle, replacing
|
||||
* any existing value for the given key. Either key or value may be null.
|
||||
@ -749,7 +768,7 @@ public final class Bundle implements Parcelable, Cloneable {
|
||||
* @param value an IBinder object, or null
|
||||
*
|
||||
* @deprecated
|
||||
* @hide
|
||||
* @hide This is the old name of the function.
|
||||
*/
|
||||
@Deprecated
|
||||
public void putIBinder(String key, IBinder value) {
|
||||
@ -1536,6 +1555,28 @@ public final class Bundle implements Parcelable, Cloneable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or null if
|
||||
* no mapping of the desired type exists for the given key or a null
|
||||
* value is explicitly associated with the key.
|
||||
*
|
||||
* @param key a String, or null
|
||||
* @return an IBinder value, or null
|
||||
*/
|
||||
public IBinder getBinder(String key) {
|
||||
unparcel();
|
||||
Object o = mMap.get(key);
|
||||
if (o == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return (IBinder) o;
|
||||
} catch (ClassCastException e) {
|
||||
typeWarning(key, o, "IBinder", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value associated with the given key, or null if
|
||||
* no mapping of the desired type exists for the given key or a null
|
||||
@ -1545,7 +1586,7 @@ public final class Bundle implements Parcelable, Cloneable {
|
||||
* @return an IBinder value, or null
|
||||
*
|
||||
* @deprecated
|
||||
* @hide
|
||||
* @hide This is the old name of the function.
|
||||
*/
|
||||
@Deprecated
|
||||
public IBinder getIBinder(String key) {
|
||||
|
Reference in New Issue
Block a user