0

I am trying to write my own AB STREAMING update based on https://android.googlesource.com/platform/bootable/recovery/+/master/updater_sample and after many days of developing and decomposing looks it good.

But I have big problem with using https protocol (which is required by default). When i try to call method applyUpdate(Context context, UpdateConfig config) from UpdateManager, I got error 9 (DOWNLOAD_TRANSFER_ERROR) immediately.

It's interesting, because all other metadata were downloaded without problems. It looks problem is only with downloading of payload.bin. When I try to change protocol from https to http (by enabling in manifest of course and changing link in json file) no problem appeared.

So questions are:

Is it bug in android? Do you have the same problem (I found another question one year ago but without reaction). Is there any special request for https, webserver...

Yes, I can leave http protocol enable, but I am afraid of new steps from Google, they can forbid this option.

Thank you D

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Darius Radius
  • 169
  • 3
  • 14
  • Have a look at the update_engine's log, it may give your some information. system/update_engine/libcurl_http_fetcher.cc LOG(INFO) << "Transfer resulted in an error (" << http_response_code_ << "), " << bytes_downloaded_ << " bytes downloaded"; – Yong Mar 25 '22 at 05:19
  • Hello, sorry for long time answer, I was ill. I dont know, how do you meant it? Which log and how I can get it? You mean edit this file and compile android? – Darius Radius May 04 '22 at 13:28
  • get android log by “adb logcat” – Yong May 05 '22 at 07:12

1 Answers1

0

I was facing a similar issue where the Streaming AB OTA update was failing with error 9 (DOWNLOAD_TRANSFER_ERROR) but on Android 10.

Here are the logs from my device

E/update_engine: [1003/030413.677875:ERROR:libcurl_http_fetcher.cc(436)] Unable to get http response code.
I/update_engine: [1003/030413.678370:INFO:libcurl_http_fetcher.cc(467)] Transfer resulted in an error (0), 46484 bytes downloaded
I/update_engine: [1003/030413.678435:INFO:libcurl_http_fetcher.cc(481)] No further proxies, indicating transfer complete
I/update_engine: [1003/030413.678483:INFO:multi_range_http_fetcher.cc(172)] Received transfer complete.
I/update_engine: [1003/030413.678528:INFO:multi_range_http_fetcher.cc(129)] TransferEnded w/ code 0
I/update_engine: [1003/030413.678572:INFO:multi_range_http_fetcher.cc(144)] Didn't get enough bytes. Ending w/ failure.
I/update_engine: [1003/030413.678675:INFO:action_processor.cc(116)] ActionProcessor: finished DownloadAction with code ErrorCode::kDownloadTransferError
I/update_engine: [1003/030413.678723:INFO:action_processor.cc(121)] ActionProcessor: Aborting processing due to failure.
I/update_engine: [1003/030413.678785:INFO:update_attempter_android.cc(454)] Processing Done.
I/update_engine: [1003/030413.678834:INFO:dynamic_partition_control_android.cc(151)] Destroying [] from device mapper
D/OTAManager: onStatusUpdate invoked, status=0, progress=0.00
D/OTAService: onProgressUpdate() called
D/OTAService: OTA Progress :0
I/OTAService: onEngineStatusUpdate - status=IDLE/0
D/OTAService: Sending Response to Client:- Msg:6 Data:0 Status:IDLE D/OTAManager: onPayloadApplicationComplete invoked, errorCode=9
D/OTAManager: setUpdaterState invoked newState=1
D/OTAService: onUpdaterStateChange state=ERROR/1
I/OTAService: onEnginePayloadApplicationComplete - errorCode=OS Update failed due to an error in fetching the payload/9 FAILURE

"libcurl_http_fetcher.cc: Unable to get HTTP response" => This is the culprit.

To know why this is happening I ran the following commands:

adb shell
curl -i https://myurl

To which the response was

curl: (60) SSL certificate problem: certificate has expired More details here: https://curl.haxx.se/docs/sslcerts.html
curl failed to verify the legitimacy of the server and therefore could not establish a secure connection to it. To learn more about this situation and how to fix it, please visit the web page mentioned above.

I guess I need to update the SSL certificate on the server. However, your issue might not be exactly the same. But running the "curl" command from ADB shell might give you a clue.

Hope this helps.