summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2012-06-29 15:47:09 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-06-29 15:47:09 -0700
commit3d3d4c891b96d1b0097248c3778baa895172d549 (patch)
treef292b44f49652b71a41ad0d5839a61e6c2a599c5 /src
parentf6f81b3e897809b8d22bd0a957b55516286c4d7d (diff)
parentd601be8f945833ea95e6aaae769efb8ed26d964a (diff)
downloadpackages_apps_settings-3d3d4c891b96d1b0097248c3778baa895172d549.zip
packages_apps_settings-3d3d4c891b96d1b0097248c3778baa895172d549.tar.gz
packages_apps_settings-3d3d4c891b96d1b0097248c3778baa895172d549.tar.bz2
am d601be8f: am 313ab172: Fix issue #6761130: Clearing app data in settings does not clear app\'s USB storage
* commit 'd601be8f945833ea95e6aaae769efb8ed26d964a': Fix issue #6761130: Clearing app data in settings does not clear app's USB storage
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/applications/ApplicationsState.java14
-rw-r--r--src/com/android/settings/applications/InstalledAppDetails.java22
2 files changed, 25 insertions, 11 deletions
diff --git a/src/com/android/settings/applications/ApplicationsState.java b/src/com/android/settings/applications/ApplicationsState.java
index 0a5c26e..3256fb2 100644
--- a/src/com/android/settings/applications/ApplicationsState.java
+++ b/src/com/android/settings/applications/ApplicationsState.java
@@ -73,6 +73,16 @@ public class ApplicationsState {
long dataSize;
long externalCodeSize;
long externalDataSize;
+
+ // This is the part of externalDataSize that is in the cache
+ // section of external storage. Note that we don't just combine
+ // this with cacheSize because currently the platform can't
+ // automatically trim this data when needed, so it is something
+ // the user may need to manage. The externalDataSize also includes
+ // this value, since what this is here is really the part of
+ // externalDataSize that we can just consider to be "cache" files
+ // for purposes of cleaning them up in the app details UI.
+ long externalCacheSize;
}
public static class AppEntry extends SizeInfo {
@@ -820,13 +830,15 @@ public class ApplicationsState {
entry.codeSize != stats.codeSize ||
entry.dataSize != stats.dataSize ||
entry.externalCodeSize != externalCodeSize ||
- entry.externalDataSize != externalDataSize) {
+ entry.externalDataSize != externalDataSize ||
+ entry.externalCacheSize != stats.externalCacheSize) {
entry.size = newSize;
entry.cacheSize = stats.cacheSize;
entry.codeSize = stats.codeSize;
entry.dataSize = stats.dataSize;
entry.externalCodeSize = externalCodeSize;
entry.externalDataSize = externalDataSize;
+ entry.externalCacheSize = stats.externalCacheSize;
entry.sizeStr = getSizeStr(entry.size);
entry.internalSize = getTotalInternalSize(stats);
entry.internalSizeStr = getSizeStr(entry.internalSize);
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 9166b15..d85c341 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -394,8 +394,8 @@ public class InstalledAppDetails extends Fragment
// Initialize clear data and move install location buttons
View data_buttons_panel = view.findViewById(R.id.data_buttons_panel);
- mClearDataButton = (Button) data_buttons_panel.findViewById(R.id.left_button);
- mMoveAppButton = (Button) data_buttons_panel.findViewById(R.id.right_button);
+ mClearDataButton = (Button) data_buttons_panel.findViewById(R.id.right_button);
+ mMoveAppButton = (Button) data_buttons_panel.findViewById(R.id.left_button);
// Cache section
mCacheSize = (TextView) view.findViewById(R.id.cache_size_text);
@@ -687,26 +687,28 @@ public class InstalledAppDetails extends Fragment
mLastExternalCodeSize = mAppEntry.externalCodeSize;
mExternalCodeSize.setText(getSizeStr(mAppEntry.externalCodeSize));
}
- if (mLastExternalDataSize != mAppEntry.externalDataSize) {
- mLastExternalDataSize = mAppEntry.externalDataSize;
- mExternalDataSize.setText(getSizeStr(mAppEntry.externalDataSize));
+ long nonCacheExtDataSize = mAppEntry.externalDataSize - mAppEntry.externalCacheSize;
+ if (mLastExternalDataSize != nonCacheExtDataSize) {
+ mLastExternalDataSize = nonCacheExtDataSize;
+ mExternalDataSize.setText(getSizeStr(nonCacheExtDataSize));
}
- if (mLastCacheSize != mAppEntry.cacheSize) {
- mLastCacheSize = mAppEntry.cacheSize;
- mCacheSize.setText(getSizeStr(mAppEntry.cacheSize));
+ long cacheSize = mAppEntry.cacheSize + mAppEntry.externalCacheSize;
+ if (mLastCacheSize != cacheSize) {
+ mLastCacheSize = cacheSize;
+ mCacheSize.setText(getSizeStr(cacheSize));
}
if (mLastTotalSize != mAppEntry.size) {
mLastTotalSize = mAppEntry.size;
mTotalSize.setText(getSizeStr(mAppEntry.size));
}
- if (mAppEntry.dataSize <= 0 || !mCanClearData) {
+ if ((mAppEntry.dataSize+nonCacheExtDataSize) <= 0 || !mCanClearData) {
mClearDataButton.setEnabled(false);
} else {
mClearDataButton.setEnabled(true);
mClearDataButton.setOnClickListener(this);
}
- if (mAppEntry.cacheSize <= 0) {
+ if (cacheSize <= 0) {
mClearCacheButton.setEnabled(false);
} else {
mClearCacheButton.setEnabled(true);