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
Android: Add Log Configuration to UI #7252
Conversation
|
Please check my comment on #7121 |
|
Addressed @mahdihijazi 's concerns and updated the PR to include #7318. Lint has been giving me a lot of problems though. Any idea how to fix the lint issues? I ran ctrl+alt+L in android studio. |
...ce/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.java
Outdated
Show resolved
Hide resolved
|
Manually fixed the lint errors |
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.
Not a big fan of the way the log types are completely duplicated… Now anyone who wants to add, remove or edit a log type has to update both the C++ code and the Android code, which is unnecessarily time-consuming and error-prone.
The log file configuration keys also shouldn't be duplicated.
Instead, you should interact with the LogManager to query and set log-related settings, log type names and descriptions, etc. I'd recommend looking at DolphinQt's LogConfigWidget.
cb52527
to
06bdd61
Compare
890f3dc
to
dd42e0e
Compare
7825dd7
to
7a8ab60
Compare
|
It's working as expected even with debug logs (I had to build my own APK with the CMake flag |
|
@sepalani Let me know if you want me to squash the commits after review. |
|
It's a bit sad that you have to duplicate these arrays to handle this case. Though, I don't think there is much you can do without changing the way these SettingsItem classes work and how tied they are with Android resources which are read-only. Otherwise, this change looks fine to me. I also don't mind having these as two commits as they make sense separated. If you feel they don't, feel free to squash them together. |
|
I agree that the duplication is annoying but there are other cases in Dolphin that handle this issue in the same way I did. I'd rather change them all in a separate PR in the future. |
815775c
to
4b10c13
Compare
|
Can we can get this merged too? It'll help with debugging issues. |
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.
I reviewed the C++ side of the PR.
...ava/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/CheckBoxSettingViewHolder.java
Outdated
Show resolved
Hide resolved
4198480
to
97d42f7
Compare
|
@JosJuice I think I took care of the remaining unresolved comments but they should probably be checked again. I also took care of simple clang-tidy suggestions on the C++ side and squashed the related commits. |
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.
I would prefer if the clang-tidy fixes were applied in a different commit (or even in a different PR), since they don't have much to do with the other changes.
3853706
to
dbc67b0
Compare
|
Comments addressed and Clang-Tidy changes moved to separate PR. I also added |
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 should hopefully be the last review round.
...ndroid/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsAdapter.java
Outdated
Show resolved
Hide resolved
|
|
||
| public final class SettingsFragmentPresenter | ||
| { | ||
| private SettingsFragmentView mView; | ||
|
|
||
| public static final LinkedHashMap<String, String> LOG_TYPE_NAMES = | ||
| NativeLibrary.GetLogTypeNames(); |
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.
Is this guaranteed to run after NativeLibrary.Initialize? I don't believe it will work correctly otherwise.
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.
From my testing I haven't seen any problems here. Should I add a method that sets this LinkedHashMap and call it with AfterDirectoryInitializationRunner.run immediately after NativeLibrary.Initialize for an abundance of caution?
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.
Please see the latest commit. Let's (hopefully) prevent a lot of problems with calling NativeLibrary by completing initialization before launching Settings and Emulation activities.
The last commit should also address this review comment.
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.
I'm still not sure if there is any guarantee that things will execute in the right order. The information I can find is that static variables will be initialized when the class is loaded, but I can't find anything about when specifically classes actually are loaded.
If you are going to gate launching the settings activity behind directory initialization, please keep in mind that there already is a check for that here, and I would prefer only having one check for it for the settings (but perhaps your new location for it is better?):
Line 85 in 63c53eb
| private void prepareDolphinDirectoriesIfNeeded() |
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.
I put a breakpoint on NativeLibrary.GetLogTypeNames and indeed it was called when the class was loaded. The class is only (eventually) called through SettingsActivity.launch. I may be missing something but it seems this shouldn't cause any problems. I'll look into the second part of your response soon.
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.
Reverted the last commit. We eventually call DirectoryInitialization.areDolphinDirectoriesReady() for both Settings and Emulation fragments. Also, SettingsActivity.launch adds a static context so it isn't worth changing the check to there.
dc5bcef
to
d34fc8e
Compare
Hasn't commented on the PR in months, and the problem is fixed as far as I can tell
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.
I still don't really like relying on undocumented class loading behavior, but I suppose that the behavior isn't going to change without a point release of Android and accompanying compatibility change notes, so if the behavior is going to change in the future, we can deal with it when it happens. LGTM other than one comment.
Implements https://bugs.dolphin-emu.org/issues/10709.