下面列出了android.os.Parcel#writeStrongBinder ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public boolean updateVisuals(ICustomTabsCallback callback, Bundle bundle) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
_data.writeStrongBinder(callback != null?callback.asBinder():null);
if(bundle != null) {
_data.writeInt(1);
bundle.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
this.mRemote.transact(6, _data, _reply, 0);
_reply.readException();
_result = 0 != _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
public boolean requestPostMessageChannel(ICustomTabsCallback callback, Uri postMessageOrigin) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
_data.writeStrongBinder(callback != null?callback.asBinder():null);
if(postMessageOrigin != null) {
_data.writeInt(1);
postMessageOrigin.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
this.mRemote.transact(7, _data, _reply, 0);
_reply.readException();
_result = 0 != _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
/**
* Creates a {@link android.os.Parcel} object from this DragEvent object.
* @param dest A {@link android.os.Parcel} object in which to put the DragEvent object.
* @param flags Flags to store in the Parcel.
*/
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(mAction);
dest.writeFloat(mX);
dest.writeFloat(mY);
dest.writeInt(mDragResult ? 1 : 0);
if (mClipData == null) {
dest.writeInt(0);
} else {
dest.writeInt(1);
mClipData.writeToParcel(dest, flags);
}
if (mClipDescription == null) {
dest.writeInt(0);
} else {
dest.writeInt(1);
mClipDescription.writeToParcel(dest, flags);
}
if (mDragAndDropPermissions == null) {
dest.writeInt(0);
} else {
dest.writeInt(1);
dest.writeStrongBinder(mDragAndDropPermissions.asBinder());
}
}
public boolean newSession(ICustomTabsCallback callback) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
_data.writeStrongBinder(callback != null?callback.asBinder():null);
this.mRemote.transact(3, _data, _reply, 0);
_reply.readException();
_result = 0 != _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
public boolean requestPostMessageChannel(ICustomTabsCallback callback, Uri postMessageOrigin) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
_data.writeStrongBinder(callback != null?callback.asBinder():null);
if(postMessageOrigin != null) {
_data.writeInt(1);
postMessageOrigin.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
this.mRemote.transact(7, _data, _reply, 0);
_reply.readException();
_result = 0 != _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(jobId);
dest.writePersistableBundle(extras);
dest.writeBundle(transientExtras);
if (clipData != null) {
dest.writeInt(1);
clipData.writeToParcel(dest, flags);
dest.writeInt(clipGrantFlags);
} else {
dest.writeInt(0);
}
dest.writeStrongBinder(callback);
dest.writeInt(overrideDeadlineExpired ? 1 : 0);
dest.writeTypedArray(mTriggeredContentUris, flags);
dest.writeStringArray(mTriggeredContentAuthorities);
if (network != null) {
dest.writeInt(1);
network.writeToParcel(dest, flags);
} else {
dest.writeInt(0);
}
dest.writeInt(stopReason);
dest.writeString(debugStopReason);
}
public void onPostMessage(ICustomTabsCallback callback, String message, Bundle extras) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken("android.support.customtabs.IPostMessageService");
_data.writeStrongBinder(callback != null?callback.asBinder():null);
_data.writeString(message);
if(extras != null) {
_data.writeInt(1);
extras.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
this.mRemote.transact(3, _data, _reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
}
public int postMessage(ICustomTabsCallback callback, String message, Bundle extras) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
int _result;
try {
_data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
_data.writeStrongBinder(callback != null?callback.asBinder():null);
_data.writeString(message);
if(extras != null) {
_data.writeInt(1);
extras.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
this.mRemote.transact(8, _data, _reply, 0);
_reply.readException();
_result = _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
public boolean mayLaunchUrl(ICustomTabsCallback callback, Uri url, Bundle extras, List<Bundle> otherLikelyBundles) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
_data.writeStrongBinder(callback != null?callback.asBinder():null);
if(url != null) {
_data.writeInt(1);
url.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
if(extras != null) {
_data.writeInt(1);
extras.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
_data.writeTypedList(otherLikelyBundles);
this.mRemote.transact(4, _data, _reply, 0);
_reply.readException();
_result = 0 != _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeInt(resultCode);
out.writeStrongBinder(token);
out.writeLong(operationHandle);
out.writeInt(inputConsumed);
out.writeByteArray(output);
outParams.writeToParcel(out, flags);
}
public boolean mayLaunchUrl(ICustomTabsCallback callback, Uri url, Bundle extras, List<Bundle> otherLikelyBundles) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
_data.writeStrongBinder(callback != null?callback.asBinder():null);
if(url != null) {
_data.writeInt(1);
url.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
if(extras != null) {
_data.writeInt(1);
extras.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
_data.writeTypedList(otherLikelyBundles);
this.mRemote.transact(4, _data, _reply, 0);
_reply.readException();
_result = 0 != _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
public boolean mayLaunchUrl(ICustomTabsCallback callback, Uri url, Bundle extras, List<Bundle> otherLikelyBundles) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
_data.writeStrongBinder(callback != null?callback.asBinder():null);
if(url != null) {
_data.writeInt(1);
url.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
if(extras != null) {
_data.writeInt(1);
extras.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
_data.writeTypedList(otherLikelyBundles);
this.mRemote.transact(4, _data, _reply, 0);
_reply.readException();
_result = 0 != _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
public boolean mayLaunchUrl(ICustomTabsCallback callback, Uri url, Bundle extras, List<Bundle> otherLikelyBundles) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
boolean _result;
try {
_data.writeInterfaceToken("android.support.customtabs.ICustomTabsService");
_data.writeStrongBinder(callback != null?callback.asBinder():null);
if(url != null) {
_data.writeInt(1);
url.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
if(extras != null) {
_data.writeInt(1);
extras.writeToParcel(_data, 0);
} else {
_data.writeInt(0);
}
_data.writeTypedList(otherLikelyBundles);
this.mRemote.transact(4, _data, _reply, 0);
_reply.readException();
_result = 0 != _reply.readInt();
} finally {
_reply.recycle();
_data.recycle();
}
return _result;
}
public void writeToParcel(Parcel dest, int flags) {
if (VERSION.SDK_INT >= 21) {
dest.writeParcelable((Parcelable) this.mInner, flags);
} else {
dest.writeStrongBinder((IBinder) this.mInner);
}
}
/**
* Convenience function for writing either a PendingIntent or null pointer to
* a Parcel. You must use this with {@link #readPendingIntentOrNullFromParcel}
* for later reading it.
*
* @param sender The PendingIntent to write, or null.
* @param out Where to write the PendingIntent.
*/
public static void writePendingIntentOrNullToParcel(@Nullable PendingIntent sender,
@NonNull Parcel out) {
out.writeStrongBinder(sender != null ? sender.mTarget.asBinder() : null);
if (sender != null) {
OnMarshaledListener listener = sOnMarshaledListener.get();
if (listener != null) {
listener.onMarshaled(sender, out, 0 /* flags */);
}
}
}
private static void writeValueInternal(Parcel dest, Object v) {
if (v == null) {
dest.writeInt(VAL_NULL);
} else if (v instanceof String) {
dest.writeInt(VAL_STRING);
dest.writeString((String) v);
} else if (v instanceof Integer) {
dest.writeInt(VAL_INTEGER);
dest.writeInt((Integer) v);
} else if (v instanceof Map) {
dest.writeInt(VAL_MAP);
writeMap(dest, (Map) v);
} else if (v instanceof Bundle) {
// Must be before Parcelable
dest.writeInt(VAL_BUNDLE);
dest.writeBundle((Bundle) v);
} else if (v instanceof Parcelable) {
dest.writeInt(VAL_PARCELABLE);
dest.writeParcelable((Parcelable) v, 0);
} else if (v instanceof Short) {
dest.writeInt(VAL_SHORT);
dest.writeInt(((Short) v).intValue());
} else if (v instanceof Long) {
dest.writeInt(VAL_LONG);
dest.writeLong((Long) v);
} else if (v instanceof Float) {
dest.writeInt(VAL_FLOAT);
dest.writeFloat((Float) v);
} else if (v instanceof Double) {
dest.writeInt(VAL_DOUBLE);
dest.writeDouble((Double) v);
} else if (v instanceof Boolean) {
dest.writeInt(VAL_BOOLEAN);
dest.writeInt((Boolean) v ? 1 : 0);
} else if (v instanceof CharSequence) {
// Must be after String
dest.writeInt(VAL_CHARSEQUENCE);
TextUtils.writeToParcel((CharSequence) v, dest, 0);
} else if (v instanceof List) {
dest.writeInt(VAL_LIST);
writeList(dest, (List) v);
} else if (v instanceof SparseArray) {
dest.writeInt(VAL_SPARSEARRAY);
writeSparseArray(dest, (SparseArray<Object>) v);
} else if (v instanceof boolean[]) {
dest.writeInt(VAL_BOOLEANARRAY);
dest.writeBooleanArray((boolean[]) v);
} else if (v instanceof byte[]) {
dest.writeInt(VAL_BYTEARRAY);
dest.writeByteArray((byte[]) v);
} else if (v instanceof String[]) {
dest.writeInt(VAL_STRINGARRAY);
dest.writeStringArray((String[]) v);
} else if (v instanceof CharSequence[]) {
// Must be after String[] and before Object[]
dest.writeInt(VAL_CHARSEQUENCEARRAY);
CharSequence[] val = (CharSequence[]) v;
int N = val.length;
dest.writeInt(N);
for (int i = 0; i < N; i++) {
TextUtils.writeToParcel((CharSequence) val[i], dest, 0);
}
} else if (v instanceof IBinder) {
dest.writeInt(VAL_IBINDER);
dest.writeStrongBinder((IBinder) v);
} else if (v instanceof Parcelable[]) {
dest.writeInt(VAL_PARCELABLEARRAY);
dest.writeParcelableArray((Parcelable[]) v, 0);
} else if (v instanceof Object[]) {
dest.writeInt(VAL_OBJECTARRAY);
writeArray(dest, (Object[]) v);
} else if (v instanceof int[]) {
dest.writeInt(VAL_INTARRAY);
dest.writeIntArray((int[]) v);
} else if (v instanceof long[]) {
dest.writeInt(VAL_LONGARRAY);
dest.writeLongArray((long[]) v);
} else if (v instanceof Byte) {
dest.writeInt(VAL_BYTE);
dest.writeInt((Byte) v);
} else if (v instanceof Serializable) {
// Must be last
dest.writeInt(VAL_SERIALIZABLE);
dest.writeSerializable((Serializable) v);
} else {
throw new RuntimeException("Parcel: unable to marshal value " + v);
}
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name);
dest.writeStrongBinder(readerControl.asBinder());
}
public void writeToParcel(Parcel out, int flags) {
out.writeStrongBinder(mToken.asBinder());
}
@Override
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeStrongBinder(binder);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeStrongBinder(mBinder);
}