Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3fc6359 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch
Browse files

AOD setting availability depends on other user settings

Bug: 62918778
Test: make
ROBOTEST_FILTER=AmbientDisplayAlwaysOnPreferenceControllerTest
RunSettingsRoboTests -j
Change-Id: Id6f1ad580cf5caace82a1bfa85e85b98f134f9d6
parent b79d38f2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ public class AmbientDisplayAlwaysOnPreferenceController extends PreferenceContro

    @Override
    public boolean isAvailable() {
        return mConfig.alwaysOnAvailable();
        return mConfig.alwaysOnAvailableForUser(MY_USER);
    }

    @Override
+4 −0
Original line number Diff line number Diff line
@@ -62,6 +62,10 @@ public class AmbientDisplayConfiguration {
        return true;
    }

    public boolean alwaysOnAvailableForUser(int user) {
        return true;
    }

    public boolean available() {
        return true;
    }
+2 −2
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ public class AmbientDisplayAlwaysOnPreferenceControllerTest {

    @Test
    public void isAvailable_available() throws Exception {
        when(mConfig.alwaysOnAvailable())
        when(mConfig.alwaysOnAvailableForUser(anyInt()))
                .thenReturn(true);

        assertThat(mController.isAvailable()).isTrue();
@@ -113,7 +113,7 @@ public class AmbientDisplayAlwaysOnPreferenceControllerTest {

    @Test
    public void isAvailable_unavailable() throws Exception {
        when(mConfig.alwaysOnAvailable())
        when(mConfig.alwaysOnAvailableForUser(anyInt()))
                .thenReturn(false);

        assertThat(mController.isAvailable()).isFalse();