Use FooterPreference in xml explicitly

We don't rely on FooterPreferenceMixinCompat
to create footer preference in dashboard fragment.

Instead, declare a FooterPreference explicitly in
xml of screen.

It makes more sense for our referenceController design.

Test: visual, robotest
Bug: 124129485
Change-Id: I0b0c0f9e38d85aa89b815ce2b84ddff30a1d206b
This commit is contained in:
tmfang
2019-05-31 18:24:29 +08:00
parent f1c0f23510
commit 24c3324268
10 changed files with 84 additions and 109 deletions

View File

@@ -14,6 +14,9 @@
package com.android.settings.display;
import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
import static com.google.common.truth.Truth.assertThat;
import com.android.settings.testutils.shadow.SettingsShadowResources;
@@ -34,7 +37,8 @@ public class NightDisplayFooterPreferenceControllerTest {
@Before
public void setUp() {
mController = new NightDisplayFooterPreferenceController(RuntimeEnvironment.application);
mController =
new NightDisplayFooterPreferenceController(RuntimeEnvironment.application, "key");
}
@After
@@ -43,16 +47,18 @@ public class NightDisplayFooterPreferenceControllerTest {
}
@Test
public void isAvailable_configuredAvailable() {
public void getAvailabilityStatus_configuredAvailable_shouldReturnAVAILABLE_UNSEARCHABLE() {
SettingsShadowResources.overrideResource(
com.android.internal.R.bool.config_nightDisplayAvailable, true);
assertThat(mController.isAvailable()).isTrue();
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
}
@Test
public void isAvailable_configuredUnavailable() {
public void getAvailabilityStatus_configuredUnavailable_shouldReturnUNSUPPORTED_ON_DEVICE() {
SettingsShadowResources.overrideResource(
com.android.internal.R.bool.config_nightDisplayAvailable, false);
assertThat(mController.isAvailable()).isFalse();
assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
}
}