diff options
14 files changed, 31 insertions, 135 deletions
diff --git a/libs/WindowManager/Shell/tests/flicker/Android.bp b/libs/WindowManager/Shell/tests/flicker/Android.bp index 6f73a7e4f283..dfbadae2b853 100644 --- a/libs/WindowManager/Shell/tests/flicker/Android.bp +++ b/libs/WindowManager/Shell/tests/flicker/Android.bp @@ -114,7 +114,6 @@ java_defaults { "flickertestapplib", "flickerlib", "flickerlib-helpers", - "flickerlib-trace_processor_shell", "platform-test-annotations", "wm-flicker-common-app-helpers", "wm-flicker-common-assertions", diff --git a/libs/WindowManager/Shell/tests/flicker/manifests/AndroidManifest.xml b/libs/WindowManager/Shell/tests/flicker/manifests/AndroidManifest.xml index ae130b8f6f7d..6a87de47def4 100644 --- a/libs/WindowManager/Shell/tests/flicker/manifests/AndroidManifest.xml +++ b/libs/WindowManager/Shell/tests/flicker/manifests/AndroidManifest.xml @@ -45,13 +45,9 @@ <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" /> <!-- Enable bubble notification--> <uses-permission android:name="android.permission.STATUS_BAR_SERVICE" /> - <!-- Allow the test to connect to perfetto trace processor --> - <uses-permission android:name="android.permission.INTERNET"/> - <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> - <application android:requestLegacyExternalStorage="true" - android:networkSecurityConfig="@xml/network_security_config" - android:largeHeap="true"> + <!-- Allow the test to write directly to /sdcard/ --> + <application android:requestLegacyExternalStorage="true" android:largeHeap="true"> <uses-library android:name="android.test.runner"/> <service android:name=".NotificationListener" diff --git a/libs/WindowManager/Shell/tests/flicker/res/xml/network_security_config.xml b/libs/WindowManager/Shell/tests/flicker/res/xml/network_security_config.xml deleted file mode 100644 index 4bd9ca049f55..000000000000 --- a/libs/WindowManager/Shell/tests/flicker/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/FlickerTests/Android.bp b/tests/FlickerTests/Android.bp index a2ae56eaeadc..2ccc0fa9e1e7 100644 --- a/tests/FlickerTests/Android.bp +++ b/tests/FlickerTests/Android.bp @@ -95,7 +95,6 @@ java_defaults { "flickertestapplib", "flickerlib", "flickerlib-helpers", - "flickerlib-trace_processor_shell", "platform-test-annotations", "wm-flicker-common-app-helpers", "wm-shell-flicker-utils", diff --git a/tests/FlickerTests/manifests/AndroidManifest.xml b/tests/FlickerTests/manifests/AndroidManifest.xml index 6bc7cbe88589..1a34d9ea0f83 100644 --- a/tests/FlickerTests/manifests/AndroidManifest.xml +++ b/tests/FlickerTests/manifests/AndroidManifest.xml @@ -44,12 +44,8 @@ <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" /> <!-- ActivityOptions.makeCustomTaskAnimation() --> <uses-permission android:name="android.permission.START_TASKS_FROM_RECENTS" /> - <!-- Allow the test to connect to perfetto trace processor --> - <uses-permission android:name="android.permission.INTERNET"/> - <!-- Allow the test to write directly to /sdcard/ and connect to trace processor --> - <application android:requestLegacyExternalStorage="true" - android:networkSecurityConfig="@xml/network_security_config" - android:largeHeap="true"> + <!-- Allow the test to write directly to /sdcard/ --> + <application android:requestLegacyExternalStorage="true" android:largeHeap="true"> <uses-library android:name="android.test.runner"/> <uses-library android:name="androidx.window.extensions" android:required="false"/> diff --git a/tests/FlickerTests/res/xml/network_security_config.xml b/tests/FlickerTests/res/xml/network_security_config.xml deleted file mode 100644 index 4bd9ca049f55..000000000000 --- a/tests/FlickerTests/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/Android.bp b/tests/SurfaceViewBufferTests/Android.bp index 38313f85c31d..dc75f00e7cdc 100644 --- a/tests/SurfaceViewBufferTests/Android.bp +++ b/tests/SurfaceViewBufferTests/Android.bp @@ -23,10 +23,7 @@ package { android_test { name: "SurfaceViewBufferTests", - srcs: [ - "**/*.java", - "**/*.kt", - ], + srcs: ["**/*.java","**/*.kt"], manifest: "AndroidManifest.xml", test_config: "AndroidTest.xml", platform_apis: true, @@ -44,7 +41,6 @@ android_test { "kotlin-stdlib", "kotlinx-coroutines-android", "flickerlib", - "flickerlib-trace_processor_shell", "truth-prebuilt", "cts-wm-util", "CtsSurfaceValidatorLib", @@ -64,7 +60,7 @@ cc_library_shared { "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 798c67a320ce..78415e8641eb 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 4bd9ca049f55..000000000000 --- 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 b03b7335b08b..a38019d67376 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.Color 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 org.junit.Rule 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 @@ open class SurfaceTracingTestBase(useBlastAdapter: Boolean) : @Before override fun setup() { super.setup() - PerfettoTraceMonitor.stopAllSessions() + stopLayerTrace() addSurfaceView() } @@ -82,6 +83,10 @@ open class SurfaceTracingTestBase(useBlastAdapter: Boolean) : 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 @@ open class SurfaceTracingTestBase(useBlastAdapter: Boolean) : 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 diff --git a/tests/TaskOrganizerTest/Android.bp b/tests/TaskOrganizerTest/Android.bp index bf12f423f145..9b72d359aae6 100644 --- a/tests/TaskOrganizerTest/Android.bp +++ b/tests/TaskOrganizerTest/Android.bp @@ -25,10 +25,7 @@ package { android_test { name: "TaskOrganizerTest", - srcs: [ - "**/*.java", - "**/*.kt", - ], + srcs: ["**/*.java","**/*.kt"], manifest: "AndroidManifest.xml", test_config: "AndroidTest.xml", platform_apis: true, @@ -42,7 +39,6 @@ android_test { "kotlin-stdlib", "kotlinx-coroutines-android", "flickerlib", - "flickerlib-trace_processor_shell", "truth-prebuilt", ], -} +}
\ No newline at end of file diff --git a/tests/TaskOrganizerTest/AndroidManifest.xml b/tests/TaskOrganizerTest/AndroidManifest.xml index cbeb246eb86c..1f1bd3ef7d81 100644 --- a/tests/TaskOrganizerTest/AndroidManifest.xml +++ b/tests/TaskOrganizerTest/AndroidManifest.xml @@ -16,11 +16,9 @@ <uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/> <uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS"/> <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"/> - <!-- Allow the test to connect to perfetto trace processor --> - <uses-permission android:name="android.permission.INTERNET"/> <!-- Enable / Disable tracing !--> <uses-permission android:name="android.permission.DUMP" /> - <application android:networkSecurityConfig="@xml/network_security_config"> + <application> <activity android:name="TaskOrganizerMultiWindowTest" android:label="TaskOrganizer MW Test" android:exported="true" diff --git a/tests/TaskOrganizerTest/res/xml/network_security_config.xml b/tests/TaskOrganizerTest/res/xml/network_security_config.xml deleted file mode 100644 index e450a993da28..000000000000 --- a/tests/TaskOrganizerTest/res/xml/network_security_config.xml +++ /dev/null @@ -1,21 +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>
\ No newline at end of file diff --git a/tests/TaskOrganizerTest/src/com/android/test/taskembed/ResizeTasksSyncTest.kt b/tests/TaskOrganizerTest/src/com/android/test/taskembed/ResizeTasksSyncTest.kt index 2c7905d552f1..6f4f7b13af66 100644 --- a/tests/TaskOrganizerTest/src/com/android/test/taskembed/ResizeTasksSyncTest.kt +++ b/tests/TaskOrganizerTest/src/com/android/test/taskembed/ResizeTasksSyncTest.kt @@ -22,6 +22,8 @@ import androidx.test.platform.app.InstrumentationRegistry import androidx.test.runner.AndroidJUnit4 import android.tools.common.datatypes.Size import android.tools.common.flicker.subject.layers.LayersTraceSubject +import android.tools.device.traces.io.ResultWriter +import android.tools.device.traces.monitors.surfaceflinger.LayersTraceMonitor import android.tools.device.traces.monitors.withSFTracing import org.junit.After import org.junit.Before @@ -39,13 +41,16 @@ class ResizeTasksSyncTest { @get:Rule var scenarioRule: ActivityScenarioRule<TaskOrganizerMultiWindowTest> = ActivityScenarioRule<TaskOrganizerMultiWindowTest>( - TaskOrganizerMultiWindowTest::class.java - ) + TaskOrganizerMultiWindowTest::class.java) protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation() @Before fun setup() { + val monitor = LayersTraceMonitor() + if (monitor.isEnabled) { + monitor.stop(ResultWriter()) + } val firstTaskBounds = Rect(0, 0, 1080, 1000) val secondTaskBounds = Rect(0, 1000, 1080, 2000) @@ -66,7 +71,7 @@ class ResizeTasksSyncTest { val firstBounds = Rect(0, 0, 1080, 800) val secondBounds = Rect(0, 1000, 1080, 1800) - val trace = withSFTracing() { + val trace = withSFTracing(TRACE_FLAGS) { lateinit var resizeReadyLatch: CountDownLatch scenarioRule.getScenario().onActivity { resizeReadyLatch = it.resizeTaskView(firstBounds, secondBounds) @@ -101,6 +106,7 @@ class ResizeTasksSyncTest { } companion object { + private const val TRACE_FLAGS = 0x1 // TRACE_CRITICAL private const val FIRST_ACTIVITY = "Activity1" private const val SECOND_ACTIVITY = "Activity2" } |