Merge "Move setIsDreaming(..); to be right after plugin.getView(parent);." into tm-qpr-dev am: 1e43c3b429
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18976489 Change-Id: I2cf83db4c700a61c43e88f4b24f99e3a488c7313 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -145,9 +145,6 @@ class DreamSmartspaceController @Inject constructor(
|
||||
if (view !is View) {
|
||||
return null
|
||||
}
|
||||
|
||||
view.setIsDreaming(true)
|
||||
|
||||
return view
|
||||
} else {
|
||||
null
|
||||
|
||||
@@ -56,6 +56,8 @@ interface SmartspaceViewComponent {
|
||||
):
|
||||
BcSmartspaceDataPlugin.SmartspaceView {
|
||||
val ssView = plugin.getView(parent)
|
||||
// Currently, this is only used to provide SmartspaceView on Dream surface.
|
||||
ssView.setIsDreaming(true)
|
||||
ssView.registerDataProvider(plugin)
|
||||
|
||||
ssView.setIntentStarter(object : BcSmartspaceDataPlugin.IntentStarter {
|
||||
@@ -81,4 +83,4 @@ interface SmartspaceViewComponent {
|
||||
return ssView
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,17 +36,17 @@ import com.android.systemui.util.mockito.any
|
||||
import com.android.systemui.util.mockito.eq
|
||||
import com.android.systemui.util.mockito.withArgCaptor
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import java.util.Optional
|
||||
import java.util.concurrent.Executor
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Spy
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.mockito.Mockito.verify
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.mockito.MockitoAnnotations
|
||||
import java.util.Optional
|
||||
import java.util.concurrent.Executor
|
||||
import org.mockito.Spy
|
||||
|
||||
@SmallTest
|
||||
@RunWith(AndroidTestingRunner::class)
|
||||
@@ -87,6 +87,34 @@ class DreamSmartspaceControllerTest : SysuiTestCase() {
|
||||
|
||||
private lateinit var controller: DreamSmartspaceController
|
||||
|
||||
/**
|
||||
* A class which implements SmartspaceView and extends View. This is mocked to provide the right
|
||||
* object inheritance and interface implementation used in DreamSmartspaceController
|
||||
*/
|
||||
private class TestView(context: Context?) : View(context), SmartspaceView {
|
||||
override fun registerDataProvider(plugin: BcSmartspaceDataPlugin?) {}
|
||||
|
||||
override fun setPrimaryTextColor(color: Int) {}
|
||||
|
||||
override fun setIsDreaming(isDreaming: Boolean) {}
|
||||
|
||||
override fun setDozeAmount(amount: Float) {}
|
||||
|
||||
override fun setIntentStarter(intentStarter: BcSmartspaceDataPlugin.IntentStarter?) {}
|
||||
|
||||
override fun setFalsingManager(falsingManager: FalsingManager?) {}
|
||||
|
||||
override fun setDnd(image: Drawable?, description: String?) {}
|
||||
|
||||
override fun setNextAlarm(image: Drawable?, description: String?) {}
|
||||
|
||||
override fun setMediaTarget(target: SmartspaceTarget?) {}
|
||||
|
||||
override fun getSelectedPage(): Int { return 0; }
|
||||
|
||||
override fun getCurrentCardTopPadding(): Int { return 0; }
|
||||
}
|
||||
|
||||
@Before
|
||||
fun setup() {
|
||||
MockitoAnnotations.initMocks(this)
|
||||
@@ -129,34 +157,6 @@ class DreamSmartspaceControllerTest : SysuiTestCase() {
|
||||
verify(session).close()
|
||||
}
|
||||
|
||||
/**
|
||||
* A class which implements SmartspaceView and extends View. This is mocked to provide the right
|
||||
* object inheritance and interface implementation used in DreamSmartspaceController
|
||||
*/
|
||||
private class TestView(context: Context?) : View(context), SmartspaceView {
|
||||
override fun registerDataProvider(plugin: BcSmartspaceDataPlugin?) {}
|
||||
|
||||
override fun setPrimaryTextColor(color: Int) {}
|
||||
|
||||
override fun setIsDreaming(isDreaming: Boolean) {}
|
||||
|
||||
override fun setDozeAmount(amount: Float) {}
|
||||
|
||||
override fun setIntentStarter(intentStarter: BcSmartspaceDataPlugin.IntentStarter?) {}
|
||||
|
||||
override fun setFalsingManager(falsingManager: FalsingManager?) {}
|
||||
|
||||
override fun setDnd(image: Drawable?, description: String?) {}
|
||||
|
||||
override fun setNextAlarm(image: Drawable?, description: String?) {}
|
||||
|
||||
override fun setMediaTarget(target: SmartspaceTarget?) {}
|
||||
|
||||
override fun getSelectedPage(): Int { return 0; }
|
||||
|
||||
override fun getCurrentCardTopPadding(): Int { return 0; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures session begins when a view is attached.
|
||||
*/
|
||||
@@ -180,16 +180,4 @@ class DreamSmartspaceControllerTest : SysuiTestCase() {
|
||||
|
||||
verify(session).close()
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures setIsDreaming(true) is called when the view is built.
|
||||
*/
|
||||
@Test
|
||||
fun testSetIsDreamingTrueOnViewCreate() {
|
||||
`when`(precondition.conditionsMet()).thenReturn(true)
|
||||
|
||||
controller.buildAndConnectView(Mockito.mock(ViewGroup::class.java))
|
||||
|
||||
verify(smartspaceView).setIsDreaming(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user