diff options
author | Kenny Root <kroot@google.com> | 2011-01-16 16:59:11 -0800 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2011-01-17 09:58:26 -0800 |
commit | 424acfb7ad469efb0a51c69fc8713cc96e2357b0 (patch) | |
tree | 1fc38997c73c168038d6b3260ec9640d561467b2 /src | |
parent | 6377e47f8b89982ebfa381542a301606a4bbb06d (diff) | |
download | packages_apps_Settings-424acfb7ad469efb0a51c69fc8713cc96e2357b0.zip packages_apps_Settings-424acfb7ad469efb0a51c69fc8713cc96e2357b0.tar.gz packages_apps_Settings-424acfb7ad469efb0a51c69fc8713cc96e2357b0.tar.bz2 |
Measure external storage application usage
Application data usage on the SD card (or USB storage) was not being
reported by the Manage Applications screen. This is important for
upcoming OBB space accounting.
Bug: 3308791
Change-Id: Ibc9ad013cb2f6d0ee28caadca8899c1ff6e78f44
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/applications/ApplicationsState.java | 19 | ||||
-rw-r--r-- | src/com/android/settings/applications/InstalledAppDetails.java | 7 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/com/android/settings/applications/ApplicationsState.java b/src/com/android/settings/applications/ApplicationsState.java index 6e9f2a2..6de8c7f 100644 --- a/src/com/android/settings/applications/ApplicationsState.java +++ b/src/com/android/settings/applications/ApplicationsState.java @@ -71,6 +71,7 @@ public class ApplicationsState { long cacheSize; long codeSize; long dataSize; + long externalSize; } public static class AppEntry extends SizeInfo { @@ -626,9 +627,16 @@ public class ApplicationsState { // -------------------------------------------------------------- - private long getTotalSize(PackageStats ps) { + private long getTotalInternalSize(PackageStats ps) { if (ps != null) { - return ps.codeSize+ps.dataSize; + return ps.codeSize + ps.dataSize; + } + return SIZE_INVALID; + } + + private long getTotalExternalSize(PackageStats ps) { + if (ps != null) { + return ps.externalDataSize + ps.externalMediaSize + ps.externalCacheSize; } return SIZE_INVALID; } @@ -660,15 +668,18 @@ public class ApplicationsState { synchronized (entry) { entry.sizeStale = false; entry.sizeLoadStart = 0; - long newSize = getTotalSize(stats); + long externalSize = getTotalExternalSize(stats); + long newSize = externalSize + getTotalInternalSize(stats); if (entry.size != newSize || entry.cacheSize != stats.cacheSize || entry.codeSize != stats.codeSize || - entry.dataSize != stats.dataSize) { + entry.dataSize != stats.dataSize || + entry.externalSize != externalSize) { entry.size = newSize; entry.cacheSize = stats.cacheSize; entry.codeSize = stats.codeSize; entry.dataSize = stats.dataSize; + entry.externalSize = externalSize; entry.sizeStr = getSizeStr(entry.size); if (DEBUG) Log.i(TAG, "Set size of " + entry.label + " " + entry + ": " + entry.sizeStr); diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java index de897eb..06d97fc 100644 --- a/src/com/android/settings/applications/InstalledAppDetails.java +++ b/src/com/android/settings/applications/InstalledAppDetails.java @@ -93,6 +93,7 @@ public class InstalledAppDetails extends Fragment private TextView mTotalSize; private TextView mAppSize; private TextView mDataSize; + private TextView mExternalSize; private ClearUserDataObserver mClearDataObserver; // Views related to cache info private TextView mCacheSize; @@ -107,6 +108,7 @@ public class InstalledAppDetails extends Fragment private boolean mHaveSizes = false; private long mLastCodeSize = -1; private long mLastDataSize = -1; + private long mLastExternalSize = -1; private long mLastCacheSize = -1; private long mLastTotalSize = -1; @@ -317,6 +319,7 @@ public class InstalledAppDetails extends Fragment mTotalSize = (TextView)view.findViewById(R.id.total_size_text); mAppSize = (TextView)view.findViewById(R.id.application_size_text); mDataSize = (TextView)view.findViewById(R.id.data_size_text); + mExternalSize = (TextView)view.findViewById(R.id.external_size_text); // Get Control button panel View btnPanel = view.findViewById(R.id.control_buttons_panel); @@ -504,6 +507,10 @@ public class InstalledAppDetails extends Fragment mLastDataSize = mAppEntry.dataSize; mDataSize.setText(getSizeStr(mAppEntry.dataSize)); } + if (mLastExternalSize != mAppEntry.externalSize) { + mLastExternalSize = mAppEntry.externalSize; + mExternalSize.setText(getSizeStr(mAppEntry.externalSize)); + } if (mLastCacheSize != mAppEntry.cacheSize) { mLastCacheSize = mAppEntry.cacheSize; mCacheSize.setText(getSizeStr(mAppEntry.cacheSize)); |