Add storage_summary_donut above ProfileSelectStorageFragment
- Modify ProfileSelectFragment to support add preference xml in the top, and tabLayout below the preferences. Base preference layout is dummy_preference_screen.xml which contains no preference. ProfileSelectStorageFragment contains StorageSummaryDonutPreference above the tabLayout. - Make StorageSummaryDonutPreferenceController self workable without StorageDashboardFragment dependence. - Rename inactive_apps.xml to dummy_preference_screen.xml - Move ShadowPrivateStorageInfo from LowStorageSliceTest Bug: 141601408 Test: manual Change-Id: Ide12840dc81bb104f328e230ecda5d35bba01d7a
This commit is contained in:
@@ -33,16 +33,17 @@ import android.view.View;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.loader.app.LoaderManager;
|
||||
import androidx.loader.content.Loader;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
|
||||
import com.android.settings.deviceinfo.storage.AutomaticStorageManagementSwitchPreferenceController;
|
||||
import com.android.settings.deviceinfo.storage.CachedStorageValuesHelper;
|
||||
import com.android.settings.deviceinfo.storage.SecondaryUserController;
|
||||
import com.android.settings.deviceinfo.storage.StorageAsyncLoader;
|
||||
import com.android.settings.deviceinfo.storage.StorageItemPreferenceController;
|
||||
import com.android.settings.deviceinfo.storage.StorageSummaryDonutPreferenceController;
|
||||
import com.android.settings.deviceinfo.storage.UserIconLoader;
|
||||
import com.android.settings.deviceinfo.storage.VolumeSizesLoader;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
@@ -62,6 +63,7 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
implements
|
||||
LoaderManager.LoaderCallbacks<SparseArray<StorageAsyncLoader.AppsStorageResult>> {
|
||||
private static final String TAG = "StorageDashboardFrag";
|
||||
private static final String SUMMARY_PREF_KEY = "pref_summary";
|
||||
private static final int STORAGE_JOB_ID = 0;
|
||||
private static final int ICON_JOB_ID = 1;
|
||||
private static final int VOLUME_SIZE_JOB_ID = 2;
|
||||
@@ -71,10 +73,10 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
private SparseArray<StorageAsyncLoader.AppsStorageResult> mAppsResult;
|
||||
private CachedStorageValuesHelper mCachedStorageValuesHelper;
|
||||
|
||||
private StorageSummaryDonutPreferenceController mSummaryController;
|
||||
private StorageItemPreferenceController mPreferenceController;
|
||||
private PrivateVolumeOptionMenuController mOptionMenuController;
|
||||
private List<AbstractPreferenceController> mSecondaryUsers;
|
||||
private boolean mPersonalOnly;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -84,12 +86,19 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
final Activity activity = getActivity();
|
||||
StorageManager sm = activity.getSystemService(StorageManager.class);
|
||||
mVolume = Utils.maybeInitializeVolume(sm, getArguments());
|
||||
mPersonalOnly = getArguments().getInt(ProfileSelectFragment.EXTRA_PROFILE)
|
||||
== ProfileSelectFragment.PERSONAL;
|
||||
if (mVolume == null) {
|
||||
activity.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
initializeOptionsMenu(activity);
|
||||
if (mPersonalOnly) {
|
||||
final Preference summary = getPreferenceScreen().findPreference(SUMMARY_PREF_KEY);
|
||||
if (summary != null) {
|
||||
summary.setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,7 +128,6 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
null /* header view */)
|
||||
.setRecyclerView(getListView(), getSettingsLifecycle())
|
||||
.styleActionBar(activity);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,7 +148,6 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
boolean stopLoading = false;
|
||||
if (mStorageInfo != null) {
|
||||
long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
|
||||
mSummaryController.updateBytes(privateUsedBytes, mStorageInfo.totalBytes);
|
||||
mPreferenceController.setVolume(mVolume);
|
||||
mPreferenceController.setUsedSize(privateUsedBytes);
|
||||
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);
|
||||
@@ -187,8 +194,6 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
@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,
|
||||
@@ -241,7 +246,6 @@ public class StorageDashboardFragment extends DashboardFragment
|
||||
final StorageManager sm = context.getSystemService(StorageManager.class);
|
||||
final UserManager userManager = context.getSystemService(UserManager.class);
|
||||
final List<AbstractPreferenceController> controllers = new ArrayList<>();
|
||||
controllers.add(new StorageSummaryDonutPreferenceController(context));
|
||||
controllers.add(new StorageItemPreferenceController(context, null /* host */,
|
||||
null /* volume */, new StorageManagerVolumeProvider(sm)));
|
||||
controllers.addAll(SecondaryUserController.getSecondaryUserControllers(
|
||||
|
Reference in New Issue
Block a user