Files
philips-tv-speicher-voll/patches/epg-stale-cleanup/SMALI-PATCH.md

1.8 KiB

Exact DEX patch boundary

Stock method

The target is channels.apk!/classes4.dex:

Lorg/droidtv/channels/epg/bcepg/EpgProvider$deleteStaleDataRunnable;->run()V

Stock code item: registers=6, ins=1, outs=4, code_off=0xe298c. It enters the provider-global monitor, obtains ITvClockManager, calls System.currentTimeMillis(), subtracts literal 1800, conditionally subtracts 604800, logs “Deleting”, and returns without a mutation. The instruction offsets and full disassembly are preserved in diagnostics/deep-forensics/philips/epg-runnable-context.txt.

Required implementation, not an unsafe in-place hex edit

An acceptable smali rebuild must:

  1. calculate nowMillis as a long;
  2. invoke TimeUnit.MILLISECONDS.toSeconds(nowMillis) or divide by the explicit long 1000 with overflow-safe ordering;
  3. subtract TimeUnit.DAYS.toSeconds(7) (=604800 seconds);
  4. reject implausible cutoffs outside 2001-09-09 through 2100-01-01;
  5. call a new typed helper that executes ordered 2,000-row transactions;
  6. schedule the next daily run and log post-mutation metrics;
  7. perform database I/O after leaving the existing provider-global monitor.

Do not redirect directly to the existing EpgProgramPump.deleteScheduleProgramsByTime(long): its DEX method performs one unbounded ContentResolver.delete() and would create an uncontrolled multi-million-row transaction. Do not pass the current millisecond value to that method: the database columns demonstrably contain epoch seconds.

Adding the helper changes method/string/type tables and code-item sizes, so a full classes4.dex rebuild is required. The absence of a local smali/apktool tool and, more importantly, of the Philips platform private key means no deployable signed APK is emitted in this phase. REFERENCE-PATCH.diff and the executable SQLite harness are the reviewable patch artifacts.