Refactor data layer: extract data models, add repository pattern, fix null safety and lifecycle leaks#212
Draft
Copilot wants to merge 3 commits intokt-rewritefrom
Draft
Refactor data layer: extract data models, add repository pattern, fix null safety and lifecycle leaks#212Copilot wants to merge 3 commits intokt-rewritefrom
Copilot wants to merge 3 commits intokt-rewritefrom
Conversation
…issues in services - Rename lastBackPressTimeStamp → lastGlobalActionTimestamp (BaseBlockingService) - Rename lastPackage → lastForegroundPackage (AppBlockerService) - Rename lastPackageName → lastForegroundPackage (GeneralFeaturesService) - Rename handler/updateRunnable → recheckHandler/recheckRunnable (AppBlockerService) - Rename handler/updateRunnable → timeTrackingHandler/timeTrackingRunnable (UsageTrackingService) - Rename userYSwipeEventCounter → scrollEventCounter (UsageTrackingService) - Rename accumulatedTime → accumulatedScreenTime (UsageTrackingService) - Rename lastEventTimeStamp → lastContentChangeTimestamp (ViewBlockerService, KeywordBlockerService, UsageTrackingService) - Rename refreshCooldown → eventThrottleDelayMs (KeywordBlockerService) - Rename KbIgnoredApps → keywordBlockerIgnoredApps (KeywordBlockerService) - Rename rootnode → rootNode (KeywordBlockerService) - Rename checkIfUserGettingFreaky → detectBlockedKeywords (KeywordBlocker) - Rename cheatMinutesEndTIme → cheatMinutesEndTime (ViewBlocker) - Fix var → val for displayMetrics (ViewBlockerService) - Extract applyGrayscaleForPackage method (GeneralFeaturesService) - Extract handleContentChanged, handleViewScrolled, handleYouTubeScroll methods (UsageTrackingService) - Remove unused supportsViewScrolled field (UsageTrackingService) - Fix memory leak: add missing unregisterReceiver(refreshReceiver) in UsageTrackingService.onDestroy - Fix memory leak: add missing onDestroy with unregisterReceiver in GeneralFeaturesService - Fix memory leak: clean up recheckHandler in AppBlockerService.onDestroy - Fix resource leak: add overlay cleanup in UsageTrackingService.onDestroy Co-authored-by: nethical6 <79095297+nethical6@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor core system services for improved readability
Refactor AccessibilityService implementations: naming, modularity, lifecycle leak fixes
Feb 16, 2026
…tory, improve null safety - Create AppUsageStat data class in data/models/ to decouple from UI layer - Create UsageStatsRepository interface with suspend functions and Result wrapping - Create UsageStatsRepositoryImpl with Dispatchers.IO threading via coroutines - Add Long.toFormattedTime() and Long.toFormattedTimeCompact() extension functions - Update UsageStatsHelper to use AppUsageStat, add null safety for UsageStatsManager/appProcesses - Update AllAppsUsageFragment, AppUsageBreakdown, ScreentimeWidgetProvider to use AppUsageStat - Deprecate AllAppsUsageFragment.Stat with migration guidance Co-authored-by: nethical6 <79095297+nethical6@users.noreply.github.com>
Copilot
AI
changed the title
Refactor AccessibilityService implementations: naming, modularity, lifecycle leak fixes
Refactor data layer: extract data models, add repository pattern, fix null safety and lifecycle leaks
Feb 17, 2026
| } | ||
|
|
||
| fun checkIfUserGettingFreaky( | ||
| fun detectBlockedKeywords( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactors the core system services and data/usage tracking layer to improve readability, modularity, and correctness. Fixes memory leaks from unregistered receivers and null-unsafe UsageStatsManager access.
Service layer refactoring
lastPackage→lastForegroundPackage,lastBackPressTimeStamp→lastGlobalActionTimestamp,handler/updateRunnable→recheckHandler/recheckRunnable,KbIgnoredApps→keywordBlockerIgnoredApps,checkIfUserGettingFreaky()→detectBlockedKeywords(),cheatMinutesEndTIme→cheatMinutesEndTimehandleContentChanged(),handleViewScrolled(),handleYouTubeScroll()from monolithiconAccessibilityEventinUsageTrackingService; extractedapplyGrayscaleForPackage()inGeneralFeaturesServiceGeneralFeaturesServiceonDestroy()—refreshReceiverwas never unregisteredUsageTrackingServiceunregisterReceiver(refreshReceiver)+removeOverlay()inonDestroy()AppBlockerServicerecheckRunnablecancellation inonDestroy()Data layer refactoring
AllAppsUsageFragment.Stat→data/models/AppUsageStat.ktto decouple data from UIUsageStatsRepositoryinterface +UsageStatsRepositoryImplwithDispatchers.IOandResultwrapping viarunCatchingUsageStatsManagercast changed fromastoas?; null-checks added forrunningAppProcessesandqueryEvents()returnsLong.toFormattedTime()andLong.toFormattedTimeCompact()inTimeTools.ktAllAppsUsageFragment,AppUsageBreakdown,ScreentimeWidgetProvider,AppBlocker) to useAppUsageStatWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dl.google.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/lib/gradle-daemon-main-8.10.2.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/lib/agents/gradle-instrumentation-agent-8.10.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 8.10.2(dns block)If you need me to access, download, or install something from one of these locations, you can either:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.