AOD setting availability depends on other user settings

Bug: 62918778
Test: make
ROBOTEST_FILTER=AmbientDisplayAlwaysOnPreferenceControllerTest
RunSettingsRoboTests -j
Change-Id: Id6f1ad580cf5caace82a1bfa85e85b98f134f9d6
This commit is contained in:
Geoffrey Pitsch
2017-07-28 15:09:51 -04:00
parent b79d38f2f3
commit f3fc635947
3 changed files with 7 additions and 3 deletions

View File

@@ -75,7 +75,7 @@ public class AmbientDisplayAlwaysOnPreferenceController extends PreferenceContro
@Override @Override
public boolean isAvailable() { public boolean isAvailable() {
return mConfig.alwaysOnAvailable(); return mConfig.alwaysOnAvailableForUser(MY_USER);
} }
@Override @Override

View File

@@ -62,6 +62,10 @@ public class AmbientDisplayConfiguration {
return true; return true;
} }
public boolean alwaysOnAvailableForUser(int user) {
return true;
}
public boolean available() { public boolean available() {
return true; return true;
} }

View File

@@ -105,7 +105,7 @@ public class AmbientDisplayAlwaysOnPreferenceControllerTest {
@Test @Test
public void isAvailable_available() throws Exception { public void isAvailable_available() throws Exception {
when(mConfig.alwaysOnAvailable()) when(mConfig.alwaysOnAvailableForUser(anyInt()))
.thenReturn(true); .thenReturn(true);
assertThat(mController.isAvailable()).isTrue(); assertThat(mController.isAvailable()).isTrue();
@@ -113,7 +113,7 @@ public class AmbientDisplayAlwaysOnPreferenceControllerTest {
@Test @Test
public void isAvailable_unavailable() throws Exception { public void isAvailable_unavailable() throws Exception {
when(mConfig.alwaysOnAvailable()) when(mConfig.alwaysOnAvailableForUser(anyInt()))
.thenReturn(false); .thenReturn(false);
assertThat(mController.isAvailable()).isFalse(); assertThat(mController.isAvailable()).isFalse();