Log when /cache files are deleted.
Bug: 6362988 Change-Id: Ib8497453c45612be5b83035eeaf3abe6d716ccbf
This commit is contained in:
@@ -26,6 +26,7 @@ import android.content.pm.IPackageDataObserver;
|
||||
import android.content.pm.IPackageManager;
|
||||
import android.os.Binder;
|
||||
import android.os.Environment;
|
||||
import android.os.FileObserver;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Process;
|
||||
@@ -91,6 +92,7 @@ public class DeviceStorageMonitorService extends Binder {
|
||||
private Intent mStorageFullIntent;
|
||||
private Intent mStorageNotFullIntent;
|
||||
private CachePackageDataObserver mClearCacheObserver;
|
||||
private final CacheFileDeletedObserver mCacheFileDeletedObserver;
|
||||
private static final int _TRUE = 1;
|
||||
private static final int _FALSE = 0;
|
||||
private long mMemLowThreshold;
|
||||
@@ -324,6 +326,9 @@ public class DeviceStorageMonitorService extends Binder {
|
||||
mMemLowThreshold = getMemThreshold();
|
||||
mMemFullThreshold = getMemFullThreshold();
|
||||
checkMemory(true);
|
||||
|
||||
mCacheFileDeletedObserver = new CacheFileDeletedObserver();
|
||||
mCacheFileDeletedObserver.startWatching();
|
||||
}
|
||||
|
||||
|
||||
@@ -419,4 +424,15 @@ public class DeviceStorageMonitorService extends Binder {
|
||||
public boolean isMemoryLow() {
|
||||
return mLowMemFlag;
|
||||
}
|
||||
|
||||
public static class CacheFileDeletedObserver extends FileObserver {
|
||||
public CacheFileDeletedObserver() {
|
||||
super(Environment.getDownloadCacheDirectory().getAbsolutePath(), FileObserver.DELETE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(int event, String path) {
|
||||
EventLogTags.writeCacheFileDeleted(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ option java_package com.android.server
|
||||
|
||||
|
||||
# ---------------------------
|
||||
# DeviceStorageMonitoryService.java
|
||||
# DeviceStorageMonitorService.java
|
||||
# ---------------------------
|
||||
# The disk space free on the /data partition, in bytes
|
||||
2744 free_storage_changed (data|2|2)
|
||||
@@ -44,6 +44,8 @@ option java_package com.android.server
|
||||
2745 low_storage (data|2|2)
|
||||
# disk space free on the /data, /system, and /cache partitions in bytes
|
||||
2746 free_storage_left (data|2|2),(system|2|2),(cache|2|2)
|
||||
# file on cache partition was deleted
|
||||
2748 cache_file_deleted (path|3)
|
||||
|
||||
|
||||
# ---------------------------
|
||||
|
||||
Reference in New Issue
Block a user