Skip to content

Commit

Permalink
Remove parallel streams for loading data in Deep Search
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamza417 committed Aug 1, 2024
1 parent 799cfb0 commit 16b8025
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 6 deletions.
252 changes: 252 additions & 0 deletions .idea/other.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions app/src/main/assets/html/changelogs.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ <h4>User Interface</h4>
<li>Collapsible menu for <b>Search</b> to allow for adding more icons and still preserve space.
</li>
<li>Added filter button and relocated refresh button in <b>Search</b>.</li>
<li>Added keyword database for <i>Android Permissions</i> and <i>Tracker Signatures</i> for <b>Deep Search</b>.</li>
<li>Added keyword database for <i>Android Permissions</i> and <i>Tracker Signatures</i> for <b>Deep
Search</b>.
</li>
<li>Added information whether app supports cloud backup or not in <b>Information</b> panel.</li>
<li>Added custom layer for predictive back gesture animations.
<br>
Expand All @@ -48,7 +50,10 @@ <h4>Improvements</h4>
<h4>Behavior</h4>

<ul>
<li>Clear button in tag search mode should clear keywords first in <b>Search</b> panel..</li>
<li>Clear button in tag search mode should clear keywords first in <b>Search</b> panel.</li>
<li>It's unsafe to imply concurrency while loading package infos, can overload the system and
may cause unexpected crashes. <b>Deep Search</b> may work slightly slower now.
</li>
</ul>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ class SearchViewModel(application: Application) : PackageUtilsViewModel(applicat
}

private fun loadDataForDeepSearch(list: ArrayList<PackageInfo>) {
list.parallelStream().forEach {
try {
list.forEach {
kotlin.runCatching {
val pkg = packageManager.getPackageInfo(it.packageName, FLAGS)
pkg.applicationInfo.name = it.applicationInfo.name
deepPackageInfos.addIfNotExists(pkg, comparator = { a, b -> a?.packageName == b?.packageName })
} catch (e: NameNotFoundException) {
Log.e(TAG, e.stackTraceToString())
}.getOrElse {
Log.e(TAG, it.stackTraceToString())
}
}
}
Expand Down

0 comments on commit 16b8025

Please sign in to comment.