* commit '313ab1727014d535790bc89afdcf725ff936e5b4': Fix issue #6761130: Clearing app data in settings does not clear app's USB storage
This commit is contained in:
@@ -73,6 +73,16 @@ public class ApplicationsState {
|
|||||||
long dataSize;
|
long dataSize;
|
||||||
long externalCodeSize;
|
long externalCodeSize;
|
||||||
long externalDataSize;
|
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 {
|
public static class AppEntry extends SizeInfo {
|
||||||
@@ -820,13 +830,15 @@ public class ApplicationsState {
|
|||||||
entry.codeSize != stats.codeSize ||
|
entry.codeSize != stats.codeSize ||
|
||||||
entry.dataSize != stats.dataSize ||
|
entry.dataSize != stats.dataSize ||
|
||||||
entry.externalCodeSize != externalCodeSize ||
|
entry.externalCodeSize != externalCodeSize ||
|
||||||
entry.externalDataSize != externalDataSize) {
|
entry.externalDataSize != externalDataSize ||
|
||||||
|
entry.externalCacheSize != stats.externalCacheSize) {
|
||||||
entry.size = newSize;
|
entry.size = newSize;
|
||||||
entry.cacheSize = stats.cacheSize;
|
entry.cacheSize = stats.cacheSize;
|
||||||
entry.codeSize = stats.codeSize;
|
entry.codeSize = stats.codeSize;
|
||||||
entry.dataSize = stats.dataSize;
|
entry.dataSize = stats.dataSize;
|
||||||
entry.externalCodeSize = externalCodeSize;
|
entry.externalCodeSize = externalCodeSize;
|
||||||
entry.externalDataSize = externalDataSize;
|
entry.externalDataSize = externalDataSize;
|
||||||
|
entry.externalCacheSize = stats.externalCacheSize;
|
||||||
entry.sizeStr = getSizeStr(entry.size);
|
entry.sizeStr = getSizeStr(entry.size);
|
||||||
entry.internalSize = getTotalInternalSize(stats);
|
entry.internalSize = getTotalInternalSize(stats);
|
||||||
entry.internalSizeStr = getSizeStr(entry.internalSize);
|
entry.internalSizeStr = getSizeStr(entry.internalSize);
|
||||||
|
@@ -394,8 +394,8 @@ public class InstalledAppDetails extends Fragment
|
|||||||
|
|
||||||
// Initialize clear data and move install location buttons
|
// Initialize clear data and move install location buttons
|
||||||
View data_buttons_panel = view.findViewById(R.id.data_buttons_panel);
|
View data_buttons_panel = view.findViewById(R.id.data_buttons_panel);
|
||||||
mClearDataButton = (Button) data_buttons_panel.findViewById(R.id.left_button);
|
mClearDataButton = (Button) data_buttons_panel.findViewById(R.id.right_button);
|
||||||
mMoveAppButton = (Button) data_buttons_panel.findViewById(R.id.right_button);
|
mMoveAppButton = (Button) data_buttons_panel.findViewById(R.id.left_button);
|
||||||
|
|
||||||
// Cache section
|
// Cache section
|
||||||
mCacheSize = (TextView) view.findViewById(R.id.cache_size_text);
|
mCacheSize = (TextView) view.findViewById(R.id.cache_size_text);
|
||||||
@@ -687,26 +687,28 @@ public class InstalledAppDetails extends Fragment
|
|||||||
mLastExternalCodeSize = mAppEntry.externalCodeSize;
|
mLastExternalCodeSize = mAppEntry.externalCodeSize;
|
||||||
mExternalCodeSize.setText(getSizeStr(mAppEntry.externalCodeSize));
|
mExternalCodeSize.setText(getSizeStr(mAppEntry.externalCodeSize));
|
||||||
}
|
}
|
||||||
if (mLastExternalDataSize != mAppEntry.externalDataSize) {
|
long nonCacheExtDataSize = mAppEntry.externalDataSize - mAppEntry.externalCacheSize;
|
||||||
mLastExternalDataSize = mAppEntry.externalDataSize;
|
if (mLastExternalDataSize != nonCacheExtDataSize) {
|
||||||
mExternalDataSize.setText(getSizeStr(mAppEntry.externalDataSize));
|
mLastExternalDataSize = nonCacheExtDataSize;
|
||||||
|
mExternalDataSize.setText(getSizeStr(nonCacheExtDataSize));
|
||||||
}
|
}
|
||||||
if (mLastCacheSize != mAppEntry.cacheSize) {
|
long cacheSize = mAppEntry.cacheSize + mAppEntry.externalCacheSize;
|
||||||
mLastCacheSize = mAppEntry.cacheSize;
|
if (mLastCacheSize != cacheSize) {
|
||||||
mCacheSize.setText(getSizeStr(mAppEntry.cacheSize));
|
mLastCacheSize = cacheSize;
|
||||||
|
mCacheSize.setText(getSizeStr(cacheSize));
|
||||||
}
|
}
|
||||||
if (mLastTotalSize != mAppEntry.size) {
|
if (mLastTotalSize != mAppEntry.size) {
|
||||||
mLastTotalSize = mAppEntry.size;
|
mLastTotalSize = mAppEntry.size;
|
||||||
mTotalSize.setText(getSizeStr(mAppEntry.size));
|
mTotalSize.setText(getSizeStr(mAppEntry.size));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAppEntry.dataSize <= 0 || !mCanClearData) {
|
if ((mAppEntry.dataSize+nonCacheExtDataSize) <= 0 || !mCanClearData) {
|
||||||
mClearDataButton.setEnabled(false);
|
mClearDataButton.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
mClearDataButton.setEnabled(true);
|
mClearDataButton.setEnabled(true);
|
||||||
mClearDataButton.setOnClickListener(this);
|
mClearDataButton.setOnClickListener(this);
|
||||||
}
|
}
|
||||||
if (mAppEntry.cacheSize <= 0) {
|
if (cacheSize <= 0) {
|
||||||
mClearCacheButton.setEnabled(false);
|
mClearCacheButton.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
mClearCacheButton.setEnabled(true);
|
mClearCacheButton.setEnabled(true);
|
||||||
|
Reference in New Issue
Block a user