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

The following examples show how to use android.os.Parcel#readBlob() . 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: UsageEvents.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Construct the iterator from a parcel.
 * {@hide}
 */
public UsageEvents(Parcel in) {
    byte[] bytes = in.readBlob();
    Parcel data = Parcel.obtain();
    data.unmarshall(bytes, 0, bytes.length);
    data.setDataPosition(0);
    mEventCount = data.readInt();
    mIndex = data.readInt();
    if (mEventCount > 0) {
        mStringPool = data.createStringArray();

        final int listByteLength = data.readInt();
        final int positionInParcel = data.readInt();
        mParcel = Parcel.obtain();
        mParcel.setDataPosition(0);
        mParcel.appendFrom(data, data.dataPosition(), listByteLength);
        mParcel.setDataSize(mParcel.dataPosition());
        mParcel.setDataPosition(positionInParcel);
    }
}
 
Example 2
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 6 votes vote down vote up
/** @hide */
protected static RecognitionEvent fromParcel(Parcel in) {
    int status = in.readInt();
    int soundModelHandle = in.readInt();
    boolean captureAvailable = in.readByte() == 1;
    int captureSession = in.readInt();
    int captureDelayMs = in.readInt();
    int capturePreambleMs = in.readInt();
    boolean triggerInData = in.readByte() == 1;
    AudioFormat captureFormat = null;
    if (in.readByte() == 1) {
        int sampleRate = in.readInt();
        int encoding = in.readInt();
        int channelMask = in.readInt();
        captureFormat = (new AudioFormat.Builder())
                .setChannelMask(channelMask)
                .setEncoding(encoding)
                .setSampleRate(sampleRate)
                .build();
    }
    byte[] data = in.readBlob();
    return new RecognitionEvent(status, soundModelHandle, captureAvailable, captureSession,
            captureDelayMs, capturePreambleMs, triggerInData, captureFormat, data);
}
 
Example 3
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 6 votes vote down vote up
private static KeyphraseRecognitionEvent fromParcelForKeyphrase(Parcel in) {
    int status = in.readInt();
    int soundModelHandle = in.readInt();
    boolean captureAvailable = in.readByte() == 1;
    int captureSession = in.readInt();
    int captureDelayMs = in.readInt();
    int capturePreambleMs = in.readInt();
    boolean triggerInData = in.readByte() == 1;
    AudioFormat captureFormat = null;
    if (in.readByte() == 1) {
        int sampleRate = in.readInt();
        int encoding = in.readInt();
        int channelMask = in.readInt();
        captureFormat = (new AudioFormat.Builder())
            .setChannelMask(channelMask)
            .setEncoding(encoding)
            .setSampleRate(sampleRate)
            .build();
    }
    byte[] data = in.readBlob();
    KeyphraseRecognitionExtra[] keyphraseExtras =
            in.createTypedArray(KeyphraseRecognitionExtra.CREATOR);
    return new KeyphraseRecognitionEvent(status, soundModelHandle, captureAvailable,
            captureSession, captureDelayMs, capturePreambleMs, triggerInData,
            captureFormat, data, keyphraseExtras);
}
 
Example 4
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 5 votes vote down vote up
private static KeyphraseSoundModel fromParcel(Parcel in) {
    UUID uuid = UUID.fromString(in.readString());
    UUID vendorUuid = null;
    int length = in.readInt();
    if (length >= 0) {
        vendorUuid = UUID.fromString(in.readString());
    }
    byte[] data = in.readBlob();
    Keyphrase[] keyphrases = in.createTypedArray(Keyphrase.CREATOR);
    return new KeyphraseSoundModel(uuid, vendorUuid, data, keyphrases);
}
 
Example 5
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 5 votes vote down vote up
private static GenericSoundModel fromParcel(Parcel in) {
    UUID uuid = UUID.fromString(in.readString());
    UUID vendorUuid = null;
    int length = in.readInt();
    if (length >= 0) {
        vendorUuid = UUID.fromString(in.readString());
    }
    byte[] data = in.readBlob();
    return new GenericSoundModel(uuid, vendorUuid, data);
}
 
Example 6
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 5 votes vote down vote up
private static RecognitionConfig fromParcel(Parcel in) {
    boolean captureRequested = in.readByte() == 1;
    boolean allowMultipleTriggers = in.readByte() == 1;
    KeyphraseRecognitionExtra[] keyphrases =
            in.createTypedArray(KeyphraseRecognitionExtra.CREATOR);
    byte[] data = in.readBlob();
    return new RecognitionConfig(captureRequested, allowMultipleTriggers, keyphrases, data);
}
 
Example 7
Source Project: android_9.0.0_r45   File: SoundTrigger.java    License: Apache License 2.0 4 votes vote down vote up
private static SoundModelEvent fromParcel(Parcel in) {
    int status = in.readInt();
    int soundModelHandle = in.readInt();
    byte[] data = in.readBlob();
    return new SoundModelEvent(status, soundModelHandle, data);
}