Storage Settings Apps category shows image/video/audio APPs

There is AOSP built in file browser for image/video/audio
file category, all APPs except games should be included in
Apps category.

- Shows image/video/audio APPs in APPs category.
- Count Image/Video/Audio APPs storage size to Apps storage size.
- Remove APP size & cache size for Images/Videos/Audios category.

Bug: 170918505
Test: atest StorageAsyncLoaderTest.java
Change-Id: I07e0a3a66a13f36b9e0cbde289d8ba90df4ae295
This commit is contained in:
Arc Wang
2021-04-28 19:54:37 +08:00
parent e06f5a93b1
commit 4cd89bb082
3 changed files with 51 additions and 6 deletions

View File

@@ -511,7 +511,7 @@ public class ManageApplications extends InstrumentedFragment
if (storageType == STORAGE_TYPE_MUSIC) {
filter = new CompoundFilter(ApplicationsState.FILTER_AUDIO, filter);
} else if (storageType == STORAGE_TYPE_DEFAULT) {
filter = new CompoundFilter(ApplicationsState.FILTER_OTHER_APPS, filter);
filter = new CompoundFilter(ApplicationsState.FILTER_APPS_EXCEPT_GAMES, filter);
}
return filter;
}

View File

@@ -120,7 +120,9 @@ public class StorageAsyncLoader
// This isn't quite right because it slams the first user by user id with the whole code
// size, but this ensures that we count all apps seen once.
boolean isAddCodeBytesForFirstUserId = false;
if (!mSeenPackages.contains(app.packageName)) {
isAddCodeBytesForFirstUserId = true;
blamedSize += stats.getCodeBytes();
mSeenPackages.add(app.packageName);
}
@@ -130,13 +132,34 @@ public class StorageAsyncLoader
result.gamesSize += blamedSize;
break;
case CATEGORY_AUDIO:
// TODO(b/170918505): Should revamp audio size calculation with the data
// from media provider.
result.musicAppsSize += blamedSize;
if (isAddCodeBytesForFirstUserId) {
result.musicAppsSize -= stats.getCodeBytes();
}
result.otherAppsSize += blamedSize;
break;
case CATEGORY_VIDEO:
// TODO(b/170918505): Should revamp video size calculation with the data
// from media provider.
result.videoAppsSize += blamedSize;
if (isAddCodeBytesForFirstUserId) {
result.videoAppsSize -= stats.getCodeBytes();
}
result.otherAppsSize += blamedSize;
break;
case CATEGORY_IMAGE:
// TODO(b/170918505): Should revamp image size calculation with the data
// from media provider.
result.photosAppsSize += blamedSize;
if (isAddCodeBytesForFirstUserId) {
result.photosAppsSize -= stats.getCodeBytes();
}
result.otherAppsSize += blamedSize;
break;
default:
// The deprecated game flag does not set the category.