android.os.Parcel#readBlob ( )源码实例Demo

下面列出了android.os.Parcel#readBlob ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: android_9.0.0_r45   文件: UsageEvents.java
/**
 * 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);
    }
}
 
源代码2 项目: android_9.0.0_r45   文件: SoundTrigger.java
/** @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);
}
 
源代码3 项目: android_9.0.0_r45   文件: SoundTrigger.java
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);
}
 
源代码4 项目: android_9.0.0_r45   文件: SoundTrigger.java
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);
}
 
源代码5 项目: android_9.0.0_r45   文件: SoundTrigger.java
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);
}
 
源代码6 项目: android_9.0.0_r45   文件: SoundTrigger.java
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);
}
 
源代码7 项目: android_9.0.0_r45   文件: SoundTrigger.java
private static SoundModelEvent fromParcel(Parcel in) {
    int status = in.readInt();
    int soundModelHandle = in.readInt();
    byte[] data = in.readBlob();
    return new SoundModelEvent(status, soundModelHandle, data);
}
 
 方法所在类
 同类方法