Merge "Fix PrivateVolumeSettings be launched repeatedly"
This commit is contained in:
@@ -93,6 +93,8 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
|||||||
private StorageSummaryPreference mInternalSummary;
|
private StorageSummaryPreference mInternalSummary;
|
||||||
private static long sTotalInternalStorage;
|
private static long sTotalInternalStorage;
|
||||||
|
|
||||||
|
private boolean mHasLaunchedPrivateVolumeSettings = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
return MetricsEvent.DEVICEINFO_STORAGE;
|
return MetricsEvent.DEVICEINFO_STORAGE;
|
||||||
@@ -110,7 +112,6 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
|||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
|
|
||||||
mStorageManager = context.getSystemService(StorageManager.class);
|
mStorageManager = context.getSystemService(StorageManager.class);
|
||||||
mStorageManager.registerListener(mStorageListener);
|
|
||||||
|
|
||||||
if (sTotalInternalStorage <= 0) {
|
if (sTotalInternalStorage <= 0) {
|
||||||
sTotalInternalStorage = mStorageManager.getPrimaryStorageSize();
|
sTotalInternalStorage = mStorageManager.getPrimaryStorageSize();
|
||||||
@@ -231,14 +232,17 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
|||||||
if (mInternalCategory.getPreferenceCount() == 2
|
if (mInternalCategory.getPreferenceCount() == 2
|
||||||
&& mExternalCategory.getPreferenceCount() == 0) {
|
&& mExternalCategory.getPreferenceCount() == 0) {
|
||||||
// Only showing primary internal storage, so just shortcut
|
// Only showing primary internal storage, so just shortcut
|
||||||
final Bundle args = new Bundle();
|
if (!mHasLaunchedPrivateVolumeSettings) {
|
||||||
args.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
|
mHasLaunchedPrivateVolumeSettings = true;
|
||||||
Intent intent = Utils.onBuildStartFragmentIntent(getActivity(),
|
final Bundle args = new Bundle();
|
||||||
StorageDashboardFragment.class.getName(), args, null,
|
args.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
|
||||||
R.string.storage_settings, null, false, getMetricsCategory());
|
Intent intent = Utils.onBuildStartFragmentIntent(getActivity(),
|
||||||
intent.putExtra(SettingsDrawerActivity.EXTRA_SHOW_MENU, true);
|
StorageDashboardFragment.class.getName(), args, null,
|
||||||
getActivity().startActivity(intent);
|
R.string.storage_settings, null, false, getMetricsCategory());
|
||||||
finish();
|
intent.putExtra(SettingsDrawerActivity.EXTRA_SHOW_MENU, true);
|
||||||
|
getActivity().startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user