Skip to content

Improve codebase based on code review findings - #114

Merged
zfdang merged 8 commits into
masterfrom
improve/code-review-fixes
Oct 19, 2026
Merged

zfdang merged 8 commits into
masterfrom
improve/code-review-fixes

Conversation

@zfdang

@zfdang zfdang commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Summary

This pull request implements comprehensive improvements identified during the codebase review. Each issue has been addressed in an individual, atomic commit:

  1. fix: make PackageWidgetDescription equals and hashCode null-safe and comprehensive (f2d86bb)

    • Fixed incomplete and null-unsafe equals and hashCode in PackageWidgetDescription by comparing all relevant fields (packageName, activityName, className, idName, description, text, clickable, onlyClick, and safe coordinates comparison).
    • Added null-safe copy constructor avoiding NPE when position == null.
    • Added unit tests in SkipAdRulesTest verifying reflexivity, symmetry, null-safety, and copy behavior.
  2. fix: dismiss and clean up accessibility overlay views on unbind and interrupt (0655dc0)

    • Stored overlay view references (overlayViewTarget, overlayViewCustomization, overlayImageTarget) in TouchHelperServiceImpl.
    • Added dismissActivityCustomizationDialog() and hooked it into onUnbind(), onInterrupt(), and btQuit to prevent window leaks when service stops while customization overlay is open.
    • Delegated onInterrupt() in TouchHelperService to service implementation.
  3. fix: prevent potential NPE on broadcast reception in broadcast receivers (f166a7c)

    • Guarded against null intent and inverted equals checks in PackageChangeReceiver and UserPresentReceiver.
  4. fix: upgrade rules URL to HTTPS and handle ActivityNotFoundException safely (51f4db8)

    • Upgraded online rules URL from cleartext HTTP to https://touchhelper.zfdang.com/rules.
    • Wrapped startActivity calls with try-catch (ActivityNotFoundException) in ManagePackageWidgetsDialogFragment and HomeFragment to prevent crashes on stripped or custom ROMs lacking standard intents.
  5. refactor: use scheduleWithFixedDelay instead of scheduleAtFixedRate (6594a68)

    • Switched from scheduleAtFixedRate to scheduleWithFixedDelay in TouchHelperServiceImpl to avoid burst periodic execution when system resumes from sleep or under heavy load.
  6. perf: load and sort whitelist apps asynchronously off main thread (40ac357)

    • Offloaded Pinyin conversion and package sorting to a background single-thread executor in SettingsFragment.
    • Extracted type-safe AppInformation implementing Comparable<AppInformation>.
    • Upgraded dialog to androidx.appcompat.app.AlertDialog and passed parent view when inflating items.
  7. refactor: improve Settings thread safety and defensive copies (ab9d1ba)

    • Made cached collections volatile and synchronized whitelist accessors returning defensive copy collections.
    • Guarded package managers lookups against null activityInfo or applicationInfo.
  8. refactor: apply modern Android standards and clean up layout lint warnings (811d543)

    • Migrated <fragment> to <androidx.fragment.app.FragmentContainerView> in activity_main.xml and retrieved NavController via NavHostFragment.
    • Removed redundant android:label on MainActivity in AndroidManifest.xml.
    • Flattened layout_package_information.xml, removed obsolete layout parameters, added constraint bounds to prevent text overlap, and migrated to start/end padding.
    • Fixed inefficient and nested weights in layout_manage_package_widgets.xml.
    • Ignored .omc/ in .gitignore.

Verification

  • ./gradlew testDebugUnitTest and ./gradlew testReleaseUnitTest passed.
  • ./gradlew lintDebug passed without new warnings or errors.

@zfdang
zfdang merged commit e0d093b into master Oct 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant