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

1.5 KiB
Raw Blame History

Storage-monitor patch plan

Exact stock target

/system/app/TPTvService/TPTvService.apk, SHA-256 75F492EE89906C8C267D685D2B7D0CE02BB09F3A6B4CC8456F8B096B9E441ECD, classes.dex, TVStorageMonitorService$2.run(), code_off=0x2ad380. Stock constants are exactly 524,288,000 and 1,073,741,824 bytes. The code uses legacy StatFs block multiplication, reads persist.odm.tpv.sys.emmc_lifetime, and mixes capacity and wear into the same cleanup/warning path. Its intended 300-second delay is overwritten with 30 seconds at PCs 0x02de–0x02e6.

Implementation

Replace the Runnable body with a small sampler feeding the state machine in POLICY.md. Use long byte APIs. Persist only the last notified state/timestamp, not a fabricated capacity. Emit structured metrics showing the source and unit. Route capacity transitions and health transitions to different message IDs and actions. Trigger owner-specific cleanup through bounded, idempotent jobs; remove the global package-cache sweep from the automatic path.

Verification

Run the offline policy harness, then build/re-sign TPTvService and re-decompile the result. On a recoverable test image simulate values around both thresholds, measurement failure, rapid fill/reclaim, EPG/GEL cleanup success and failure, health-only warnings, adopted USB removal, reboot and a 30-day soak. Verify UI deduplication and that Android's own storage state agrees. This APK is platform-signed, shared-UID and persistent/core; no live replacement is authorized or safe without the OEM signer and recovery path.