huawei: Do not apply encryption to FileUpload on non encrypted devices

* Do not encrypt file payload on devices where
paramsProvider.areTransactionsCrypted() == false because there is not
even valid key avaliable. Related devices is older  Honor (Watch Magic 2,
GS Pro, GS3) and newer Honor (Watch 4, Watch 4 Pro)
This commit is contained in:
Vitaliy Tomin
2025-03-24 16:21:43 +08:00
committed by José Rebelo
parent ce5881df12
commit f354941bb6

View File

@@ -38,12 +38,13 @@ public class SendFileUploadChunk extends Request {
@Override
protected List<byte[]> createRequest() throws RequestCreationException {
try {
boolean isEncrypted = huaweiUploadManager.getFileUploadInfo().getEncrypt() && paramsProvider.areTransactionsCrypted();
return new FileUpload.FileNextChunkSend(this.paramsProvider).serializeFileChunk(
huaweiUploadManager.getFileUploadInfo().getCurrentChunk(),
huaweiUploadManager.getFileUploadInfo().getCurrentUploadPosition(),
huaweiUploadManager.getFileUploadInfo().getUnitSize(),
huaweiUploadManager.getFileUploadInfo().getFileId(),
huaweiUploadManager.getFileUploadInfo().getEncrypt()
isEncrypted
);
} catch(HuaweiPacket.SerializeException e) {
throw new RequestCreationException(e.getMessage());