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

The following examples show how to use android.os.Parcel#createByteArray() . 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: OpenPgpDecryptionResult.java    From FairEmail with GNU General Public License v3.0 6 votes vote down vote up
public OpenPgpDecryptionResult createFromParcel(final Parcel source) {
    int version = source.readInt(); // parcelableVersion
    int parcelableSize = source.readInt();
    int startPosition = source.dataPosition();

    int result = source.readInt();
    byte[] sessionKey = version > 1 ? source.createByteArray() : null;
    byte[] decryptedSessionKey = version > 1 ? source.createByteArray() : null;

    OpenPgpDecryptionResult vr = new OpenPgpDecryptionResult(result, sessionKey, decryptedSessionKey);

    // skip over all fields added in future versions of this parcel
    source.setDataPosition(startPosition + parcelableSize);

    return vr;
}
 
Example 2
Source File: OpenPgpDecryptionResult.java    From openpgp-api with Apache License 2.0 6 votes vote down vote up
public OpenPgpDecryptionResult createFromParcel(final Parcel source) {
    int version = source.readInt(); // parcelableVersion
    int parcelableSize = source.readInt();
    int startPosition = source.dataPosition();

    int result = source.readInt();
    byte[] sessionKey = version > 1 ? source.createByteArray() : null;
    byte[] decryptedSessionKey = version > 1 ? source.createByteArray() : null;

    OpenPgpDecryptionResult vr = new OpenPgpDecryptionResult(result, sessionKey, decryptedSessionKey);

    // skip over all fields added in future versions of this parcel
    source.setDataPosition(startPosition + parcelableSize);

    return vr;
}
 
Example 3
Source File: InstantAppResolveInfo.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
InstantAppDigest(Parcel in) {
    final int digestCount = in.readInt();
    if (digestCount == -1) {
        mDigestBytes = null;
    } else {
        mDigestBytes = new byte[digestCount][];
        for (int i = 0; i < digestCount; i++) {
            mDigestBytes[i] = in.createByteArray();
        }
    }
    mDigestPrefix = in.createIntArray();
    mDigestPrefixSecure = in.createIntArray();
}
 
Example 4
Source File: OperationResult.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
protected OperationResult(Parcel in) {
    resultCode = in.readInt();
    token = in.readStrongBinder();
    operationHandle = in.readLong();
    inputConsumed = in.readInt();
    output = in.createByteArray();
    outParams = KeymasterArguments.CREATOR.createFromParcel(in);
}
 
Example 5
Source File: DrmInitData.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
SchemeData(Parcel in) {
  uuid = new UUID(in.readLong(), in.readLong());
  licenseServerUrl = in.readString();
  mimeType = in.readString();
  data = in.createByteArray();
  requiresSecureDecryption = in.readByte() != 0;
}
 
Example 6
Source File: BTDescriptorProfile.java    From BLEService with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public BTDescriptorProfile(Parcel in) {
	UUID uuid = UUIDUtils.readFromParcel(in);
	int permissions = in.readInt();
	byte[] value = in.createByteArray();
	mDescriptor = new BluetoothGattDescriptor(uuid, permissions);
	mDescriptor.setValue(value);
}
 
Example 7
Source File: NetworkUtils.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Reads an InetAddress from a parcel. Returns null if the address that was written was null
 * or if the data is invalid.
 */
protected static InetAddress unparcelInetAddress(Parcel in) {
    byte[] addressArray = in.createByteArray();
    if (addressArray == null) {
        return null;
    }
    try {
        return InetAddress.getByAddress(addressArray);
    } catch (UnknownHostException e) {
        return null;
    }
}
 
Example 8
Source File: AppEntity.java    From AppPlus with MIT License 5 votes vote down vote up
protected AppEntity(Parcel in) {
    this.id = in.readLong();
    this.appName = in.readString();
    this.packageName = in.readString();
    this.versionName = in.readString();
    this.versionCode = in.readInt();
    this.appIconData = in.createByteArray();
    this.srcPath = in.readString();
    this.uid = in.readInt();
    this.isFavorite = in.readByte() != 0;
    this.lastModifyTime = in.readLong();
    this.totalSpace = in.readLong();
    this.status = in.readInt();
}
 
Example 9
Source File: NetworkKey.java    From Android-nRF-Mesh-Library with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected NetworkKey(Parcel in) {
    meshUuid = in.readString();
    keyIndex = in.readInt();
    name = in.readString();
    key = in.createByteArray();
    phase = in.readInt();
    minSecurity = in.readByte() != 0;
    oldKey = in.createByteArray();
    timestamp = in.readLong();
}
 
Example 10
Source File: RouteInfo.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public RouteInfo createFromParcel(Parcel in) {
    IpPrefix dest = in.readParcelable(null);

    InetAddress gateway = null;
    byte[] addr = in.createByteArray();
    try {
        gateway = InetAddress.getByAddress(addr);
    } catch (UnknownHostException e) {}

    String iface = in.readString();
    int type = in.readInt();

    return new RouteInfo(dest, gateway, iface, type);
}
 
