Files
philips-tv-speicher-voll/patches/storage-monitor/POLICY.md

1.7 KiB

Storage-monitor policy

Separate states

Capacity and flash health are independent signals:

  1. CAPACITY_OK, CAPACITY_LOW, CAPACITY_CRITICAL, or CAPACITY_UNKNOWN comes from the filesystem containing /data.
  2. HEALTH_NORMAL, HEALTH_WARNING, HEALTH_URGENT, or HEALTH_UNKNOWN comes from eMMC lifetime/PRE_EOL evidence.

An eMMC wear bucket must never produce the text “internal storage almost full”. Health gets separate maintenance wording. Unknown is never silently mapped to healthy or critical.

Capacity thresholds

Read StorageManager/platform low and full thresholds for /data, plus StatFs.getAvailableBytes(). Enter CRITICAL immediately at the platform full threshold. Enter LOW after two consecutive samples below the platform low threshold. Clear only after three samples above max(lowThreshold + 256 MiB, lowThreshold * 1.25). This combines Android's device-specific absolute threshold with hysteresis; do not retain the stock unconditional 1-GiB warning.

Report total, available, reclaimable, recent growth rate and adopted-volume state separately. Reclaimable bytes inform the cleanup offer but are not pretended to be already free.

Actions and timing

  • OK: poll every 10 minutes and react to platform storage broadcasts.
  • LOW/CRITICAL: poll every minute until stable recovery.
  • Show UI only on state transition and apply a user-visible cooldown.
  • First run bounded owner-specific cleanup (EPG retention, GEL pruning), then user-approved cache cleanup. Never sweep all package caches automatically.
  • Keep /data/vendor/user_setting as a separately named OEM policy with its own metrics and user-impact review.

The state-machine harness is tools/test_storage_state.py.