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

The following examples show how to use android.os.Parcel#writeBlob() . 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: SoundTrigger.java    From android_9.0.0_r45 with 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 File: SoundTrigger.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(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
Source File: RecommendationInfo.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@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 File: SoundTrigger.java    From android_9.0.0_r45 with 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 File: SoundTrigger.java    From android_9.0.0_r45 with 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 File: SoundTrigger.java    From android_9.0.0_r45 with 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 File: UsageEvents.java    From android_9.0.0_r45 with 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 File: SoundTrigger.java    From android_9.0.0_r45 with 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);
}