Example 11
Source File: StructMessageInfo.java    From iGap-Android with GNU Affero General Public License v3.0 5 votes vote down vote up
protected StructMessageInfo(Parcel in) {
    //this.view = in.readParcelable(View.class.getClassLoader());
    this.roomId = in.readLong();
    this.messageID = in.readString();
    this.senderID = in.readString();
    this.senderColor = in.readString();
    this.isEdited = in.readByte() != 0;
    this.status = in.readString();
    this.initials = in.readString();
    int tmpMessageType = in.readInt();
    this.messageType = tmpMessageType == -1 ? null : ProtoGlobal.RoomMessageType.values()[tmpMessageType];
    int tmpSendType = in.readInt();
    this.sendType = tmpSendType == -1 ? null : MyType.SendType.values()[tmpSendType];
    this.replayTo = Parcels.unwrap(in.readParcelable(RealmRoomMessage.class.getClassLoader()));
    this.forwardedFrom = Parcels.unwrap(in.readParcelable(RealmRoomMessage.class.getClassLoader()));
    this.songArtist = in.readString();
    this.songLength = in.readLong();
    this.messageText = in.readString();
    this.fileMime = in.readString();
    this.filePic = in.readString();
    this.filePath = in.readString();
    this.fileHash = in.createByteArray();
    this.uploadProgress = in.readInt();
    this.attachment = in.readParcelable(StructMessageAttachment.class.getClassLoader());
    this.userInfo = in.readParcelable(StructRegisteredInfo.class.getClassLoader());
    this.senderAvatar = in.readParcelable(StructMessageAttachment.class.getClassLoader());
    this.time = in.readLong();
    /*this.voteUp = in.readInt();
    this.voteDown = in.readInt();
    this.viewsLabel = in.readInt();*/
    this.channelExtra = Parcels.unwrap(in.readParcelable(StructChannelExtra.class.getClassLoader()));
}
 
Example 12
Source File: Format.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("ResourceType")
/* package */ Format(Parcel in) {
  id = in.readString();
  label = in.readString();
  containerMimeType = in.readString();
  sampleMimeType = in.readString();
  codecs = in.readString();
  bitrate = in.readInt();
  maxInputSize = in.readInt();
  width = in.readInt();
  height = in.readInt();
  frameRate = in.readFloat();
  rotationDegrees = in.readInt();
  pixelWidthHeightRatio = in.readFloat();
  boolean hasProjectionData = Util.readBoolean(in);
  projectionData = hasProjectionData ? in.createByteArray() : null;
  stereoMode = in.readInt();
  colorInfo = in.readParcelable(ColorInfo.class.getClassLoader());
  channelCount = in.readInt();
  sampleRate = in.readInt();
  pcmEncoding = in.readInt();
  encoderDelay = in.readInt();
  encoderPadding = in.readInt();
  selectionFlags = in.readInt();
  language = in.readString();
  accessibilityChannel = in.readInt();
  subsampleOffsetUs = in.readLong();
  int initializationDataSize = in.readInt();
  initializationData = new ArrayList<>(initializationDataSize);
  for (int i = 0; i < initializationDataSize; i++) {
    initializationData.add(in.createByteArray());
  }
  drmInitData = in.readParcelable(DrmInitData.class.getClassLoader());
  metadata = in.readParcelable(Metadata.class.getClassLoader());
}
 
Example 13
Source File: DrmInitData.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
SchemeData(Parcel in) {
  uuid = new UUID(in.readLong(), in.readLong());
  licenseServerUrl = in.readString();
  mimeType = Util.castNonNull(in.readString());
  data = in.createByteArray();
  requiresSecureDecryption = in.readByte() != 0;
}
 
Example 14
Source File: BinaryFrame.java    From K-Sonic with MIT License 4 votes vote down vote up
BinaryFrame(Parcel in) {
  super(in.readString());
  data = in.createByteArray();
}
 
Example 15
Source File: AutocryptPeerUpdate.java    From FairEmail with GNU General Public License v3.0 4 votes vote down vote up
private AutocryptPeerUpdate(Parcel source, int version) {
    this.keyData = source.createByteArray();
    this.effectiveDate = source.readInt() != 0 ? new Date(source.readLong()) : null;
    this.preferEncrypt = PreferEncrypt.values()[source.readInt()];
}
 
Example 16
Source File: WrappedApplicationKey.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * @hide
 */
protected WrappedApplicationKey(Parcel in) {
    mAlias = in.readString();
    mEncryptedKeyMaterial = in.createByteArray();
}
 
Example 17
Source File: KeyDerivationParams.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * @hide
 */
protected KeyDerivationParams(Parcel in) {
    mAlgorithm = in.readInt();
    mSalt = in.createByteArray();
    mMemoryDifficulty = in.readInt();
}
 
Example 18
Source File: ComBean.java    From Android-Serialport with MIT License 4 votes vote down vote up
protected ComBean(Parcel in) {
    bRec = in.createByteArray();
    sRecTime = in.readString();
    sComPort = in.readString();
}
 
Example 19
Source File: CallerResult.java    From AppOpsX with MIT License 4 votes vote down vote up
protected CallerResult(Parcel in) {
    this.reply = in.createByteArray();
    this.throwable = (Throwable) in.readSerializable();
    this.returnType = (Class) in.readSerializable();
}
 
Example 20
Source File: SecurityLog.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor used by Parcelable.Creator to generate SecurityEvent instances.
 * @hide
 */
/* package */ SecurityEvent(Parcel source) {
    this(source.readLong(), source.createByteArray());
}