chaviw d32068af7d Add SurfaceSyncer class
Add Syncer class that allows callers to add desired syncs into a set and
wait for them to all complete before getting a callback. The purpose of
the Syncer is to be an accounting mechanism so each sync implementation
doesn't need to handle it themselves. The Syncer class is used the
following way.

1. SurfaceSyncer#setupSync is called
2. addToSync is called for every SyncTarget object that wants to be
   included in the sync. If the addSync is called for a View or
   SurfaceView it needs to be called on the UI thread. When addToSync is
   called, it's guaranteed that any UI updates that were requested before
   addToSync but after the last frame drew, will be included in the sync.
3. SurfaceSyncer#markSyncReady should be called when all the SyncTargets
   have been added to the SyncSet. Now the SyncSet is closed and no more
   SyncTargets can be added to it.
4. When all SyncTargets are complete, the final merged Transaction will
   either be applied or sent back to the caller.

The following is what happens within the SyncSet
1. Each SyncableTarget will get an onReadyToSync callback that contains
   a SyncBufferCallback.
2. Each SyncableTarget needs to invoke SyncBufferCallback#onBufferReady.
   This makes sure the SyncSet knows when the SyncTarget is complete,
   allowing the SyncSet to get the Transaction that contains the buffer.
3. When the final FrameCallback finishes for the SyncSet, the
   syncRequestComplete Consumer will be invoked with the transaction
   that contains all information requested in the sync. This could include
   buffers and geometry changes. The buffer update will include the UI
   changes that were requested for the View.

Test: SurfaceSyncerTest
Test: SurfaceSyncerContinuousTest
Bug: 200284684
Change-Id: Iab87bff8a0483581e57803724eae88f0a3d96c8e
2022-02-25 13:44:46 -06:00

96 lines
5.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2018 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.frameworks.wmtests">
<!-- Uses API introduced in P (28) -->
<uses-sdk
android:minSdkVersion="1"
android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
<uses-permission android:name="android.permission.MANAGE_ACTIVITY_TASKS" />
<uses-permission android:name="android.permission.GET_TOP_ACTIVITY_INFO" />
<uses-permission android:name="android.permission.MANAGE_USERS" />
<uses-permission android:name="android.permission.STORAGE_INTERNAL" />
<uses-permission android:name="android.permission.ACCESS_KEYGUARD_SECURE_STORAGE" />
<uses-permission android:name="android.permission.STATUS_BAR_SERVICE" />
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" />
<uses-permission android:name="android.permission.READ_FRAME_BUFFER" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
<uses-permission android:name="android.permission.STATUS_BAR" />
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
<uses-permission android:name="android.permission.READ_COMPAT_CHANGE_CONFIG" />
<uses-permission android:name="android.permission.LOG_COMPAT_CHANGE" />
<uses-permission android:name="android.permission.CAPTURE_BLACKOUT_CONTENT"/>
<uses-permission android:name="android.permission.WRITE_DEVICE_CONFIG" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- TODO: Remove largeHeap hack when memory leak is fixed (b/123984854) -->
<application android:debuggable="true"
android:testOnly="true"
android:largeHeap="true">
<uses-library android:name="android.test.mock" android:required="true" />
<uses-library android:name="android.test.runner" />
<activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityA" />
<activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityB" />
<activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityRequestedOrientationChange" />
<activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityTaskChangeCallbacks" />
<activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityTaskDescriptionChange" />
<activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ActivityInVirtualDisplay"
android:resizeableActivity="true" />
<activity android:name="com.android.server.wm.TaskStackChangedListenerTest$LandscapeActivity"
android:screenOrientation="sensorLandscape"
android:showWhenLocked="true"
android:turnScreenOn="true" />
<activity android:name="com.android.server.wm.TaskStackChangedListenerTest$ResumeWhilePausingActivity"
android:resumeWhilePausing="true"/>
<activity android:name="com.android.server.wm.ActivityLeakTests$DetectLeakActivity" />
<!--
Simulate the common trampoline task that uses floating/translucent theme to avoid double
starting windows and animations of task open.
-->
<activity android:name="com.android.server.wm.ActivityOptionsTest$TrampolineActivity"
android:taskAffinity="com.android.frameworks.wmtests.trampoline"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:turnScreenOn="true"
android:showWhenLocked="true" />
<activity android:name="com.android.server.wm.ActivityOptionsTest$MainActivity"
android:turnScreenOn="true"
android:showWhenLocked="true" />
<activity android:name="com.android.server.wm.ScreenshotTests$ScreenshotActivity" />
<activity android:name="android.view.cts.surfacevalidator.CapturedActivity"/>
<service android:name="android.view.cts.surfacevalidator.LocalMediaProjectionService"
android:foregroundServiceType="mediaProjection"
android:enabled="true">
</service>
</application>
<instrumentation
android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="Window Manager Tests"
android:targetPackage="com.android.frameworks.wmtests" />
</manifest>