Search in sources :

Example 6 with StorageItemPreferenceController

use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project platform_packages_apps_Settings by BlissRoms.

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);
}
Also used : SparseArray(android.util.SparseArray) StorageItemPreferenceController(com.android.settings.deviceinfo.storage.StorageItemPreferenceController) StorageAsyncLoader(com.android.settings.deviceinfo.storage.StorageAsyncLoader) StorageStatsSource(com.android.settingslib.applications.StorageStatsSource) Test(org.junit.Test)

Example 7 with StorageItemPreferenceController

use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class StorageDashboardFragment method createPreferenceControllers.

@Override
protected List<AbstractPreferenceController> createPreferenceControllers(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);
    final UserManager userManager = context.getSystemService(UserManager.class);
    mSecondaryUsers = SecondaryUserController.getSecondaryUserControllers(context, userManager);
    controllers.addAll(mSecondaryUsers);
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) StorageItemPreferenceController(com.android.settings.deviceinfo.storage.StorageItemPreferenceController) UserManager(android.os.UserManager) ArrayList(java.util.ArrayList) StorageManager(android.os.storage.StorageManager) StorageManagerVolumeProvider(com.android.settingslib.deviceinfo.StorageManagerVolumeProvider) StorageSummaryDonutPreferenceController(com.android.settings.deviceinfo.storage.StorageSummaryDonutPreferenceController)

Example 8 with StorageItemPreferenceController

use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class StorageProfileFragment method createPreferenceControllers.

@Override
protected List<AbstractPreferenceController> createPreferenceControllers(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;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) StorageItemPreferenceController(com.android.settings.deviceinfo.storage.StorageItemPreferenceController) ArrayList(java.util.ArrayList) StorageManager(android.os.storage.StorageManager) StorageManagerVolumeProvider(com.android.settingslib.deviceinfo.StorageManagerVolumeProvider)

Example 9 with StorageItemPreferenceController

use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project android_packages_apps_Settings by LineageOS.

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;
}
Also used : AutomaticStorageManagementSwitchPreferenceController(com.android.settings.deviceinfo.storage.AutomaticStorageManagementSwitchPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) StorageItemPreferenceController(com.android.settings.deviceinfo.storage.StorageItemPreferenceController) UserManager(android.os.UserManager) ArrayList(java.util.ArrayList) StorageManager(android.os.storage.StorageManager) UserManagerWrapperImpl(com.android.settings.applications.UserManagerWrapperImpl) StorageManagerVolumeProvider(com.android.settingslib.deviceinfo.StorageManagerVolumeProvider) StorageSummaryDonutPreferenceController(com.android.settings.deviceinfo.storage.StorageSummaryDonutPreferenceController) UserManagerWrapper(com.android.settings.applications.UserManagerWrapper)

Example 10 with StorageItemPreferenceController

use of com.android.settings.deviceinfo.storage.StorageItemPreferenceController in project android_packages_apps_Settings by LineageOS.

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;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) StorageItemPreferenceController(com.android.settings.deviceinfo.storage.StorageItemPreferenceController) ArrayList(java.util.ArrayList) StorageManager(android.os.storage.StorageManager) StorageManagerVolumeProvider(com.android.settingslib.deviceinfo.StorageManagerVolumeProvider)

Aggregations

StorageItemPreferenceController (com.android.settings.deviceinfo.storage.StorageItemPreferenceController)21 StorageManager (android.os.storage.StorageManager)14 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)14 StorageManagerVolumeProvider (com.android.settingslib.deviceinfo.StorageManagerVolumeProvider)14 ArrayList (java.util.ArrayList)14 UserManager (android.os.UserManager)7 SparseArray (android.util.SparseArray)7 StorageAsyncLoader (com.android.settings.deviceinfo.storage.StorageAsyncLoader)7 StorageSummaryDonutPreferenceController (com.android.settings.deviceinfo.storage.StorageSummaryDonutPreferenceController)7 StorageStatsSource (com.android.settingslib.applications.StorageStatsSource)7 Test (org.junit.Test)7 UserManagerWrapper (com.android.settings.applications.UserManagerWrapper)6 UserManagerWrapperImpl (com.android.settings.applications.UserManagerWrapperImpl)6 AutomaticStorageManagementSwitchPreferenceController (com.android.settings.deviceinfo.storage.AutomaticStorageManagementSwitchPreferenceController)6