[Android Head-Units] dakudiv:
Hi,

I will get straight to point.I am trying to Understand\Make custom Protocol Setting for a car model.

currently I am using XY Auto 9270 Model and a custom CAN analyzer.

Even if not answered hope follolwing information , will give initial information to developers how are beginningsto reverse engineer in Chinese Android Head Units.

I have note that for my car model,door , stearing data is present at which address , now my challenge is to format the serial packet to be send to Android Head Unit.

I have read that some users have decompiled the CANbus.apk and CANbus2.apk( in my case ) but there is no proof whether after decompiling it worked.What's more important is where to change\look into APK.

Aim 1 - "Debug Canbox serial data input to Android Head Unit"

(Missing - 4th Point )

1) Decompile CANBUS apk.

2) Search for "baud" keyword inside folders.

3) Install Serial-USB-Terminal ( But Serial Port is not listed)

I checked in CanbusSerial.Java located in CanBus2_source_from_JADX\sources\com\canbus\data there is mention of baudrate.

4) I am unable to find a way to view serial data to Headunit inside an APK running on Head Unit.

Aim2 - " Modify APK - Change . Java or .json files of canbus.apk

(Missing - 5th Point )

1)Searched for keyword door.

2) Was able to idetify that there is a location CanBus2_source_from_JADX\sources\com\canbus\json\

this might be location for intializing functions and variables for all car features (doors, aircon, trajectory,key etc.)

For Eg: This is java code for door

CardoorSerial.java - CanBus2_source_from_JADX\sources\com\canbus\json\door

package com.canbus.json.door;

import com.canbus.json.p001rx.RxData;
import java.util.List;
import java.util.Set;

public class CarDoorSerial {
private List<CarDoor> carDoors;
private Set<RxData> rxDatas;

public Set<RxData> getRxDatas() {
return this.rxDatas;
}

public void setRxDatas(Set<RxData> rxDatas2) {
this.rxDatas = rxDatas2;
}

public List<CarDoor> getCarDoors() {
return this.carDoors;
}

public void setCarDoors(List<CarDoor> carDoors2) {
this.carDoors = carDoors2;
}

public String toString() {
return "CarDoorSerial{rxData=" + this.rxDatas + ", carDoors=" + this.carDoors + '}';
}
}

3. I was also able to identify a file , where most probably packet is being prepared for sending to Parsing Function which will further be send to display functions.

Jsonutils.java - CanBus2_source_from_JADX\sources\com\canbus\json\utils

public static CarDoorSerial getCarDoorSerial(String json) {
try {
CarDoorSerial carDoorSerial = new CarDoorSerial();
JSONObject carDoorSerialJsonObject = new JSONObject(json);
Set<RxData> rxDatas = new HashSet<>();
List<CarDoor> carDoors = new ArrayList<>();
JSONArray carDoorJsonArray = carDoorSerialJsonObject.getJSONArray("carDoors");
for (int i = 0; i < carDoorJsonArray.length(); i++) {
JSONObject carDoorJsonObject = carDoorJsonArray.getJSONObject(i);
CarDoor carDoor = new CarDoor();
carDoor.setName(carDoorJsonObject.getInt("name"));
carDoor.setDataIndex(carDoorJsonObject.getInt("dataIndex"));
carDoor.setBit(carDoorJsonObject.getInt("bit"));
RxData rxData = new RxData();
rxData.setDataType((byte) Integer.parseInt(carDoorJsonObject.getString("dataType"), 16));
rxData.setLength(Integer.parseInt(carDoorJsonObject.getString("length"), 16));
carDoor.setRxData(rxData);
rxDatas.add(rxData);
carDoors.add(carDoor);
}
carDoorSerial.setRxDatas(rxDatas);
carDoorSerial.setCarDoors(carDoors);
return carDoorSerial;
} catch (JSONException e) {
CatchUtils.catchException(e);
return null;
}
}

4)There is also Canbuserial.Java , In this function there are different serial handler algortihms for different CANbox for eg: Hi World.

public void RxData(byte[] data, int size) {
int baudRate = CanbusStatus.getBaudRate();
this.handler.removeCallbacks(this.delayOvertime);
this.handler.postDelayed(this.delayOvertime, 500);
for (int i = 0; i < size; i++) {
byte[] bArr = this.rx_save;
int i2 = this.rx_put;
this.rx_put = i2 + 1;
bArr[i2] = data[i];
if (this.rx_put >= MAX_SAVE_BYTES) {
this.rx_put = 0;
}
}
switch (baudRate) {
case 9601:
anyuan_rx_uart();
return;
case 9602:
foton_rx_uart();
return;
case 19200:
elysee_rx_uart();
return;
case 19201:
hyudnai_rx_uart();
return;
case 19202:
qiruiA3_rx_uart();
return;
case 19203:
tpms_rx_uart();
return;
case 19205:
case 38403:
hiWorld_rx_uart_aa55();
return;
case 38401:
hiWorld_rx_uart();
return;
case 38402:
X80_rx_uart();
return;
case 38405:
xp_rx_uart_fd();
return;
case 38406:
xp_rx_uart_aa55();
return;
case 38407:
hiWorld_rx_uart_key();
return;
default:
canbox_rx_uart();
return;
}
}

5) How can I find\change the information inside APK file (json \ Java ) for , changing the parsing array match string ( For EG: If there is any match string after parsing the information ) may be, I can send the information from my CAN device to the Android Unit in similar way.

According to the message on UART being recieved, or how can we know the Parsing algorithm (for EG: Array to which receive strings are being matched to get door data etc.)