Add logging for Smart Space on Dream surface.

Bug: 227613246
Fix: 227613246
Test: manually on device - SS events logged same as for lockscreen.
Note: clicks are logged for reminder card but not for weather card,
which is the same behavior as for lockscreen.
Test: atest DreamSmartspaceControllerTest

Change-Id: If4931fc9da0688cfe63e7519713f4107d8d001c5
This commit is contained in:
Xiaowen Lei
2022-04-19 03:28:09 +00:00
parent 2ca8b4def9
commit 13cb74291f
4 changed files with 19 additions and 4 deletions

View File

@@ -93,6 +93,12 @@ public interface BcSmartspaceDataPlugin extends Plugin {
*/
void setPrimaryTextColor(int color);
/**
* When the view is displayed on Dream, set the flag to true, immediately after the view is
* created.
*/
void setIsDreaming(boolean isDreaming);
/**
* Range [0.0 - 1.0] when transitioning from Lockscreen to/from AOD
*/

View File

@@ -98,6 +98,7 @@ class DreamsSmartspaceController @Inject constructor(
view.setPrimaryTextColor(Color.WHITE)
smartspaceViews.add(view)
connectSession()
view.setDozeAmount(0f)
}
override fun onViewDetachedFromWindow(v: View) {
@@ -127,6 +128,7 @@ class DreamsSmartspaceController @Inject constructor(
}
val view = buildView(parent)
connectSession()
return view
@@ -136,12 +138,13 @@ class DreamsSmartspaceController @Inject constructor(
return if (plugin != null) {
var view = smartspaceViewComponentFactory.create(parent, plugin, stateChangeListener)
.getView()
if (view is View) {
return view
if (view !is View) {
return null
}
return null
view.setIsDreaming(true)
return view
} else {
null
}

View File

@@ -136,6 +136,8 @@ class DreamSmartspaceControllerTest : SysuiTestCase() {
override fun setPrimaryTextColor(color: Int) {}
override fun setIsDreaming(isDreaming: Boolean) {}
override fun setDozeAmount(amount: Float) {}
override fun setIntentStarter(intentStarter: BcSmartspaceDataPlugin.IntentStarter?) {}
@@ -173,6 +175,7 @@ class DreamSmartspaceControllerTest : SysuiTestCase() {
stateChangeListener.onViewAttachedToWindow(mockView)
verify(smartspaceManager).createSmartspaceSession(any())
verify(mockView).setDozeAmount(0f)
stateChangeListener.onViewDetachedFromWindow(mockView)

View File

@@ -544,6 +544,9 @@ class LockscreenSmartspaceControllerTest : SysuiTestCase() {
override fun setPrimaryTextColor(color: Int) {
}
override fun setIsDreaming(isDreaming: Boolean) {
}
override fun setDozeAmount(amount: Float) {
}