Package-level declarations

Types

Link copied to clipboard
data class AppEntry(val label: String, val packageName: String, val activityName: String, val userSerial: Long = 0)

A launchable app: just what we need to show a name and start it. userSerial identifies which profile the app lives in: 0 = the launcher's own (personal) profile, otherwise the work/private profile's stable serial number — the same package can be installed in both, and they are distinct entries.

Link copied to clipboard
class LauncherStore(context: Context)

Snapshot-backed launcher settings, persisted to SharedPreferences.

Link copied to clipboard
Link copied to clipboard

Reads real per-app foreground time via UsageStatsManager. Requires the special "usage access" grant (not a normal runtime permission) — the whole point of a minimalist phone: see where the time goes and add friction to the time-sinks.

Properties

Link copied to clipboard
const val BACKUP_VERSION: Int = 1

Schema version of the settings backup JSON (#11).

Link copied to clipboard

Nudge before opening a distracting app once it's over this much today.

Link copied to clipboard

Stable identity for an app across sessions. Personal-profile apps keep the historical two-part form so pre-existing prefs stay valid; other profiles append their user serial ('/' never appears in package or class names).

Link copied to clipboard
const val MAX_FAVORITES: Int = 10

Most favorites we allow pinned on the home screen.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun canUninstall(context: Context, app: AppEntry): Boolean

Whether the long-press menu should offer uninstall: personal-profile, non-system apps only (system apps can't be uninstalled, and other profiles' apps are managed from within that profile).

Link copied to clipboard
internal fun decodeApp(raw: String?): AppEntry?
Link copied to clipboard
internal fun AppEntry.encode(): String
Link copied to clipboard

Pulls down the system notification shade (uses the hidden StatusBarManager API).

Link copied to clipboard

"2h 15m", "45m", or "3m".

Link copied to clipboard
fun launchApp(context: Context, app: AppEntry)
Link copied to clipboard

Enumerates launchable apps across all profiles (personal + work + private space) via LauncherApps — plain PackageManager queries only see the personal profile. Locked/quiet profiles simply don't return activities, so their apps disappear while paused, which is the system-consistent behavior.

Link copied to clipboard
fun openAppInfo(context: Context, packageName: String)
Link copied to clipboard
fun openBrowser(context: Context)
Link copied to clipboard
fun openClockApp(context: Context)
Link copied to clipboard
fun openSettings(context: Context)
Link copied to clipboard
fun openUrl(context: Context, url: String)
Link copied to clipboard
fun playSearch(context: Context, query: String)
Link copied to clipboard
fun requestUninstall(context: Context, app: AppEntry)

Fires the system uninstall confirmation for app; the OS does the rest.

Link copied to clipboard

Resolves a stored AppEntry.userSerial back to the real profile it names — null if that profile no longer exists (removed, or mid-removal). Shared by every call site that needs a UserHandle for a LauncherApps call (launching an app, loading its icon): each previously reimplemented this same "0L means the personal profile, otherwise look up the serial" check.

Link copied to clipboard
fun sectionOf(label: String): Char

'A'–'Z' if label starts with a letter, otherwise '#' — the drawer A–Z rail's overflow bucket for digits, symbols, and non-Latin scripts. The single source of truth for this classification: the sort order above and the rail's own section lookups (LauncherScreen.kt) both call this, so they can't silently drift apart the way two independently-written copies of the same rule eventually do. The sort puts '#' labels after Z on purpose — plain ASCII order would put digits before letters, scattering them at the list's start while the rail shows '#' last, so dragging to '#' would jump to the top instead of wherever those apps actually are.

Link copied to clipboard
fun webSearch(context: Context, query: String)