am fdf7220a: bug:3308791 appusage should include space used on /sdcard

* commit 'fdf7220a03b6e823807b3786b727a9be598d01b5':
  bug:3308791 appusage should include space used on /sdcard
This commit is contained in:
Vasu Nori
2011-01-18 13:24:43 -08:00
committed by Android Git Automerger
2 changed files with 12 additions and 4 deletions

View File

@@ -57,7 +57,7 @@ import java.util.List;
public class Memory extends SettingsPreferenceFragment implements OnCancelListener,
MeasurementReceiver {
private static final String TAG = "Memory";
private static final boolean localLOGV = false;
static final boolean localLOGV = false;
private static final String MEMORY_SD_SIZE = "memory_sd_size";
@@ -278,6 +278,12 @@ public class Memory extends SettingsPreferenceFragment implements OnCancelListen
intent.setClass(getActivity(), com.android.settings.MediaFormat.class);
startActivity(intent);
return true;
} else if (preference == mInternalAppsUsage) {
Intent intent = new Intent(Intent.ACTION_MANAGE_PACKAGE_STORAGE);
intent.setClass(getActivity(),
com.android.settings.Settings.ManageApplicationsActivity.class);
startActivity(intent);
return true;
}
return false;

View File

@@ -307,7 +307,9 @@ public class MemoryMeasurement {
return;
}
if (succeeded) {
mAppsSizeForThisStatsObserver += stats.codeSize + stats.dataSize;
mAppsSizeForThisStatsObserver += stats.codeSize + stats.dataSize +
stats.externalCacheSize + stats.externalDataSize +
stats.externalMediaSize + stats.externalObbSize;
}
synchronized (mAppsList) {
@@ -363,8 +365,8 @@ public class MemoryMeasurement {
long mediaSize;
try {
// TODO get these directories from somewhere
mediaSize = imcs.calculateDirectorySize("/data/media");
mediaSize = imcs.calculateDirectorySize(
Environment.getExternalStorageDirectory().getAbsolutePath());
} catch (Exception e) {
Log.i(TAG, "Could not read memory from default container service");
return;