ZenPreferences observe zen changes from USER_ALL
Zen manual rule changes are changed by USER_SYSTEM, so Zen Preference Controllers must register their content observers for zen changes and zen config changes to USER_ALL instead of just their own user id. Change-Id: I75194b62ab5e5b21dffbf04bba5009659bb41d81 Fixes: 70028673 Test: make ROBOTEST_FILTER=ZenModeButtonPreferenceControllerTest RunSettingsRoboTests -j40
This commit is contained in:
@@ -130,4 +130,21 @@ public class ZenModeButtonPreferenceControllerTest {
|
||||
verify(mZenButtonOn).setVisibility(View.VISIBLE);
|
||||
verify(mZenButtonOff).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_otherUserChangedZen() {
|
||||
final Preference mockPref = mock(Preference.class);
|
||||
Settings.Global.putInt(mContentResolver, ZEN_MODE, ZEN_MODE_OFF);
|
||||
mController.updateState(mockPref);
|
||||
verify(mZenButtonOn).setVisibility(View.VISIBLE);
|
||||
verify(mZenButtonOff).setVisibility(View.GONE);
|
||||
|
||||
Settings.Global.putInt(mContentResolver, ZEN_MODE, ZEN_MODE_IMPORTANT_INTERRUPTIONS);
|
||||
final int GUEST_USER_ID = 10;
|
||||
mController.mSettingObserver.onChange(false,
|
||||
Settings.Global.getUriFor(Settings.Global.ZEN_MODE), GUEST_USER_ID);
|
||||
|
||||
verify(mZenButtonOn).setVisibility(View.GONE);
|
||||
verify(mZenButtonOff).setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user