use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project android_packages_apps_Settings by crdroidandroid.
the class StorageProfileFragment method getPreferenceControllers.
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
final StorageManager sm = context.getSystemService(StorageManager.class);
mPreferenceController = new StorageItemPreferenceController(context, this, mVolume, new StorageManagerVolumeProvider(sm), /* isWorkProfile */
true);
controllers.add(mPreferenceController);
return controllers;
}
use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project android_packages_apps_Settings by crdroidandroid.
the class StorageProfileFragmentTest method verifyAppSizesAreNotZeroedOut.
@Test
public void verifyAppSizesAreNotZeroedOut() {
StorageItemPreferenceController controller = mock(StorageItemPreferenceController.class);
StorageProfileFragment fragment = new StorageProfileFragment();
StorageAsyncLoader.AppsStorageResult result = new StorageAsyncLoader.AppsStorageResult();
result.musicAppsSize = 100;
result.otherAppsSize = 200;
result.gamesSize = 300;
result.videoAppsSize = 400;
result.externalStats = new StorageStatsSource.ExternalStorageStats(6, 1, 2, 3, 0);
SparseArray<StorageAsyncLoader.AppsStorageResult> resultsArray = new SparseArray<>();
resultsArray.put(0, result);
fragment.setPreferenceController(controller);
fragment.onLoadFinished(null, resultsArray);
MockitoAnnotations.initMocks(this);
verify(controller).onLoadFinished(mCaptor.capture(), anyInt());
StorageAsyncLoader.AppsStorageResult extractedResult = mCaptor.getValue().get(0);
assertThat(extractedResult.musicAppsSize).isEqualTo(100);
assertThat(extractedResult.videoAppsSize).isEqualTo(400);
assertThat(extractedResult.otherAppsSize).isEqualTo(200);
assertThat(extractedResult.gamesSize).isEqualTo(300);
assertThat(extractedResult.externalStats.audioBytes).isEqualTo(1);
assertThat(extractedResult.externalStats.videoBytes).isEqualTo(2);
assertThat(extractedResult.externalStats.imageBytes).isEqualTo(3);
assertThat(extractedResult.externalStats.totalBytes).isEqualTo(6);
}
use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project android_packages_apps_Settings by SudaMod.
the class StorageProfileFragmentTest method verifyAppSizesAreNotZeroedOut.
@Test
public void verifyAppSizesAreNotZeroedOut() {
StorageItemPreferenceController controller = mock(StorageItemPreferenceController.class);
StorageProfileFragment fragment = new StorageProfileFragment();
StorageAsyncLoader.AppsStorageResult result = new StorageAsyncLoader.AppsStorageResult();
result.musicAppsSize = 100;
result.otherAppsSize = 200;
result.gamesSize = 300;
result.videoAppsSize = 400;
result.externalStats = new StorageStatsSource.ExternalStorageStats(6, 1, 2, 3, 0);
SparseArray<StorageAsyncLoader.AppsStorageResult> resultsArray = new SparseArray<>();
resultsArray.put(0, result);
fragment.setPreferenceController(controller);
fragment.onLoadFinished(null, resultsArray);
MockitoAnnotations.initMocks(this);
verify(controller).onLoadFinished(mCaptor.capture(), anyInt());
StorageAsyncLoader.AppsStorageResult extractedResult = mCaptor.getValue().get(0);
assertThat(extractedResult.musicAppsSize).isEqualTo(100);
assertThat(extractedResult.videoAppsSize).isEqualTo(400);
assertThat(extractedResult.otherAppsSize).isEqualTo(200);
assertThat(extractedResult.gamesSize).isEqualTo(300);
assertThat(extractedResult.externalStats.audioBytes).isEqualTo(1);
assertThat(extractedResult.externalStats.videoBytes).isEqualTo(2);
assertThat(extractedResult.externalStats.imageBytes).isEqualTo(3);
assertThat(extractedResult.externalStats.totalBytes).isEqualTo(6);
}
use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project android_packages_apps_Settings by SudaMod.
the class StorageDashboardFragment method getPreferenceControllers.
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
mSummaryController = new StorageSummaryDonutPreferenceController(context);
controllers.add(mSummaryController);
StorageManager sm = context.getSystemService(StorageManager.class);
mPreferenceController = new StorageItemPreferenceController(context, this, mVolume, new StorageManagerVolumeProvider(sm));
controllers.add(mPreferenceController);
UserManagerWrapper userManager = new UserManagerWrapperImpl(context.getSystemService(UserManager.class));
mSecondaryUsers = SecondaryUserController.getSecondaryUserControllers(context, userManager);
controllers.addAll(mSecondaryUsers);
final AutomaticStorageManagementSwitchPreferenceController asmController = new AutomaticStorageManagementSwitchPreferenceController(context, mMetricsFeatureProvider, getFragmentManager());
getLifecycle().addObserver(asmController);
controllers.add(asmController);
return controllers;
}
use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project platform_packages_apps_Settings by BlissRoms.
the class StorageProfileFragment method getPreferenceControllers.
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
final StorageManager sm = context.getSystemService(StorageManager.class);
mPreferenceController = new StorageItemPreferenceController(context, this, mVolume, new StorageManagerVolumeProvider(sm), /* isWorkProfile */
true);
controllers.add(mPreferenceController);
return controllers;
}
Aggregations