phhusson / treble_experimentations

Notes about tinkering with Android Project Treble
3.42k stars 661 forks source link

Support OTAs #240

Open phhusson opened 6 years ago

phhusson commented 6 years ago

Currently there is some very basic mechanism to support local update on A-only devices: https://github.com/phhusson/device_phh_treble/blob/android-8.1/twrp/twrp.sh Also this has only been validated on Oreo, not Pie

Next step is to turn this into an OTA.

A simple first step would be to trigger only on user request, and list all github releases, to select from it. I don't want to do periodic checks yet, to be able to have relatively smooth deployment, rather than having everyone get the update day 1. Progressive update will require some actual OTA backend, which will take some additional time.

Gouster4 commented 4 years ago

What about A/B ota without recovery?

phhusson commented 4 years ago

right, that one could be easier since updating system simply means copying other partitions. I don't have many a/b devices to test with (read: that could make an extensive brick) Fwiw I gave a look at update_engine, to see what could be done, but for the moment that's a fail.

Le jeu. 12 déc. 2019 à 09:25, Gouster4 notifications@github.com a écrit :

What about A/B ota without recovery?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phhusson/treble_experimentations/issues/240?email_source=notifications&email_token=AAAA4OVSEYXUXBXIFICHZWDQYHYRBA5CNFSM4FZLIXVKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGV3PKA#issuecomment-564901800, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAA4OVSPDUQQUXEPODWMILQYHYRBANCNFSM4FZLIXVA .

Mushoz commented 4 years ago

Any news regarding a simple OTA functionality for this ROM?

phhusson commented 4 years ago

Since it's easy PR is welcome :-)

Le jeu. 9 avr. 2020 à 12:10, Jaap Buurman notifications@github.com a écrit :

Any news regarding a simple OTA functionality for this ROM?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phhusson/treble_experimentations/issues/240#issuecomment-611447204, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAA4ORSNR4B2Y4SU7MZELTRLWNI5ANCNFSM4FZLIXVA .

Mushoz commented 4 years ago

My apologies for the confusion :) I never meant to insinuate it was going to be easy to implement. With "simple", I meant a very bare-bones OTA mechanism. For example, downloading the entire ROM instead of doing smart delta updates. And no advanced / additional features. A nice version would be:

1) An automatic check every X days to the releases section of this github to check for new versions. 2) Notify if a new version is available with an android notification. 3) And then either: -A reboot to recovery button -(preferably) An install button that automatically fires up a script for TWRP to actually install the newly downloaded ROM.

Mushoz commented 4 years ago

Also, a good way to make sure not everyone installs a new version automatically at the same time WITHOUT having to make some OTA backend for that functionality, would be the following:

1) A random time between now & in 2 weeks is selected. This is going be the FIRST occasion a check for a new version on Github is done. 2) From that point on, every 2 weeks a new check is done.

Since every phone will pick a random first time to do the check, all update checks will be out of sync, and hence a new version will hit devices in a 2 week period rather than all at once. This two week window is just a suggestion, but can be increased/decreased.

Mushoz commented 4 years ago

Another staged rollout without central backend Idea just popped in my head: 1) each device checks daily to see if there is a new update 2) If if finds a new update it will pick a random number from a uniform random number distribution from 0 through 1. If the number is 0.01 (example value) or lower it will notify the user of the update. This will ensure that on day one effectively 1% of the userbase will update. 3) The next day, it will pick another random number and will now prompt the user if the value is 0.1 or lower, which effectively results in 10% of the userbase that hasn't updated yet to update. 4) etc

The time between the increase in the probability and the probability of prompting for an update at each time interval is up for debate, but this would allow us to make any desired staged rollout curve without central authority / backend.

Aeris1One commented 4 years ago

What about this? It sounds like a very useful feature, is someone working on OTA ?

phhusson commented 4 years ago

There is some preliminary partial OTA support here: https://github.com/phhusson/device_phh_treble/blob/android-10.0/files/ota.sh but it's very hard to guarantee it works on devices, because depending on the type of device, there are various ways to do the OTA.

My plan is to concentrate on dynamic partition devices, since implementing fake A/B is very easy with it (as implemented in the ota.sh mentioned above). Even though updating non-dynamic devices is feasible, it'd be very hard to stabilize, so i'd rather not do it.

Current ota.sh for dynamic partitions is lacking many things:

  1. Support of A/B devices
  2. Checking super is big enough
  3. Checking errors
  4. Expand over userdata partition like Android 11's Virtual A/B does, so that there is no requirement on super partition size

Le jeu. 22 oct. 2020 à 23:07, Aeris One notifications@github.com a écrit :

What about this? It sounds like a very useful feature, is someone working on OTA ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/phhusson/treble_experimentations/issues/240#issuecomment-714762687, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAA4OWO23PGMQK3FN2ZMS3SMCNIZANCNFSM4FZLIXVA .