[Partial Screensharing] Enable recent tasks

Enables recent tasks in media projection app
selector activity and updates screenshot
test goldens.

Bug: 240119797
Test: screenshot test
Change-Id: I33f617bdb5fd90c5489ea55b3b14003f2de0570f
This commit is contained in:
Nick Chameyev
2022-10-03 17:53:46 +01:00
parent 59b7cd4e36
commit 8250a0a25d
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)