Skip to content

Commit bb06b8d

Browse files
committed
Remove Parcelable implementation from base
1 parent 090648c commit bb06b8d

1 file changed

Lines changed: 1 addition & 87 deletions

File tree

base/src/main/java/com/smartdevicelink/protocol/BaseSdlPacket.java

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* Any other binder transactions must include an additional int flag into their bundle or the parsing
4848
* of this object will fail.
4949
*/
50-
public class BaseSdlPacket implements Parcelable{
50+
public class BaseSdlPacket {
5151

5252
/**
5353
* This is the amount of bytes added to the bundle from the router service for a specific int
@@ -359,92 +359,6 @@ public String toString() {
359359
public void setMessagingVersion(int version){
360360
this.messagingVersion = version;
361361
}
362-
363-
364-
365-
/* ***************************************************************************************************************************************************
366-
* *********************************************************** Parceable Overrides *****************************************************************
367-
*****************************************************************************************************************************************************/
368-
369-
370-
371-
//I think this is FIFO...right?
372-
public BaseSdlPacket(Parcel p) {
373-
this.version = p.readInt();
374-
this.encryption = (p.readInt() == 0) ? false : true;
375-
this.frameType = p.readInt();
376-
this.serviceType = p.readInt();
377-
this.frameInfo = p.readInt();
378-
this.sessionId = p.readInt();
379-
this.dataSize = p.readInt();
380-
this.messageId = p.readInt();
381-
if(p.readInt() == 1){ //We should have a payload attached
382-
payload = new byte[dataSize];
383-
p.readByteArray(payload);
384-
}
385-
386-
this.priorityCoefficient = p.readInt();
387-
388-
if(p.dataAvail() > EXTRA_PARCEL_DATA_LENGTH) { //See note on constant for why not 0
389-
try {
390-
messagingVersion = p.readInt();
391-
if (messagingVersion >= 2) {
392-
if (p.readInt() == 1) { //We should have a transport type attached
393-
this.transportRecord = (TransportRecord) p.readParcelable(TransportRecord.class.getClassLoader());
394-
}
395-
}
396-
}catch (RuntimeException e){
397-
DebugTool.logError("Error creating packet from parcel", e);
398-
}
399-
}
400-
}
401-
402-
403-
@Override
404-
public int describeContents() {
405-
return 0;
406-
}
407-
408-
@Override
409-
public void writeToParcel(Parcel dest, int flags) {
410-
411-
dest.writeInt(version);
412-
dest.writeInt(encryption? 1 : 0);
413-
dest.writeInt(frameType);
414-
dest.writeInt(serviceType);
415-
dest.writeInt(frameInfo);
416-
dest.writeInt(sessionId);
417-
dest.writeInt(dataSize);
418-
dest.writeInt(messageId);
419-
dest.writeInt(payload!=null? 1 : 0);
420-
if(payload!=null){
421-
dest.writeByteArray(payload);
422-
}
423-
dest.writeInt(priorityCoefficient);
424-
425-
///Additions after initial creation
426-
if(messagingVersion > 1){
427-
dest.writeInt(messagingVersion);
428-
429-
dest.writeInt(transportRecord!=null? 1 : 0);
430-
if(transportRecord != null){
431-
dest.writeParcelable(transportRecord,0);
432-
}
433-
}
434-
435-
}
436-
437-
public static final Parcelable.Creator<BaseSdlPacket> CREATOR = new Parcelable.Creator<BaseSdlPacket>() {
438-
public BaseSdlPacket createFromParcel(Parcel in) {
439-
return new BaseSdlPacket(in);
440-
}
441-
442-
@Override
443-
public BaseSdlPacket[] newArray(int size) {
444-
return new BaseSdlPacket[size];
445-
}
446-
447-
};
448362

449363
public void putTag(String tag, Object data){
450364
if(bsonPayload == null){

0 commit comments

Comments
 (0)