Add emergency broadcast to app & notification settings.
Also fixed a bug where progressive disclosure expand button is displayed
incorrectly when # of preference == threshold exactly.
Change-Id: I518687e374853ae8ab1c7e5337822492d6fd99ff
Fix: 36557600
Test: robotests
diff --git a/res/xml/app_and_notification.xml b/res/xml/app_and_notification.xml
index 627d3f8..639735d 100644
--- a/res/xml/app_and_notification.xml
+++ b/res/xml/app_and_notification.xml
@@ -25,17 +25,28 @@
android:title="@string/app_permissions"
android:order="-130"
settings:keywords="@string/keywords_app_permissions">
- <intent android:action="android.intent.action.MANAGE_PERMISSIONS"/>
+ <intent android:action="android.intent.action.MANAGE_PERMISSIONS" />
</Preference>
<PreferenceCategory
android:key="dashboard_tile_placeholder"
- android:order="10"/>
+ android:order="10" />
+
+ <com.android.settingslib.RestrictedPreference
+ android:key="app_and_notif_cell_broadcast_settings"
+ android:title="@string/cell_broadcast_settings"
+ android:order="15"
+ settings:useAdminDisabledSummary="true">
+ <intent
+ android:action="android.intent.action.MAIN"
+ android:targetPackage="com.android.cellbroadcastreceiver"
+ android:targetClass="com.android.cellbroadcastreceiver.CellBroadcastSettings" />
+ </com.android.settingslib.RestrictedPreference>
<Preference
android:key="special_access"
android:fragment="com.android.settings.applications.SpecialAccessSettings"
android:title="@string/special_access"
- android:order="20"/>
+ android:order="20" />
</PreferenceScreen>
\ No newline at end of file
diff --git a/src/com/android/settings/dashboard/ProgressiveDisclosureMixin.java b/src/com/android/settings/dashboard/ProgressiveDisclosureMixin.java
index 07a7293..b86fabf 100644
--- a/src/com/android/settings/dashboard/ProgressiveDisclosureMixin.java
+++ b/src/com/android/settings/dashboard/ProgressiveDisclosureMixin.java
@@ -120,7 +120,7 @@
* Whether the screen should be collapsed.
*/
public boolean shouldCollapse(PreferenceScreen screen) {
- return !mUserExpanded && screen.getPreferenceCount() >= mTileLimit;
+ return !mUserExpanded && screen.getPreferenceCount() > mTileLimit;
}
/**
@@ -218,7 +218,7 @@
return pref;
}
if (pref instanceof PreferenceGroup) {
- final Preference returnedPreference = ((PreferenceGroup)pref).findPreference(key);
+ final Preference returnedPreference = ((PreferenceGroup) pref).findPreference(key);
if (returnedPreference != null) {
return returnedPreference;
}
diff --git a/tests/robotests/src/com/android/settings/dashboard/ProgressiveDisclosureTest.java b/tests/robotests/src/com/android/settings/dashboard/ProgressiveDisclosureTest.java
index bae6f8f..d53e11b 100644
--- a/tests/robotests/src/com/android/settings/dashboard/ProgressiveDisclosureTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/ProgressiveDisclosureTest.java
@@ -93,6 +93,15 @@
}
@Test
+ public void shouldNotCollapse_preferenceCountSameAsThreshold() {
+ when(mScreen.getPreferenceCount()).thenReturn(5);
+
+ mMixin.setTileLimit(5);
+
+ assertThat(mMixin.shouldCollapse(mScreen)).isFalse();
+ }
+
+ @Test
public void shouldNotCollapse_whenStartAsExpanded() {
when(mScreen.getPreferenceCount()).thenReturn(5);