|
|
@ -627,7 +627,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<File> getFiles(File dir, long minSize) {
|
|
|
|
private List<File> getFiles(File dir, long minSize) {
|
|
|
|
List<File> files = new ArrayList();
|
|
|
|
List<File> files = new ArrayList<>();
|
|
|
|
File[] listed = dir.listFiles();
|
|
|
|
File[] listed = dir.listFiles();
|
|
|
|
if (listed != null)
|
|
|
|
if (listed != null)
|
|
|
|
for (File file : listed)
|
|
|
|
for (File file : listed)
|
|
|
@ -876,25 +876,45 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Log.i("Update usage");
|
|
|
|
Log.i("Update usage");
|
|
|
|
|
|
|
|
|
|
|
|
Runtime rt = Runtime.getRuntime();
|
|
|
|
new SimpleTask<StorageData>() {
|
|
|
|
long hused = rt.totalMemory() - rt.freeMemory();
|
|
|
|
@Override
|
|
|
|
long hmax = rt.maxMemory();
|
|
|
|
protected StorageData onExecute(Context context, Bundle args) throws Throwable {
|
|
|
|
long nheap = Debug.getNativeHeapAllocatedSize();
|
|
|
|
StorageData data = new StorageData();
|
|
|
|
tvMemoryUsage.setText(getString(R.string.title_advanced_memory_usage,
|
|
|
|
Runtime rt = Runtime.getRuntime();
|
|
|
|
Helper.humanReadableByteCount(hused),
|
|
|
|
data.hused = rt.totalMemory() - rt.freeMemory();
|
|
|
|
Helper.humanReadableByteCount(hmax),
|
|
|
|
data.hmax = rt.maxMemory();
|
|
|
|
Helper.humanReadableByteCount(nheap)));
|
|
|
|
data.nheap = Debug.getNativeHeapAllocatedSize();
|
|
|
|
|
|
|
|
data.available = Helper.getAvailableStorageSpace();
|
|
|
|
|
|
|
|
data.total = Helper.getTotalStorageSpace();
|
|
|
|
|
|
|
|
data.used = Helper.getSize(context.getFilesDir());
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
tvStorageUsage.setText(getString(R.string.title_advanced_storage_usage,
|
|
|
|
@Override
|
|
|
|
Helper.humanReadableByteCount(Helper.getAvailableStorageSpace()),
|
|
|
|
protected void onExecuted(Bundle args, StorageData data) {
|
|
|
|
Helper.humanReadableByteCount(Helper.getTotalStorageSpace())));
|
|
|
|
tvMemoryUsage.setText(getString(R.string.title_advanced_memory_usage,
|
|
|
|
|
|
|
|
Helper.humanReadableByteCount(data.hused),
|
|
|
|
|
|
|
|
Helper.humanReadableByteCount(data.hmax),
|
|
|
|
|
|
|
|
Helper.humanReadableByteCount(data.nheap)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tvStorageUsage.setText(getString(R.string.title_advanced_storage_usage,
|
|
|
|
|
|
|
|
Helper.humanReadableByteCount(data.available),
|
|
|
|
|
|
|
|
Helper.humanReadableByteCount(data.total),
|
|
|
|
|
|
|
|
Helper.humanReadableByteCount(data.used)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getView().postDelayed(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
updateUsage();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, 2500);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getView().postDelayed(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
updateUsage();
|
|
|
|
Log.e(ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 2500);
|
|
|
|
}.execute(this, null, "usage");
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(ex);
|
|
|
|
Log.e(ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -906,4 +926,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|
|
|
getString(R.string.title_advanced_last_cleanup,
|
|
|
|
getString(R.string.title_advanced_last_cleanup,
|
|
|
|
time < 0 ? "-" : DTF.format(time)));
|
|
|
|
time < 0 ? "-" : DTF.format(time)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static class StorageData {
|
|
|
|
|
|
|
|
private long hused;
|
|
|
|
|
|
|
|
private long hmax;
|
|
|
|
|
|
|
|
private long nheap;
|
|
|
|
|
|
|
|
private long available;
|
|
|
|
|
|
|
|
private long total;
|
|
|
|
|
|
|
|
private long used;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|