From b699603f68a421bc7e2b9e7522b17489000f99eb Mon Sep 17 00:00:00 2001
From: Li YanJia
Date: Mon, 6 Feb 2017 14:50:56 +0800
Subject: [PATCH 1/2] Fix PrivateVolumeSettings be launched repeatedly
Symptom:
After manually pull out the removable sd card or usb storage in
StorageSettings screen, it automatically moves to
PrivateVolumeSettings screen. This time, launching
PrivateVolumeSettings Activity is triggered six times and end-user
has to press back key six times to exit PrivateVolumeSettings
screen.
Root cause:
When sd card is pulled out, StorageSettings got three state change
event (UNMOUNTED, BAD_REMOVAL and onDiskDestroyed) through
StorageEventListener that triggers launching PrivateVolumeSettings
screen. In addition StorageSettings register the listener two
times, then StorageSettings receives six event in total.
Therefore, PrivateVolumeSettings screen is launched six times.
Solution:
Skip launching PrivateVolumeSettings if it's already triggered.
And removed the duplicated listener registration.
Bug: 67612903
Change-Id: Iabef51677a393977b7be29fc54aa050434213500
---
.../settings/deviceinfo/StorageSettings.java | 22 +++++++++++--------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java
index ce9ea9b0c2e..80b8ac2a2d2 100644
--- a/src/com/android/settings/deviceinfo/StorageSettings.java
+++ b/src/com/android/settings/deviceinfo/StorageSettings.java
@@ -93,6 +93,8 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
private StorageSummaryPreference mInternalSummary;
private static long sTotalInternalStorage;
+ private boolean mHasLaunchedPrivateVolumeSettings = false;
+
@Override
public int getMetricsCategory() {
return MetricsEvent.DEVICEINFO_STORAGE;
@@ -110,7 +112,6 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
final Context context = getActivity();
mStorageManager = context.getSystemService(StorageManager.class);
- mStorageManager.registerListener(mStorageListener);
if (sTotalInternalStorage <= 0) {
sTotalInternalStorage = mStorageManager.getPrimaryStorageSize();
@@ -231,14 +232,17 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
if (mInternalCategory.getPreferenceCount() == 2
&& mExternalCategory.getPreferenceCount() == 0) {
// Only showing primary internal storage, so just shortcut
- final Bundle args = new Bundle();
- args.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
- Intent intent = Utils.onBuildStartFragmentIntent(getActivity(),
- StorageDashboardFragment.class.getName(), args, null,
- R.string.storage_settings, null, false, getMetricsCategory());
- intent.putExtra(SettingsDrawerActivity.EXTRA_SHOW_MENU, true);
- getActivity().startActivity(intent);
- finish();
+ if (!mHasLaunchedPrivateVolumeSettings) {
+ mHasLaunchedPrivateVolumeSettings = true;
+ final Bundle args = new Bundle();
+ args.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
+ Intent intent = Utils.onBuildStartFragmentIntent(getActivity(),
+ StorageDashboardFragment.class.getName(), args, null,
+ R.string.storage_settings, null, false, getMetricsCategory());
+ intent.putExtra(SettingsDrawerActivity.EXTRA_SHOW_MENU, true);
+ getActivity().startActivity(intent);
+ finish();
+ }
}
}
From 893bdba206d23e453019b66ee465350621382308 Mon Sep 17 00:00:00 2001
From: Doris Ling
Date: Fri, 13 Oct 2017 11:45:30 -0700
Subject: [PATCH 2/2] Update tile limit for Sound settings.
Pull the notification and alarm ringtone out of the preference category
and update the tile limit to 1, so that only the first preference
category will be displayed initially.
Change-Id: I9ae7669fb2b688560a3fc228274ea44f225b262f
Fixes: 67750626
Test: visual
---
res/xml/sound_settings.xml | 35 ++++++++++---------
.../settings/notification/SoundSettings.java | 2 +-
2 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index b0aff02747a..a764d7a38a3 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -70,24 +70,27 @@
android:ringtoneType="ringtone"
settings:allowDividerAbove="true" />
-
-
-
-
-
+
+
+
+
+
+