Merge "AOD setting availability depends on other user settings" into oc-dr1-dev
am: 6d62355313

Change-Id: If6f49df149ebaf960f40336556e5e9c199c23ef2
diff --git a/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java b/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java
index 53898e8..fffa243 100644
--- a/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java
+++ b/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java
@@ -77,7 +77,7 @@
 
     @Override
     public boolean isAvailable() {
-        return mConfig.alwaysOnAvailable();
+        return mConfig.alwaysOnAvailableForUser(MY_USER);
     }
 
     @Override
diff --git a/tests/robotests/src/com/android/internal/hardware/AmbientDisplayConfiguration.java b/tests/robotests/src/com/android/internal/hardware/AmbientDisplayConfiguration.java
index 59ca483..3dcf6ab 100644
--- a/tests/robotests/src/com/android/internal/hardware/AmbientDisplayConfiguration.java
+++ b/tests/robotests/src/com/android/internal/hardware/AmbientDisplayConfiguration.java
@@ -62,6 +62,10 @@
         return true;
     }
 
+    public boolean alwaysOnAvailableForUser(int user) {
+        return true;
+    }
+
     public boolean available() {
         return true;
     }
diff --git a/tests/robotests/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceControllerTest.java
index 3f3f4b5..3869807 100644
--- a/tests/robotests/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceControllerTest.java
@@ -105,7 +105,7 @@
 
     @Test
     public void isAvailable_available() throws Exception {
-        when(mConfig.alwaysOnAvailable())
+        when(mConfig.alwaysOnAvailableForUser(anyInt()))
                 .thenReturn(true);
 
         assertThat(mController.isAvailable()).isTrue();
@@ -113,7 +113,7 @@
 
     @Test
     public void isAvailable_unavailable() throws Exception {
-        when(mConfig.alwaysOnAvailable())
+        when(mConfig.alwaysOnAvailableForUser(anyInt()))
                 .thenReturn(false);
 
         assertThat(mController.isAvailable()).isFalse();