OSDN Git Service

AOD setting availability depends on other user settings
authorGeoffrey Pitsch <gpitsch@google.com>
Fri, 28 Jul 2017 19:09:51 +0000 (15:09 -0400)
committerGeoffrey Pitsch <gpitsch@google.com>
Mon, 31 Jul 2017 17:56:41 +0000 (13:56 -0400)
Bug: 62918778
Test: make
ROBOTEST_FILTER=AmbientDisplayAlwaysOnPreferenceControllerTest
RunSettingsRoboTests -j
Change-Id: Id6f1ad580cf5caace82a1bfa85e85b98f134f9d6

src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java
tests/robotests/src/com/android/internal/hardware/AmbientDisplayConfiguration.java
tests/robotests/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceControllerTest.java

index 03bcc72..160786f 100644 (file)
@@ -75,7 +75,7 @@ public class AmbientDisplayAlwaysOnPreferenceController extends PreferenceContro
 
     @Override
     public boolean isAvailable() {
-        return mConfig.alwaysOnAvailable();
+        return mConfig.alwaysOnAvailableForUser(MY_USER);
     }
 
     @Override
index 59ca483..3dcf6ab 100644 (file)
@@ -62,6 +62,10 @@ public class AmbientDisplayConfiguration {
         return true;
     }
 
+    public boolean alwaysOnAvailableForUser(int user) {
+        return true;
+    }
+
     public boolean available() {
         return true;
     }
index 3f3f4b5..3869807 100644 (file)
@@ -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();