diff options
| author | 2023-03-31 17:34:15 +0000 | |
|---|---|---|
| committer | 2023-03-31 17:34:15 +0000 | |
| commit | 952b8f15922babea6539c74eea600c3d85d98cb0 (patch) | |
| tree | 5430e2df5f9c38bdd8191bf9c080acd46eb15b93 | |
| parent | 7a6c7ba69b57e3e18e221e63c7abb27da4e96cc5 (diff) | |
| parent | 220ea0932c737e1bcc26bff9ceb9e4f03c340560 (diff) | |
Merge "Fix || for != in QSTileViewImpl" into udc-dev
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt | 2 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileViewImplTest.kt | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt index 3090b793552f..4a3199850e0f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt @@ -496,7 +496,7 @@ open class QSTileViewImpl @JvmOverloads constructor( } // Colors - if (state.state != lastState || state.disabledByPolicy || lastDisabledByPolicy) { + if (state.state != lastState || state.disabledByPolicy != lastDisabledByPolicy) { singleAnimator.cancel() mQsLogger?.logTileBackgroundColorUpdateIfInternetTile( state.spec, diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileViewImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileViewImplTest.kt index d3ec1dd8bfb2..28aeba461c50 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileViewImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tileimpl/QSTileViewImplTest.kt @@ -317,6 +317,26 @@ class QSTileViewImplTest : SysuiTestCase() { } @Test + fun testDisableByPolicyThenRemoved_changesColor() { + val stateActive = QSTile.State() + stateActive.state = Tile.STATE_ACTIVE + + val stateDisabledByPolicy = stateActive.copy() + stateDisabledByPolicy.disabledByPolicy = true + + tileView.changeState(stateActive) + val activeColors = tileView.getCurrentColors() + + tileView.changeState(stateDisabledByPolicy) + // It has unavailable colors + assertThat(tileView.getCurrentColors()).isNotEqualTo(activeColors) + + // When we get back to not disabled by policy tile, it should go back to active colors + tileView.changeState(stateActive) + assertThat(tileView.getCurrentColors()).containsExactlyElementsIn(activeColors) + } + + @Test fun testDisabledByPolicy_secondaryLabelText() { val testA11yLabel = "TEST_LABEL" context.orCreateTestableResources |