Merge "Storage Settings Apps category shows image/video/audio APPs" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-05-03 18:11:03 +00:00
committed by Android (Google) Code Review
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.