Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zacharee/42a240106a94252aa90adc24ab9ae765 to your computer and use it in GitHub Desktop.
Save zacharee/42a240106a94252aa90adc24ab9ae765 to your computer and use it in GitHub Desktop.
public String GetHVTAS() {
String sResult;
if ("h1".equals(Build.DEVICE) || "alicee".equals(Build.DEVICE) || "elsa".equals(Build.DEVICE)) {
String sResult_hvdcp = ReadStringFromFile("/sys/class/power_supply/usb/hvdcp_type");
Log.e("ChargingTest", "sResult_hvdcp " + sResult_hvdcp);
if ("0".equals(sResult_hvdcp)) {
sResult = "OFF";
} else if ("1".equals(sResult_hvdcp) || "4".equals(sResult_hvdcp)) {
sResult = "QC2.0 TA";
} else if ("2".equals(sResult_hvdcp) || "3".equals(sResult_hvdcp)) {
sResult = "EVP TA";
} else {
Log.i("ChargingTest", "is_hvdcp_ta : " + sResult_hvdcp);
sResult = "Not support";
}
} else if ("pplus".equals(Build.DEVICE) || "lexusm".equals(Build.DEVICE) || "b3".equals(Build.DEVICE) || "NSO".equals(Build.DEVICE)) {
String sResult_evp = ReadStringFromFile("/sys/class/power_supply/battery/is_evp_ta");
String sResult_qc20 = ReadStringFromFile("/sys/class/power_supply/battery/is_qc20_ta");
if (sResult_evp.equals("1") && sResult_qc20.equals("0")) {
return "EVP TA";
}
if (sResult_qc20.equals("1") && sResult_evp.equals("0")) {
return "QC2.0 TA";
}
if (sResult_evp.equals("0") && sResult_qc20.equals("0")) {
sResult = "OFF";
} else {
Log.i("ChargingTest", "is_evp_ta : " + sResult_evp);
Log.i("ChargingTest", "is_qc20_ta : " + sResult_qc20);
sResult = "Not support";
}
} else {
sResult = ReadStringFromFile(14);
if (sResult.equals("--")) {
sResult = "Not support";
} else if (sResult.equals("1")) {
sResult = "On";
} else {
sResult = "OFF";
}
}
return sResult;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment