When update is detected through checker, the Updatechecklistener in Updateprompt is notified.
1. Updatechecklistener.oncheckcomplete
Oncheckcomplete:functionUcl_oncheckcomplete (Request, updates, Updatecount) {if(Services.um.activeUpdate) {//We ' re actively downloading an update, which that ' s the update the user should //See , even if a newer update is available. This. _updateprompt.setupdatestatus ("Active-update"); This. _updateprompt.showupdateavailable (Services.um.activeUpdate); return; } if(Updatecount = = 0) { This. _updateprompt.setupdatestatus ("No-updates"); if( This. _updateprompt._systemupdatelistener) { This. _updateprompt._systemupdatelistener.onerror ("No-updates"); } return; }
Service.aus is the Updateservice object in Nsupdateservice.js.
Selectupdate will return one of the appropriate update objects in the updates through some preset policy
Let update = Services.aus.selectUpdate (updates, updatecount); if(!update) { This. _updateprompt.setupdatestatus ("Already-latest-version"); if( This. _updateprompt._systemupdatelistener) { This. _updateprompt._systemupdatelistener.onerror ("Already-latest-version"); } return; } This. _updateprompt.setupdatestatus ("Check-complete");
//Notify Updateprompt that an update is available This . _updateprompt.showupdateavailable (update);},
2. updateprompt.showupdateavailable (UPDATE)
Showupdateavailable:functionup_showupdateavailable (aupdate) {Let PackageInfo= {}; Packageinfo.version=aupdate.displayversion; Packageinfo.description=Aupdate.statustext; Packageinfo.builddate=Aupdate.buildid; //Returns a selected patch, or the first patch Let patch = Aupdate.selectedpatch; if(!patch && aupdate.patchcount > 0) { //For now We just check the first patch to get size information if a //patch hasn ' t been selected yet.Patch = Aupdate.getpatchat (0); } if(patch) {packageinfo.size=patch.size; Packageinfo.type=Patch.type; } Else{log ("Warning:no patches available in Update"); } This. _pendingupdateavailablepackageinfo =PackageInfo; if( This. _systemupdatelistener) { This. _systemupdatelistener.onupdateavailable (Packageinfo.type, Packageinfo.versi On, Packageinfo.description, Packagein Fo.builddate, packageinfo.size); //Set NULL Since the event is fired. This. _pendingupdateavailablepackageinfo =NULL; }
Send ' update-available ' event, in fact, is sent by systemappproxy a ' mozchromeevent ',
//Also send some accompanying information, such as selected patch size and patch type. Who is the receiver? Can be guessed, is the previous analysis of the Systemapp in the Updatemanager. if(!This . Sendupdateevent ("update-available" , aupdate)) {Log ("Unable to prompt for available update, forcing download"); This. Downloadupdate (aupdate); }},
(Ffos Gecko & Gaia) OTA-Processing Check results