Whenever setInterruptionFilter() is called with NONE or ALARMS, the Do Not Disturb mode now shows the current policy (nothing allowed or alarms/media allowed), instead of the normal PRIORITY policy. This policy is read-only in the UI since it cannot be customized.
This should be, or at least become, pretty rare (with small exceptions, apps targeting V that call setInterruptionFilter() will use an implicit mode instead of changing the global zen mode, plus using these filters is quite nonstandard in itself).
Fixes: 361586248
Test: atest & manual (toggling DND via cmd shell)
Flag: android.app.modes_ui
Change-Id: If2439480235d30aa310ad8925341183b9761784c
* Sometimes would cause an unending stream of accessibility events (particularly if starting off-screen). This would break TalkBack and anything that depends on UiAutomator (although the system itself took it like a champ).
* Sometimes would not load images (because the ViewTreeObserver would never fire onGlobalLayout after being added because measured width was 0, even though a new width was calculated later).
* Would not recalculate the number of icons that fit if the width changes after the first layout.
Combining ViewHolders with waiting for measuring and/or ViewTreeObservers was always a wonky approach, even though it should've worked in theory. This should be more robust.
Also fixes the unwanted animation on mode screen load related to the absence of the header name being applied a tad too late.
Fixes: 359948417
Fixes: 360072876
Fixes: 360328804
Test: atest SettingsRoboTests + manual + adb shell uiautomator events
Flag: android.app.modes_ui
Change-Id: I7e5dfbdab220d1ebc1c68e5e87ce544ee86b6a65
Assigns metrics categories to all modes pages under
ZenModesListFragment. Includes new metrics categories where appropriate.
Bug: 332937635
Test: Build and flash
Flag: android.app.modes_ui
Change-Id: Ic19862ec194b40eae294d3c30240fe3f51304665
* Fix combinations of messages=all with other conversation values.
* Correctly display policies with CONVERSATION_SENDERS_ANYONE. An additional checkbox is included, but _only_ if the policy has CONVERSATION_SENDERS_ANYONE when shown.
* Changed updateState() to consider the possible cases one by one. Because multiple policies are mapped to the same checkbox states, the strategy of "checking whether the state matches what the checkbox wants to set" doesn't really work.
* Fix messages summary and circles to support CONVERSATION_SENDERS_ANYONE.
* Added a lot of tests (actually, hopefully ALL OF THEM) covering the user-visible behavior. :)
Fixes: 354658240
Test: atest ZenModesSummaryHelperTest ZenModePrioritySendersPreferenceControllerTest
Flag: android.app.modes_ui
Change-Id: I727496ca3eb820e4baaab942b61d2e57cdb491fc
Fixed view reuse. The views obtained from the ViewHolder should not be stored in Preference fields, since they can be rebound and thus a Preference can end up updating the wrong view.
Also added equivalence to the item class in the People segment so there is no flicker when the mode is reloaded.
Fixes: 346551087
Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Change-Id: Ibd89a826b19acabd9a46bb3ba2916453689636ed
Also set some alpha on the circles so that they look more or less disabled as well.
Fixes: 354867828
Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Change-Id: I53ef5e381d37afa20b0532f3c7ddb3f106b2e85e
(Several things pending, such as the +n icon and the correct pending icons, but it's a start).
Test: atest com.android.settings.notification.modes
Bug: 346551087
Flag: android.app.modes_ui
Change-Id: Ifd2ab6a8bb447739dc8ffe400c3960779d477fd6
Instead of a the plain appearance of a EntityHeaderController, make the top icon bigger and use the same circled style as the choices in the list. Also highlight the current icon in the list as selected, even if it is the default for the mode type.
Also cleaned up controllers that don't need a ZenModesBackend to not receive it.
(Both of these changes also line up with the "new mode" fragment that is incoming).
Bug: 333901673
Bug: 326442408
Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Change-Id: I0c9f3e34019a1a6c48658933dde545ad8d7399ae
This will allow us to access it from SystemUI.
Bug: 346519570
Test: builds
Flag: EXEMPT trivial refactor
Change-Id: I5bc480bd4eb0cbf8a26989dd11c064e66e5ee70e
to our new modes ui
Fixes: 333909883
Test: manual - created test app that launches each intent, launched each
with flag on and flag off
Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Change-Id: I8259b554fe34b453880890c667165547033ccd06
So that when it's moved to SettingsLib, it doesn't need to carry that baggage.
Bug: 346519570
Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Change-Id: I7911a521d96f5dbac2c2395171d324b7b54b8b07
Also fixed a handful of style issues / warnings along the way.
Fixes: 341950853
Fixes: 341910620
Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Change-Id: I65900941fcdf53824caf052fd0a24401c1bfb476