Revert "Adapt flicker tests to perfetto-based SurfaceFlinger tracing"
This reverts commit 60b2a3adc2a1caad3ae780815df8a5dd47c5ced4.
Reason for revert: 298512106
Change-Id: I8a2e2d564022dd5e90263f0b8264ca2517f5b6a5
diff --git a/tests/SurfaceViewBufferTests/Android.bp b/tests/SurfaceViewBufferTests/Android.bp
index 38313f8..dc75f00 100644
--- a/tests/SurfaceViewBufferTests/Android.bp
+++ b/tests/SurfaceViewBufferTests/Android.bp
@@ -23,10 +23,7 @@
android_test {
name: "SurfaceViewBufferTests",
- srcs: [
- "**/*.java",
- "**/*.kt",
- ],
+ srcs: ["**/*.java","**/*.kt"],
manifest: "AndroidManifest.xml",
test_config: "AndroidTest.xml",
platform_apis: true,
@@ -44,7 +41,6 @@
"kotlin-stdlib",
"kotlinx-coroutines-android",
"flickerlib",
- "flickerlib-trace_processor_shell",
"truth-prebuilt",
"cts-wm-util",
"CtsSurfaceValidatorLib",
@@ -64,7 +60,7 @@
"libandroid",
],
include_dirs: [
- "system/core/include",
+ "system/core/include"
],
stl: "libc++_static",
cflags: [
diff --git a/tests/SurfaceViewBufferTests/AndroidManifest.xml b/tests/SurfaceViewBufferTests/AndroidManifest.xml
index 798c67a..78415e8 100644
--- a/tests/SurfaceViewBufferTests/AndroidManifest.xml
+++ b/tests/SurfaceViewBufferTests/AndroidManifest.xml
@@ -29,12 +29,9 @@
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<!-- Save failed test bitmap images !-->
<uses-permission android:name="android.Manifest.permission.WRITE_EXTERNAL_STORAGE"/>
- <!-- Allow the test to connect to perfetto trace processor -->
- <uses-permission android:name="android.permission.INTERNET"/>
<application android:allowBackup="false"
- android:supportsRtl="true"
- android:networkSecurityConfig="@xml/network_security_config">
+ android:supportsRtl="true">
<activity android:name=".MainActivity"
android:taskAffinity="com.android.test.MainActivity"
android:theme="@style/AppTheme"
diff --git a/tests/SurfaceViewBufferTests/res/xml/network_security_config.xml b/tests/SurfaceViewBufferTests/res/xml/network_security_config.xml
deleted file mode 100644
index 4bd9ca0..0000000
--- a/tests/SurfaceViewBufferTests/res/xml/network_security_config.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (C) 2023 The Android Open Source Project
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<network-security-config>
- <domain-config cleartextTrafficPermitted="true">
- <domain includeSubdomains="true">localhost</domain>
- </domain-config>
-</network-security-config>
diff --git a/tests/SurfaceViewBufferTests/src/com/android/test/SurfaceTracingTestBase.kt b/tests/SurfaceViewBufferTests/src/com/android/test/SurfaceTracingTestBase.kt
index b03b733..a38019d 100644
--- a/tests/SurfaceViewBufferTests/src/com/android/test/SurfaceTracingTestBase.kt
+++ b/tests/SurfaceViewBufferTests/src/com/android/test/SurfaceTracingTestBase.kt
@@ -21,9 +21,11 @@
import android.graphics.Rect
import android.util.Log
import androidx.test.ext.junit.rules.ActivityScenarioRule
+import android.tools.common.flicker.subject.layers.LayerSubject
import android.tools.common.traces.surfaceflinger.LayersTrace
+import android.tools.device.traces.io.ResultWriter
+import android.tools.device.traces.monitors.surfaceflinger.LayersTraceMonitor
import android.tools.device.traces.monitors.withSFTracing
-import android.tools.device.traces.monitors.PerfettoTraceMonitor
import junit.framework.Assert
import org.junit.After
import org.junit.Before
@@ -31,7 +33,6 @@
import java.io.FileOutputStream
import java.io.IOException
import java.util.concurrent.CountDownLatch
-import perfetto.protos.PerfettoConfig.SurfaceFlingerLayersConfig
open class SurfaceTracingTestBase(useBlastAdapter: Boolean) :
SurfaceViewBufferTestBase(useBlastAdapter) {
@@ -42,7 +43,7 @@
@Before
override fun setup() {
super.setup()
- PerfettoTraceMonitor.stopAllSessions()
+ stopLayerTrace()
addSurfaceView()
}
@@ -82,6 +83,10 @@
instrumentation.waitForIdleSync()
}
+ private fun stopLayerTrace() {
+ LayersTraceMonitor().stop(ResultWriter())
+ }
+
fun checkPixels(bounds: Rect, @ColorInt color: Int) {
val screenshot = instrumentation.getUiAutomation().takeScreenshot()
val pixels = IntArray(screenshot.width * screenshot.height)
@@ -101,19 +106,14 @@
Log.e("SurfaceViewBufferTests", "Error writing bitmap to file", e)
}
}
- Assert.assertEquals(
- "Checking $bounds found mismatch $i,$j",
- Color.valueOf(color),
- Color.valueOf(actualColor)
- )
+ Assert.assertEquals("Checking $bounds found mismatch $i,$j",
+ Color.valueOf(color), Color.valueOf(actualColor))
}
}
}
private companion object {
- private val TRACE_FLAGS = listOf(
- SurfaceFlingerLayersConfig.TraceFlag.TRACE_FLAG_BUFFERS,
- SurfaceFlingerLayersConfig.TraceFlag.TRACE_FLAG_VIRTUAL_DISPLAYS,
- )
+ private const val TRACE_FLAGS =
+ (1 shl 0) or (1 shl 5) or (1 shl 6) // TRACE_CRITICAL | TRACE_BUFFERS | TRACE_SYNC
}
}
\ No newline at end of file