Merge "Fix StatusBar chip location not updated after screen rotation" into udc-qpr-dev am: 509eed4b40

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24038549

Change-Id: Id682fe1e2e5f85881d6f58f2fd5dc249566e8cc8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Johannes Gallmann
2023-07-24 12:05:54 +00:00
committed by Automerger Merge Worker
2 changed files with 11 additions and 1 deletions

View File

@@ -265,6 +265,11 @@ class SystemEventChipAnimationController @Inject constructor(
// not animating then [prepareChipAnimation] will take care of it for us
currentAnimatedView?.let {
updateChipBounds(it, newContentArea)
// Since updateCurrentAnimatedView can only be called during an animation, we
// have to create a dummy animator here to apply the new chip bounds
val animator = ValueAnimator.ofInt(0, 1).setDuration(0)
animator.addUpdateListener { updateCurrentAnimatedView() }
animator.start()
}
}
})

View File

@@ -18,6 +18,8 @@ package com.android.systemui.statusbar.events
import android.content.Context
import android.graphics.Rect
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
import android.util.Pair
import android.view.Gravity
import android.view.View
@@ -37,11 +39,14 @@ import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mock
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations
@SmallTest
@RunWith(AndroidTestingRunner::class)
@TestableLooper.RunWithLooper
class SystemEventChipAnimationControllerTest : SysuiTestCase() {
private lateinit var controller: SystemEventChipAnimationController
@@ -159,7 +164,7 @@ class SystemEventChipAnimationControllerTest : SysuiTestCase() {
assertThat(chipRect).isEqualTo(Rect(890, 25, 990, 75))
}
class TestView(context: Context) : View(context), BackgroundAnimatableView {
private class TestView(context: Context) : View(context), BackgroundAnimatableView {
override val view: View
get() = this