summaryrefslogtreecommitdiff
path: root/apct-tests
diff options
context:
space:
mode:
authorTiger Huang <tigerhuang@google.com>2020-03-29 01:17:08 +0800
committerTiger Huang <tigerhuang@google.com>2020-04-07 16:05:40 +0800
commit0426a3365011309181fbc179ddff87bb6cd974bd (patch)
treefaad5b1b99e61ecf6b434cae4f5ea611be85d9ed /apct-tests
parent9cea19d887862c66ae2518a3e6cec4b5fd2927f5 (diff)
Update controls after addToDisplay/relayout before dispatching insets
A window might request to control insets before it is added to WM and expect the first dispatched WindowInsets as requested. The first insets state returned from addToDisplay or relayout might be not expected if the window just become thecontrol target in the function. With this CL, WM can return controls from addToDisplay and relayout, so that the client can apply controls immediately, and update controlled insets sources before dispatching the insets to the view hierarchy. This enaures the insets dispatched are up-to-date. Fix: 150756571 Test: atest WindowInsetsControllerTests RelayoutPerfTest WindowAddRemovePerfTest Change-Id: Ib78c24beb7af5a54ad78935c3ddb260ef9645212
Diffstat (limited to 'apct-tests')
-rw-r--r--apct-tests/perftests/core/src/android/wm/RelayoutPerfTest.java4
-rw-r--r--apct-tests/perftests/core/src/android/wm/WindowAddRemovePerfTest.java4
2 files changed, 6 insertions, 2 deletions
diff --git a/apct-tests/perftests/core/src/android/wm/RelayoutPerfTest.java b/apct-tests/perftests/core/src/android/wm/RelayoutPerfTest.java
index 8633c9613138..8139a2e963c5 100644
--- a/apct-tests/perftests/core/src/android/wm/RelayoutPerfTest.java
+++ b/apct-tests/perftests/core/src/android/wm/RelayoutPerfTest.java
@@ -30,6 +30,7 @@ import android.util.MergedConfiguration;
import android.view.DisplayCutout;
import android.view.IWindow;
import android.view.IWindowSession;
+import android.view.InsetsSourceControl;
import android.view.InsetsState;
import android.view.SurfaceControl;
import android.view.View;
@@ -120,6 +121,7 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase {
new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT);
final MergedConfiguration mOutMergedConfiguration = new MergedConfiguration();
final InsetsState mOutInsetsState = new InsetsState();
+ final InsetsSourceControl[] mOutControls = new InsetsSourceControl[0];
final IWindow mWindow;
final View mView;
final WindowManager.LayoutParams mParams;
@@ -152,7 +154,7 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase {
mViewVisibility.getAsInt(), mFlags, mFrameNumber, mOutFrame,
mOutContentInsets, mOutVisibleInsets, mOutStableInsets,
mOutBackDropFrame, mOutDisplayCutout, mOutMergedConfiguration,
- mOutSurfaceControl, mOutInsetsState, mOutSurfaceSize,
+ mOutSurfaceControl, mOutInsetsState, mOutControls, mOutSurfaceSize,
mOutBlastSurfaceControl);
}
}
diff --git a/apct-tests/perftests/core/src/android/wm/WindowAddRemovePerfTest.java b/apct-tests/perftests/core/src/android/wm/WindowAddRemovePerfTest.java
index 4ac3adfd19ce..c72cc9d635e0 100644
--- a/apct-tests/perftests/core/src/android/wm/WindowAddRemovePerfTest.java
+++ b/apct-tests/perftests/core/src/android/wm/WindowAddRemovePerfTest.java
@@ -29,6 +29,7 @@ import android.view.Display;
import android.view.DisplayCutout;
import android.view.IWindowSession;
import android.view.InputChannel;
+import android.view.InsetsSourceControl;
import android.view.InsetsState;
import android.view.View;
import android.view.WindowManager;
@@ -91,6 +92,7 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase
final DisplayCutout.ParcelableWrapper mOutDisplayCutout =
new DisplayCutout.ParcelableWrapper();
final InsetsState mOutInsetsState = new InsetsState();
+ final InsetsSourceControl[] mOutControls = new InsetsSourceControl[0];
TestWindow() {
mLayoutParams.setTitle(TestWindow.class.getName());
@@ -109,7 +111,7 @@ public class WindowAddRemovePerfTest extends WindowManagerPerfTestBase
long startTime = SystemClock.elapsedRealtimeNanos();
session.addToDisplay(this, mSeq, mLayoutParams, View.VISIBLE,
Display.DEFAULT_DISPLAY, mOutFrame, mOutContentInsets, mOutStableInsets,
- mOutDisplayCutout, inputChannel, mOutInsetsState);
+ mOutDisplayCutout, inputChannel, mOutInsetsState, mOutControls);
final long elapsedTimeNsOfAdd = SystemClock.elapsedRealtimeNanos() - startTime;
state.addExtraResult("add", elapsedTimeNsOfAdd);