Grouped small cleanups — none urgent, all independent; can be done in one sitting. (Permalinks pinned at f4460ac; grep the symbol names if lines have moved.)
1. DND detection uses the undocumented zen_mode global setting
NotificationService.java:89-91, [913-919](https://github.com/almothafar/SimpleBatteryNotifier/blob/f4460acc3ba99320c3efe310fb51456af0939ab0/app/src/main/java/com/almothafar/simplebatterynotifier/service/NotificationService.java#L913-L919)`` read Settings.Global "zen_mode" — private API, no stability guarantee across OEMs/versions. Public replacement: NotificationManager.getCurrentInterruptionFilter() != INTERRUPTION_FILTER_ALL. Behavior nuance to decide: the current code counts only ZEN_MODE_IMPORTANT_INTERRUPTIONS (1) as DND; the public API also distinguishes ALARMS/NONE — pick the semantics deliberately and comment it.
2. Notification.Builder → NotificationCompat.Builder
Works today (minSdk 26 has channels), but NotificationCompat is the lint-recommended path and smooths OEM-skin quirks. Mechanical change across NotificationService. Best done together with (or just after) the #166 refactor to avoid churn.
3. SystemService.TAG = "com.almothafar"
SystemService.java:37`` — every other class uses its own class-name tag. Make it "SystemService".
4. Inlined dp→px math ignores the existing helper
GeneralHelper.dpToPixel exists (GeneralHelper.java:24-29) but dp→px is hand-rolled at [BatteryDetailsFragment.java:313](https://github.com/almothafar/SimpleBatteryNotifier/blob/f4460acc3ba99320c3efe310fb51456af0939ab0/app/src/main/java/com/almothafar/simplebatterynotifier/ui/fragment/BatteryDetailsFragment.java#L313)`` (6 * density) and BatteryInsightsActivity.java:288`` (24 * density). Use the helper (or dimens resources).
5. allowBackup="true" with no backup rules — decide deliberately
All health tracking (cycles, first-use date), the rate sample window, and detector streak state live in backed-up SharedPreferences. Restoring to a different device brings over another battery's cycle history, a stale rate window (age-trimmed, so harmless) and stale streaks. Options:
- Keep backup (cycles surviving reinstall on the same device is genuinely desirable) and add
android:dataExtractionRules/fullBackupContent excluding the volatile/transient keys (_battery_rate_samples, detector streak keys), or
- accept as-is with a manifest comment recording the decision.
Interacts with #164 (which adds more persisted episode state).
6. Legacy pref key naming — comment only, do not migrate
PREF_DESIGN_CAPACITY = "key_battery_design_capacity" (BatteryHealthTracker.java:43)`` breaks the _battery_health_* sibling convention. Renaming would silently drop users' stored capacity — add a comment marking it intentional-legacy instead.
Acceptance criteria
Grouped small cleanups — none urgent, all independent; can be done in one sitting. (Permalinks pinned at
f4460ac; grep the symbol names if lines have moved.)1. DND detection uses the undocumented
zen_modeglobal settingNotificationService.java:89-91,
[913-919](https://github.com/almothafar/SimpleBatteryNotifier/blob/f4460acc3ba99320c3efe310fb51456af0939ab0/app/src/main/java/com/almothafar/simplebatterynotifier/service/NotificationService.java#L913-L919)`` readSettings.Global "zen_mode"— private API, no stability guarantee across OEMs/versions. Public replacement:NotificationManager.getCurrentInterruptionFilter() != INTERRUPTION_FILTER_ALL. Behavior nuance to decide: the current code counts onlyZEN_MODE_IMPORTANT_INTERRUPTIONS(1) as DND; the public API also distinguishesALARMS/NONE— pick the semantics deliberately and comment it.2.
Notification.Builder→NotificationCompat.BuilderWorks today (minSdk 26 has channels), but
NotificationCompatis the lint-recommended path and smooths OEM-skin quirks. Mechanical change acrossNotificationService. Best done together with (or just after) the #166 refactor to avoid churn.3.
SystemService.TAG = "com.almothafar"SystemService.java:37`` — every other class uses its own class-name tag. Make it
"SystemService".4. Inlined dp→px math ignores the existing helper
GeneralHelper.dpToPixelexists (GeneralHelper.java:24-29)but dp→px is hand-rolled at [BatteryDetailsFragment.java:313](https://github.com/almothafar/SimpleBatteryNotifier/blob/f4460acc3ba99320c3efe310fb51456af0939ab0/app/src/main/java/com/almothafar/simplebatterynotifier/ui/fragment/BatteryDetailsFragment.java#L313)`` (6 * density) and BatteryInsightsActivity.java:288`` (24 * density). Use the helper (or dimens resources).5.
allowBackup="true"with no backup rules — decide deliberatelyAll health tracking (cycles, first-use date), the rate sample window, and detector streak state live in backed-up SharedPreferences. Restoring to a different device brings over another battery's cycle history, a stale rate window (age-trimmed, so harmless) and stale streaks. Options:
android:dataExtractionRules/fullBackupContentexcluding the volatile/transient keys (_battery_rate_samples, detector streak keys), orInteracts with #164 (which adds more persisted episode state).
6. Legacy pref key naming — comment only, do not migrate
PREF_DESIGN_CAPACITY = "key_battery_design_capacity"(BatteryHealthTracker.java:43)`` breaks the_battery_health_*sibling convention. Renaming would silently drop users' stored capacity — add a comment marking it intentional-legacy instead.Acceptance criteria
getCurrentInterruptionFilter, semantics documentedNotificationCompat