Don't show progress for every app being processed from index.xml.
Rather, only show 25 progress events. I went with "25 events" rather than "every X apps" because then it will be nice for both large repos (e.g. F-Droid will update every ~50 apps) and small repos (something with 20 apps will update for every one, but not add much overhead). On my testing with an API 11 emulator here, it went from ~32s to process ~1100 apps to ~20s. When no progress events are sent, then it also takes ~20s, so this essentially is a 50% improvement for this part of the update process.
This commit is contained in:
parent
481cd91646
commit
e4401ed22c
@ -21,6 +21,8 @@
|
|||||||
* Initial support for root and system installers, allowing the client to
|
* Initial support for root and system installers, allowing the client to
|
||||||
install apks directly on its own
|
install apks directly on its own
|
||||||
|
|
||||||
|
* Increased performance when updating from repository with many apps
|
||||||
|
|
||||||
* Switch to Appcompat from the Support library
|
* Switch to Appcompat from the Support library
|
||||||
|
|
||||||
* Fix some crashes
|
* Fix some crashes
|
||||||
|
@ -279,14 +279,15 @@ public class RepoXMLHandler extends DefaultHandler {
|
|||||||
} else if (localName.equals("application") && curapp == null) {
|
} else if (localName.equals("application") && curapp == null) {
|
||||||
curapp = new App();
|
curapp = new App();
|
||||||
curapp.id = attributes.getValue("", "id");
|
curapp.id = attributes.getValue("", "id");
|
||||||
|
if (progressCounter % (totalAppCount / 25) == 0) {
|
||||||
|
Bundle data = new Bundle(1);
|
||||||
|
data.putString(RepoUpdater.PROGRESS_DATA_REPO_ADDRESS, repo.address);
|
||||||
|
progressListener.onProgress(
|
||||||
|
new ProgressListener.Event(
|
||||||
|
RepoUpdater.PROGRESS_TYPE_PROCESS_XML,
|
||||||
|
progressCounter, totalAppCount, data));
|
||||||
|
}
|
||||||
progressCounter ++;
|
progressCounter ++;
|
||||||
Bundle data = new Bundle(1);
|
|
||||||
data.putString(RepoUpdater.PROGRESS_DATA_REPO_ADDRESS, repo.address);
|
|
||||||
progressListener.onProgress(
|
|
||||||
new ProgressListener.Event(
|
|
||||||
RepoUpdater.PROGRESS_TYPE_PROCESS_XML,
|
|
||||||
progressCounter, totalAppCount, data));
|
|
||||||
|
|
||||||
} else if (localName.equals("package") && curapp != null && curapk == null) {
|
} else if (localName.equals("package") && curapp != null && curapk == null) {
|
||||||
curapk = new Apk();
|
curapk = new Apk();
|
||||||
curapk.id = curapp.id;
|
curapk.id = curapp.id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user