Removed usage stats service as it is too unstable#361
Merged
Conversation
This change introduces synchronous data retrieval methods to the AppSettings repository and DAO, refactors build-logic convention plugins, and updates the service feature's permission handling. - **Data Layer**: Added non-`Flow` returning methods to `AppSettingsDao` and `AppSettingsRepository`. Existing `Flow` methods were renamed to include a `Flow` suffix (e.g., `getAppSettingsFlowByPackageName`) for clarity. - **Use Cases**: Refactored `ApplyAppSettingsUseCase` and `AddAppSettingUseCase` to use direct repository calls instead of `Flow.first()`, wrapping operations in `withContext(defaultDispatcher)`. - **Build Logic**: Consolidated Compose configuration by updating `configureCompose` to accept a `CommonExtension` parameter. Simplified `AndroidApplicationConventionPlugin` and `AndroidLibraryComposeConventionPlugin` to use this unified helper. - **Service Feature**: Updated `ServiceViewModel` to check for usage stats permissions via `UsageStatsManagerWrapper` before updating the foreground service. Added the `domain:framework` dependency to `feature:service`. - **ProGuard**: Refactored `proguard-rules.pro` to keep `domain.model` package names and enum members while removing unnecessary library-specific warnings. - **Refactoring**: Migrated `DefaultAppSettingsRepository` mapping logic to extension functions and improved the use of named parameters.
This change migrates all domain-related modules to pure Kotlin JVM libraries, removing dependencies on the Android Gradle plugin where not required. It also cleans up unused logic related to usage statistics and foreground service management. - Migrated `domain:common`, `domain:framework`, `domain:model`, `domain:repository`, and `domain:use-case` to use the `jvmLibrary` plugin. - Removed Android-specific configurations, including namespaces and consumer ProGuard rules, from domain modules. - Deleted usage stats and foreground service coordination logic: `ForegroundServiceAppSettingsUseCase`, `UsageStatsManagerWrapper`, and associated models. - Updated `AppSettingsRepository` and `AppSettingsDao` to use `suspend` functions for fetching settings by package name. - Removed unused `appSettings` property and `getAppSettingEntities()` query from the repository and DAO. - Cleaned up unused imports in `ApplyAppSettingsUseCase` and `AddAppSettingUseCase`. - Refined annotation usage for `CoroutineDispatcher` in `RevertAppSettingsUseCase`.
- Deleted `AppSettingsDaoTest.kt` and `MigrationTest.kt` from the `data:room` module. - Updated `.idea/androidTestResultsUserPreferences.xml` with new device test metadata.
- Added `testInstrumentationRunner` to `defaultConfig` in `data:room/build.gradle.kts`.
This change adds the core, runner, rules, and JUnit KTX extension libraries to `androidTestImplementation` in `app/build.gradle.kts`.
|
It was a shame to remove usage stats service. Though some of the behaviours was weird, it was possible to live it it. Keeping it as an optional or advanced user feature would have been great. |
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.
No description provided.