Align the profile calculation with other screens.
The profile fragment was accidentally adding all of the app's code data to the profile, even if it was already attributed to the primary user. Change-Id: I47000bbe1fcf98d5e9f252eb74b22fee05b7034d Fixes: 35919232 Test: Settings Robotest
This commit is contained in:
@@ -24,6 +24,7 @@ import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.os.storage.VolumeInfo;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
@@ -119,10 +120,26 @@ public class StorageProfileFragment extends DashboardFragment
|
||||
@Override
|
||||
public void onLoadFinished(Loader<SparseArray<AppsStorageResult>> loader,
|
||||
SparseArray<AppsStorageResult> result) {
|
||||
mPreferenceController.onLoadFinished(result.get(mUserId));
|
||||
mPreferenceController.onLoadFinished(scrubAppsFromResult(result.get(mUserId)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoaderReset(Loader<SparseArray<AppsStorageResult>> loader) {
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setPreferenceController(StorageItemPreferenceController controller) {
|
||||
mPreferenceController = controller;
|
||||
}
|
||||
|
||||
private AppsStorageResult scrubAppsFromResult(AppsStorageResult result) {
|
||||
if (result == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
result.gamesSize = 0;
|
||||
result.musicAppsSize = 0;
|
||||
result.otherAppsSize = 0;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@@ -173,6 +173,8 @@ public class StorageItemPreferenceController extends PreferenceController {
|
||||
}
|
||||
|
||||
public void onLoadFinished(StorageAsyncLoader.AppsStorageResult data) {
|
||||
// TODO(b/35927909): Figure out how to split out apps which are only installed for work
|
||||
// profiles in order to attribute those app's code bytes only to that profile.
|
||||
mPhotoPreference.setStorageSize(
|
||||
data.externalStats.imageBytes + data.externalStats.videoBytes);
|
||||
mAudioPreference.setStorageSize(data.musicAppsSize + data.externalStats.audioBytes);
|
||||
|
Reference in New Issue
Block a user