mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-12 18:57:36 +01:00
[Huawei] Check pinCode and authType not BondState
This commit is contained in:
parent
88043aa813
commit
924088e5a3
@ -246,7 +246,7 @@ public class HuaweiSupportProvider {
|
|||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeDevice(Request linkParamsReq) {
|
protected void initializeDevice(final Request linkParamsReq) {
|
||||||
deviceMac = this.gbDevice.getAddress();
|
deviceMac = this.gbDevice.getAddress();
|
||||||
createRandomMacAddress();
|
createRandomMacAddress();
|
||||||
createAndroidID();
|
createAndroidID();
|
||||||
@ -276,9 +276,9 @@ public class HuaweiSupportProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeDeviceCheckStatus(Request linkParamsReq) {
|
protected void initializeDeviceCheckStatus(final Request linkParamsReq) {
|
||||||
try {
|
try {
|
||||||
GetDeviceStatusRequest deviceStatusReq = new GetDeviceStatusRequest(this, true);
|
final GetDeviceStatusRequest deviceStatusReq = new GetDeviceStatusRequest(this, true);
|
||||||
RequestCallback finalizeReq = new RequestCallback() {
|
RequestCallback finalizeReq = new RequestCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void call() {
|
public void call() {
|
||||||
@ -330,16 +330,16 @@ public class HuaweiSupportProvider {
|
|||||||
return (authType ^ 0x01) == 0x04 || (authType ^ 0x02) == 0x04;
|
return (authType ^ 0x01) == 0x04 || (authType ^ 0x02) == 0x04;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeDeviceDealHiChain(Request linkParamsReq) {
|
protected void initializeDeviceDealHiChain(final Request linkParamsReq) {
|
||||||
try {
|
try {
|
||||||
if (isHiChain()) {
|
if (isHiChain()) {
|
||||||
GetSecurityNegotiationRequest securityNegoReq = new GetSecurityNegotiationRequest(this);
|
final GetSecurityNegotiationRequest securityNegoReq = new GetSecurityNegotiationRequest(this);
|
||||||
RequestCallback securityFinalizeReq = new RequestCallback(this) {
|
RequestCallback securityFinalizeReq = new RequestCallback(this) {
|
||||||
@Override
|
@Override
|
||||||
public void call() {
|
public void call() {
|
||||||
if (securityNegoReq.authType == 0x0186A0 || isHiChain3(securityNegoReq.authType)) {
|
if (securityNegoReq.authType == 0x0186A0 || isHiChain3(securityNegoReq.authType)) {
|
||||||
LOG.debug("HiChain mode");
|
LOG.debug("HiChain mode");
|
||||||
initializeDeviceHiChainMode(linkParamsReq);
|
initializeDeviceHiChainMode(securityNegoReq.authType);
|
||||||
} else if (securityNegoReq.authType == 0x01 || securityNegoReq.authType == 0x02) {
|
} else if (securityNegoReq.authType == 0x01 || securityNegoReq.authType == 0x02) {
|
||||||
LOG.debug("HiChain Lite mode");
|
LOG.debug("HiChain Lite mode");
|
||||||
// Keep track the gadget is connected
|
// Keep track the gadget is connected
|
||||||
@ -369,11 +369,11 @@ public class HuaweiSupportProvider {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
protected void initializeDeviceHiChainMode(Request linkParamsReq) {
|
protected void initializeDeviceHiChainMode(int authType) {
|
||||||
try {
|
try {
|
||||||
GetHiChainRequest hiChainReq = new GetHiChainRequest(this, needsAuth);
|
GetHiChainRequest hiChainReq = new GetHiChainRequest(this, needsAuth);
|
||||||
hiChainReq.setFinalizeReq(configureReq);
|
hiChainReq.setFinalizeReq(configureReq);
|
||||||
if (((GetLinkParamsRequest)linkParamsReq).bondState == 0x00 || ((GetLinkParamsRequest)linkParamsReq).bondState == 0x02) {
|
if (paramsProvider.getPinCode() == null & ((authType ^ 0x04) == 0x01) ) {
|
||||||
GetPincodeRequest pincodeReq = new GetPincodeRequest(this);
|
GetPincodeRequest pincodeReq = new GetPincodeRequest(this);
|
||||||
pincodeReq.nextRequest(hiChainReq);
|
pincodeReq.nextRequest(hiChainReq);
|
||||||
pincodeReq.doPerform();
|
pincodeReq.doPerform();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user