Java Code Examples for android.os.Parcel#writeStrongBinder()

The following examples show how to use android.os.Parcel#writeStrongBinder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ICustomTabsService.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: IPostMessageService.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
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();
    }

}
 
Example 3
Source File: JobParameters.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 4
Source File: ICustomTabsService.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 5
Source File: ICustomTabsService.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 6
Source File: DragEvent.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * 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());
    }
}
 
Example 7
Source File: ICustomTabsService.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 8
Source File: ICustomTabsService.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 9
Source File: ICustomTabsService.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 10
Source File: ICustomTabsService.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 11
Source File: PendingIntent.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * 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 */);
        }
    }
}
 
Example 12
Source File: OperationResult.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 13
Source File: ICustomTabsService.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 14
Source File: ICustomTabsService.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 15
Source File: MediaSessionCompat.java    From letv with Apache License 2.0 5 votes vote down vote up
public void writeToParcel(Parcel dest, int flags) {
    if (VERSION.SDK_INT >= 21) {
        dest.writeParcelable((Parcelable) this.mInner, flags);
    } else {
        dest.writeStrongBinder((IBinder) this.mInner);
    }
}
 
Example 16
Source File: ParcelUtil.java    From ParcelableGenerator with MIT License 4 votes vote down vote up
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);
    }
}
 
Example 17
Source File: ParcelBinder.java    From springreplugin with Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeStrongBinder(mBinder);
}
 
Example 18
Source File: PendingCallback.java    From firebase-jobdispatcher-android with Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel parcel, int flags) {
  parcel.writeStrongBinder(binder);
}
 
Example 19
Source File: WindowId.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
public void writeToParcel(Parcel out, int flags) {
    out.writeStrongBinder(mToken.asBinder());
}
 
Example 20
Source File: Acr1251UReader.java    From external-nfc-api with Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
	dest.writeString(name);
	dest.writeStrongBinder(readerControl.asBinder());
}