Modern Apps git

← Modern-Apps.git

screentime: document public API for detekt

Commit
f2ddb78184406bb4d820e52bd4e72c2177207654
Author
Vayun Mathur <[email protected]>
When
2026-11-17 14:42 UTC (19 days ago)
Parents
6eeaec2
Add concise KDoc to every public class, object, interface and
enum (including nested types) that detekt's
UndocumentedPublicClass rule flagged in this module. Docs only:
no behaviour, visibility or config changes.

Verified: ./gradlew :screentime:detekt reports 0
UndocumentedPublicClass findings (pre-existing error-severity
findings in other rules, where present, are untouched), and the
module unit tests pass.

Diff

screentime/src/main/java/com/vayunmathur/screentime/MainActivity.kt
diff --git a/screentime/src/main/java/com/vayunmathur/screentime/MainActivity.kt b/screentime/src/main/java/com/vayunmathur/screentime/MainActivity.ktindex 5049367a96..270ae52583 100644--- a/screentime/src/main/java/com/vayunmathur/screentime/MainActivity.kt+++ b/screentime/src/main/java/com/vayunmathur/screentime/MainActivity.kt@@ -52,6 +52,7 @@ class MainActivity : MaActivity() {         viewModel.refresh()     } +    /** Intent actions and extras for launching [MainActivity] screens. */     companion object {         const val EXTRA_DETAILS_PACKAGE = "com.vayunmathur.screentime.extra.DETAILS_PACKAGE" 
screentime/src/main/java/com/vayunmathur/screentime/data/Rules.kt
diff --git a/screentime/src/main/java/com/vayunmathur/screentime/data/Rules.kt b/screentime/src/main/java/com/vayunmathur/screentime/data/Rules.ktindex d2c20e3667..d10d713d62 100644--- a/screentime/src/main/java/com/vayunmathur/screentime/data/Rules.kt+++ b/screentime/src/main/java/com/vayunmathur/screentime/data/Rules.kt@@ -29,6 +29,7 @@ data class PausedApps(     /** Packages currently paused by the user. */     val pausedPackages: List<String> = emptyList(), ) {+    /** Singleton row identifier for [PausedApps]. */     companion object {         /** There is one row. The table exists so Room can store it, not to hold many. */         const val SINGLETON_ID = 0@@ -57,6 +58,7 @@ data class WindDownSchedule(     /** Whether to enter Do Not Disturb during wind-down. */     val doNotDisturb: Boolean = true, ) {+    /** Singleton identifier and day/default constants for [WindDownSchedule]. */     companion object {         /** There is one schedule. The table exists so Room can store it, not to hold many. */         const val SINGLETON_ID = 0
screentime/src/main/java/com/vayunmathur/screentime/data/ScreenTimeDatabase.kt
diff --git a/screentime/src/main/java/com/vayunmathur/screentime/data/ScreenTimeDatabase.kt b/screentime/src/main/java/com/vayunmathur/screentime/data/ScreenTimeDatabase.ktindex a8e5ea2e1a..396aa52a71 100644--- a/screentime/src/main/java/com/vayunmathur/screentime/data/ScreenTimeDatabase.kt+++ b/screentime/src/main/java/com/vayunmathur/screentime/data/ScreenTimeDatabase.kt@@ -15,6 +15,7 @@ import kotlinx.coroutines.flow.map  const val DB_NAME = "screentime-db" +/** Room DAO for per-app daily timers. */ @Dao interface AppTimerDao {     @Query("SELECT * FROM AppTimer ORDER BY packageName")@@ -33,6 +34,7 @@ interface AppTimerDao {     suspend fun delete(timer: AppTimer) } +/** Room DAO for the singleton paused-apps row. */ @Dao interface PausedAppsDao {     @Query("SELECT * FROM PausedApps WHERE id = :id")@@ -45,6 +47,7 @@ interface PausedAppsDao {     suspend fun upsert(paused: PausedApps) } +/** Room DAO for the singleton wind-down schedule. */ @Dao interface WindDownDao {     @Query("SELECT * FROM WindDownSchedule WHERE id = :id")@@ -63,6 +66,7 @@ interface WindDownDao {     version = 2,     exportSchema = false, )+/** Room database holding app timers, paused apps and the wind-down schedule. */ abstract class ScreenTimeDatabase : RoomDatabase() {     abstract fun appTimerDao(): AppTimerDao     abstract fun pausedAppsDao(): PausedAppsDao@@ -116,6 +120,7 @@ class ScreenTimeRules private constructor(context: Context) :      suspend fun setWindDown(schedule: WindDownSchedule) = windDown.upsert(schedule) +    /** Process-wide singleton accessor for [ScreenTimeRules]. */     companion object {         @Volatile private var instance: ScreenTimeRules? = null 
screentime/src/main/java/com/vayunmathur/screentime/platform/Receivers.kt
diff --git a/screentime/src/main/java/com/vayunmathur/screentime/platform/Receivers.kt b/screentime/src/main/java/com/vayunmathur/screentime/platform/Receivers.ktindex a5349eff45..50a5d4da50 100644--- a/screentime/src/main/java/com/vayunmathur/screentime/platform/Receivers.kt+++ b/screentime/src/main/java/com/vayunmathur/screentime/platform/Receivers.kt@@ -39,6 +39,7 @@ class TimerReachedReceiver : BroadcastReceiver() {         }     } +    /** Intent factory for [TimerReachedReceiver]. */     companion object {         fun intent(context: Context, packageName: String): Intent =             Intent(context, TimerReachedReceiver::class.java)@@ -75,6 +76,7 @@ class ScheduleReceiver : BroadcastReceiver() {         }     } +    /** Intent factory for [ScheduleReceiver]. */     companion object {         fun intent(context: Context): Intent = Intent(context, ScheduleReceiver::class.java)     }
screentime/src/main/java/com/vayunmathur/screentime/platform/ScreenTimeViewModel.kt
diff --git a/screentime/src/main/java/com/vayunmathur/screentime/platform/ScreenTimeViewModel.kt b/screentime/src/main/java/com/vayunmathur/screentime/platform/ScreenTimeViewModel.ktindex dac3707505..b8d14ae8db 100644--- a/screentime/src/main/java/com/vayunmathur/screentime/platform/ScreenTimeViewModel.kt+++ b/screentime/src/main/java/com/vayunmathur/screentime/platform/ScreenTimeViewModel.kt@@ -75,6 +75,7 @@ data class AppDetailsUiState(     val hasUsageAccess: Boolean = false, ) +/** ViewModel backing the screen-time dashboard and app-details state. */ class ScreenTimeViewModel(app: Application) : AndroidViewModel(app) {      private val rules = ScreenTimeRules.get(app)
screentime/src/main/java/com/vayunmathur/screentime/ui/FrictionScreen.kt
diff --git a/screentime/src/main/java/com/vayunmathur/screentime/ui/FrictionScreen.kt b/screentime/src/main/java/com/vayunmathur/screentime/ui/FrictionScreen.ktindex 375626fa42..679d07d444 100644--- a/screentime/src/main/java/com/vayunmathur/screentime/ui/FrictionScreen.kt+++ b/screentime/src/main/java/com/vayunmathur/screentime/ui/FrictionScreen.kt@@ -75,6 +75,7 @@ class FrictionActivity : ComponentActivity() {             packageManager.getApplicationLabel(info).toString()         }.getOrNull() +    /** Intent extras for launching the friction screen. */     companion object {         const val EXTRA_FRICTION_PACKAGE = "com.vayunmathur.screentime.extra.FRICTION_PACKAGE"         const val EXTRA_FRICTION_NUDGE = "com.vayunmathur.screentime.extra.FRICTION_NUDGE"
screentime/src/main/java/com/vayunmathur/screentime/widget/ScreenTimeWidgetReceiver.kt
diff --git a/screentime/src/main/java/com/vayunmathur/screentime/widget/ScreenTimeWidgetReceiver.kt b/screentime/src/main/java/com/vayunmathur/screentime/widget/ScreenTimeWidgetReceiver.ktindex e10c273b0f..b276c88091 100644--- a/screentime/src/main/java/com/vayunmathur/screentime/widget/ScreenTimeWidgetReceiver.kt+++ b/screentime/src/main/java/com/vayunmathur/screentime/widget/ScreenTimeWidgetReceiver.kt@@ -13,6 +13,7 @@ import kotlinx.coroutines.launch  // No periodic refresh: content changes only when usage accrues, and the coordinator // pushes an update on every reconcile that matters (see WidgetRefresh).+/** Glance widget receiver hosting the screen-time widget. */ class ScreenTimeGlanceWidgetReceiver : MaWidgetReceiver<ScreenTimeGlanceWidget>(     widgetClass = ScreenTimeGlanceWidget::class,     receiverClass = ScreenTimeGlanceWidgetReceiver::class,