-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stats storages and crash in Aggregate mode #421
base: main
Are you sure you want to change the base?
Conversation
9067374
to
8c9fef2
Compare
@@ -7,7 +7,6 @@ | |||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> | |||
|
|||
<uses-permission | |||
android:requiredFeature="@string/ark_file_picker_pick" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for fixing a side effect when files access permission toggle was disabled, caused by this commit: c7d14c1
@tuancoltech am I right that we only need to bump |
@kirillt This PR doesn't depend on any change in |
@tuancoltech there are some unresolved references in the last build. |
8c9fef2
to
2f6a27d
Compare
2f6a27d
to
bb848c7
Compare
bb848c7
to
4064abb
Compare
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
storage.inputStream() | ||
) | ||
tagLabeledAmount.putAll(json.data) | ||
} catch (exception: Exception) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that just logging the exception can be harmful for the storage. We can have 2 kinds of exception here:
- Exception during decoding the storage, i.e. reading from disk.
- An unlikely problem during
putAll
.
In either case, the tagLabeledAmount
mapping is incorrect. When new stats appear, the will be written to the disk, but only part of the original storage will be written. E.g. if we have 5 entries in the storage, we read 2 of them and then we have an exception. We continue execution with 2/5 entries. Then new entry is coming, so we write 3/6 to the disk. This means we lose some entries in case of the exception.
Stats storage is not that important comparing to tags or scores, but it enhances UX by sorting tags in last-used order. We should avoid losing this data if possible.
Another concern is that the fix is applied to |
But the best approach would be to re-design stats storages... They were implemented during autumn 2022. At summer 2023, we've refactored storages completely and separated reusable primitives. See FileStorage and FolderStorage from arklib-android. In fact, the data stored in stats storages is very simple key-value mapping. I think, it's possible to implement them similarly to ScoreStorage. Scores storage is id-to-integer mapping, and stats storages are either tag-to-integer or tag-to-timestamp. But in any case, the code will be very similar to scores storage. |
They are not quite like I think there is no point in fixing them here; it’s better to move and refactor in arklib-android. |
@mdrlzy good note about debouncing. We can implement such a parameter in our base storage classes. Then stats storage should be similar to score storage, just debounce parameter would differ. |
@tuancoltech let me know if you need help with implementing |
@kirillt Sure, I'll ask here in the case. |
@tuancoltech We might need small refactoring in |
🚀 Summary
Fix crash in Android Navigator, Aggregation mode.
Issue: #412