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

The following examples show how to use android.os.Parcel#writeBlob() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 6 votes vote down vote up
/** @hide */
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(status);
    dest.writeInt(soundModelHandle);
    dest.writeByte((byte) (captureAvailable ? 1 : 0));
    dest.writeInt(captureSession);
    dest.writeInt(captureDelayMs);
    dest.writeInt(capturePreambleMs);
    dest.writeByte((byte) (triggerInData ? 1 : 0));
    if (captureFormat != null) {
        dest.writeByte((byte)1);
        dest.writeInt(captureFormat.getSampleRate());
        dest.writeInt(captureFormat.getEncoding());
        dest.writeInt(captureFormat.getChannelMask());
    } else {
        dest.writeByte((byte)0);
    }
    dest.writeBlob(data);
}
 
Example 2
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(status);
    dest.writeInt(soundModelHandle);
    dest.writeByte((byte) (captureAvailable ? 1 : 0));
    dest.writeInt(captureSession);
    dest.writeInt(captureDelayMs);
    dest.writeInt(capturePreambleMs);
    dest.writeByte((byte) (triggerInData ? 1 : 0));
    if (captureFormat != null) {
        dest.writeByte((byte)1);
        dest.writeInt(captureFormat.getSampleRate());
        dest.writeInt(captureFormat.getEncoding());
        dest.writeInt(captureFormat.getChannelMask());
    } else {
        dest.writeByte((byte)0);
    }
    dest.writeBlob(data);
    dest.writeTypedArray(keyphraseExtras, flags);
}
 
Example 3
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeCharSequence(mPackageName);
    dest.writeCharSequence(mName);

    int numDiscoveredPrinters = mDiscoveredPrinters.size();
    dest.writeInt(numDiscoveredPrinters);

    for (InetAddress printer : mDiscoveredPrinters) {
        dest.writeBlob(printer.getAddress());
    }

    dest.writeByte((byte) (mRecommendsMultiVendorService ? 1 : 0));
}
 
Example 4
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(uuid.toString());
    if (vendorUuid == null) {
        dest.writeInt(-1);
    } else {
        dest.writeInt(vendorUuid.toString().length());
        dest.writeString(vendorUuid.toString());
    }
    dest.writeBlob(data);
    dest.writeTypedArray(keyphrases, flags);
}
 
Example 5
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(uuid.toString());
    if (vendorUuid == null) {
        dest.writeInt(-1);
    } else {
        dest.writeInt(vendorUuid.toString().length());
        dest.writeString(vendorUuid.toString());
    }
    dest.writeBlob(data);
}
 
Example 6
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeByte((byte) (captureRequested ? 1 : 0));
    dest.writeByte((byte) (allowMultipleTriggers ? 1 : 0));
    dest.writeTypedArray(keyphrases, flags);
    dest.writeBlob(data);
}
 
Example 7
Source Project: android_9.0.0_r45   File: UsageEvents.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    Parcel data = Parcel.obtain();
    data.writeInt(mEventCount);
    data.writeInt(mIndex);
    if (mEventCount > 0) {
        data.writeStringArray(mStringPool);

        if (mEventsToWrite != null) {
            // Write out the events
            Parcel p = Parcel.obtain();
            try {
                p.setDataPosition(0);
                for (int i = 0; i < mEventCount; i++) {
                    final Event event = mEventsToWrite.get(i);
                    writeEventToParcel(event, p, flags);
                }

                final int listByteLength = p.dataPosition();

                // Write the total length of the data.
                data.writeInt(listByteLength);

                // Write our current position into the data.
                data.writeInt(0);

                // Write the data.
                data.appendFrom(p, 0, listByteLength);
            } finally {
                p.recycle();
            }

        } else if (mParcel != null) {
            // Write the total length of the data.
            data.writeInt(mParcel.dataSize());

            // Write out current position into the data.
            data.writeInt(mParcel.dataPosition());

            // Write the data.
            data.appendFrom(mParcel, 0, mParcel.dataSize());
        } else {
            throw new IllegalStateException(
                    "Either mParcel or mEventsToWrite must not be null");
        }
    }
    // Data can be too large for a transact. Write the data as a Blob, which will be written to
    // ashmem if too large.
    dest.writeBlob(data.marshall());
}
 
Example 8
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeInt(status);
    dest.writeInt(soundModelHandle);
    dest.writeBlob(data);
}