Skip to content

Commit 354293b

Browse files
Move TransportRecord parcel constructor to Android
1 parent 8b7d5ca commit 354293b

3 files changed

Lines changed: 13 additions & 18 deletions

File tree

android/sdl_android/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@ public TransportRecord(TransportType transportType, String address) {
1212
}
1313

1414
public TransportRecord(Parcel p) {
15-
super(p);
15+
if (p.readInt() == 1) { //We should have a transport type attached
16+
String transportName = p.readString();
17+
if(transportName != null){
18+
this.type = TransportType.valueOf(transportName);
19+
}
20+
}
21+
22+
if (p.readInt() == 1) { //We should have a transport address attached
23+
address = p.readString();
24+
}
1625
}
1726

1827
@Override

base/src/main/java/com/smartdevicelink/transport/utl/BaseTransportRecord.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@
3232

3333
package com.smartdevicelink.transport.utl;
3434

35-
import android.os.Parcel;
3635
import com.smartdevicelink.transport.enums.TransportType;
3736

3837
class BaseTransportRecord{
3938

4039
protected TransportType type;
4140
protected String address;
4241

42+
BaseTransportRecord(){}
43+
4344
BaseTransportRecord(TransportType transportType, String address){
4445
this.type = transportType;
4546
this.address = address;
@@ -78,17 +79,4 @@ public String toString(){
7879
builder.append(address);
7980
return builder.toString();
8081
}
81-
82-
BaseTransportRecord(Parcel p) {
83-
if (p.readInt() == 1) { //We should have a transport type attached
84-
String transportName = p.readString();
85-
if(transportName != null){
86-
this.type = TransportType.valueOf(transportName);
87-
}
88-
}
89-
90-
if (p.readInt() == 1) { //We should have a transport address attached
91-
address = p.readString();
92-
}
93-
}
9482
}

javaSE/src/main/java/com/smartdevicelink/transport/utl/TransportRecord.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ public TransportRecord(TransportType transportType, String address) {
4242
}
4343

4444
@Deprecated
45-
public TransportRecord(Parcel p) {
46-
super(p);
47-
}
45+
public TransportRecord(Parcel p) {}
4846

4947
@Deprecated
5048
public int describeContents() {

0 commit comments

Comments
 (0)