Merge "[Partial Screensharing] Enable recent tasks" into tm-qpr-dev

This commit is contained in:
Nick Chameyev
2022-10-20 17:32:09 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 6 deletions

View File

@@ -19,6 +19,7 @@ package com.android.systemui.testing.screenshot
import android.app.Activity
import android.graphics.Color
import android.view.View
import android.view.Window
import android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
@@ -51,13 +52,14 @@ class ExternalViewScreenshotTestRule(emulationSpec: DeviceEmulationSpec) : TestR
/**
* Compare the content of the [view] with the golden image identified by [goldenIdentifier] in
* the context of [emulationSpec].
* the context of [emulationSpec]. Window must be specified to capture views that render
* hardware buffers.
*/
fun screenshotTest(goldenIdentifier: String, view: View) {
fun screenshotTest(goldenIdentifier: String, view: View, window: Window? = null) {
view.removeElevationRecursively()
ScreenshotRuleAsserter.Builder(screenshotRule)
.setScreenshotProvider { view.toBitmap() }
.setScreenshotProvider { view.toBitmap(window) }
.withMatcher(matcher)
.build()
.assertGoldenImage(goldenIdentifier)
@@ -94,6 +96,6 @@ class ExternalViewScreenshotTestRule(emulationSpec: DeviceEmulationSpec) : TestR
activity.currentFocus?.clearFocus()
}
screenshotTest(goldenIdentifier, rootView)
screenshotTest(goldenIdentifier, rootView, activity.window)
}
}

View File

@@ -182,8 +182,7 @@ class MediaProjectionAppSelectorActivity(
override fun shouldGetOnlyDefaultActivities() = false
// TODO(b/240924732) flip the flag when the recents selector is ready
override fun shouldShowContentPreview() = false
override fun shouldShowContentPreview() = true
override fun createContentPreviewView(parent: ViewGroup): ViewGroup =
recentsViewController.createView(parent)