31 lines
1.7 KiB
Diff
31 lines
1.7 KiB
Diff
--- a/src/org/droidtv/tv/tptvservice/tvstoragemonitor/TVStorageMonitorService.java
|
|
+++ b/src/org/droidtv/tv/tptvservice/tvstoragemonitor/TVStorageMonitorService.java
|
|
@@
|
|
- long blockSize = statFs.getBlockSize();
|
|
- long availableBlocks = statFs.getAvailableBlocks();
|
|
- long free = blockSize * availableBlocks;
|
|
- boolean emmcCritical = getEmmcLifetime();
|
|
- if (free < under_500MB) { ... MEMORY_CRITICAL ... }
|
|
- else if (free < under_1GB && !emmcCritical) { ... low-storage UI ... }
|
|
- else if (free >= under_1GB && emmcCritical) { ... MEMORY_CRITICAL ... }
|
|
+ final File data = Environment.getDataDirectory();
|
|
+ final StatFs fs = new StatFs(data.getAbsolutePath());
|
|
+ final long freeBytes = fs.getAvailableBytes();
|
|
+ final StorageManager sm = getSystemService(StorageManager.class);
|
|
+ final long lowBytes = sm.getStorageLowBytes(data);
|
|
+ final long fullBytes = sm.getStorageFullBytes(data);
|
|
+ final long clearBytes = Math.max(lowBytes + 256L * 1024 * 1024,
|
|
+ lowBytes * 5L / 4L);
|
|
+ CapacityState next = capacityState.update(freeBytes, lowBytes, fullBytes,
|
|
+ clearBytes, 2, 3);
|
|
+ if (next.changed()) publishCapacityTransition(next, freeBytes, lowBytes);
|
|
+ // Health is a separate diagnostic channel. It must never synthesize a
|
|
+ // low-storage notification or CLEANUP_APPS broadcast.
|
|
+ EmmcHealth health = readEmmcHealthIfAvailable();
|
|
+ publishHealthTransitionOnly(health);
|
|
@@
|
|
- for (PackageInfo pkg : pm.getInstalledPackages(0))
|
|
- pm.deleteApplicationCacheFiles(pkg.packageName, null);
|
|
+ // Removed: global asynchronous cache sweeping is not a monitor action.
|
|
+ // Offer an explicit user/OEM cleanup workflow with attribution instead.
|