Merge "Deleting DisplayContent#reparentDisplayContent and related code" into sc-dev

This commit is contained in:
Antonio Kantek
2021-06-02 23:23:41 +00:00
committed by Android (Google) Code Review
6 changed files with 0 additions and 105 deletions

View File

@@ -266,20 +266,6 @@ interface IWindowSession {
oneway void updatePointerIcon(IWindow window);
/**
* Reparent the top layers for a display to the requested SurfaceControl. The display that is
* going to be re-parented (the displayId passed in) needs to have been created by the same
* process that is requesting the re-parent. This is to ensure clients can't just re-parent
* display content info to any SurfaceControl, as this would be a security issue.
*
* @param window The window which owns the SurfaceControl. This indicates the z-order of the
* windows of this display against the windows on the parent display.
* @param sc The SurfaceControl that the top level layers for the display should be re-parented
* to.
* @param displayId The id of the display to be re-parented.
*/
oneway void reparentDisplayContent(IWindow window, in SurfaceControl sc, int displayId);
/**
* Update the location of a child display in its parent window. This enables windows in the
* child display to compute the global transformation matrix.

View File

@@ -443,11 +443,6 @@ public class WindowlessWindowManager implements IWindowSession {
public void updatePointerIcon(android.view.IWindow window) {
}
@Override
public void reparentDisplayContent(android.view.IWindow window, android.view.SurfaceControl sc,
int displayId) {
}
@Override
public void updateDisplayContentLocation(android.view.IWindow window, int x, int y,
int displayId) {

View File

@@ -5012,28 +5012,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
&& isTrusted();
}
/**
* Re-parent the DisplayContent's top surface, {@link #mSurfaceControl} to the specified
* SurfaceControl.
*
* @param win The window which owns the SurfaceControl. This indicates the z-order of the
* windows of this display against the windows on the parent display.
* @param sc The new SurfaceControl, where the DisplayContent's surfaces will be re-parented to.
*/
void reparentDisplayContent(WindowState win, SurfaceControl sc) {
if (mParentWindow != null) {
mParentWindow.removeEmbeddedDisplayContent(this);
}
mParentWindow = win;
mParentWindow.addEmbeddedDisplayContent(this);
mParentSurfaceControl = sc;
if (mPortalWindowHandle == null) {
mPortalWindowHandle = createPortalWindowHandle(sc.toString());
}
getPendingTransaction().setInputWindowInfo(sc, mPortalWindowHandle)
.reparent(mSurfaceControl, sc);
}
/**
* Get the window which owns the surface that this DisplayContent is re-parented to.
*

View File

@@ -608,11 +608,6 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
}
}
@Override
public void reparentDisplayContent(IWindow window, SurfaceControl sc, int displayId) {
mService.reparentDisplayContent(window, sc, displayId);
}
@Override
public void updateDisplayContentLocation(IWindow window, int x, int y, int displayId) {
mService.updateDisplayContentLocation(window, x, y, displayId);

View File

@@ -6971,32 +6971,6 @@ public class WindowManagerService extends IWindowManager.Stub
}
}
/** @see Session#reparentDisplayContent(IWindow, SurfaceControl, int) */
void reparentDisplayContent(IWindow client, SurfaceControl sc, int displayId) {
checkCallerOwnsDisplay(displayId);
synchronized (mGlobalLock) {
int uid = Binder.getCallingUid();
final long token = Binder.clearCallingIdentity();
try {
final WindowState win = windowForClientLocked(null, client, false);
if (win == null) {
ProtoLog.w(WM_ERROR, "Bad requesting window %s", client);
return;
}
getDisplayContentOrCreate(displayId, null).reparentDisplayContent(win, sc);
// Notifies AccessibilityController to re-compute the window observer of
// this embedded display
if (mAccessibilityController != null) {
mAccessibilityController.handleWindowObserverOfEmbeddedDisplay(
displayId, win, uid);
}
} finally {
Binder.restoreCallingIdentity(token);
}
}
}
/** @see Session#updateDisplayContentLocation(IWindow, int, int, int) */
void updateDisplayContentLocation(IWindow client, int x, int y, int displayId) {
checkCallerOwnsDisplay(displayId);

View File

@@ -690,39 +690,6 @@ public class WindowStateTests extends WindowTestsBase {
assertThat(mWm.mResizingWindows).doesNotContain(win);
}
@Test
public void testGetTransformationMatrix() {
final int PARENT_WINDOW_OFFSET = 1;
final int DISPLAY_IN_PARENT_WINDOW_OFFSET = 2;
final int WINDOW_OFFSET = 3;
final float OFFSET_SUM =
PARENT_WINDOW_OFFSET + DISPLAY_IN_PARENT_WINDOW_OFFSET + WINDOW_OFFSET;
final WindowState win0 = createWindow(null, TYPE_APPLICATION, "win0");
final DisplayContent dc = createNewDisplay();
win0.getFrame().offsetTo(PARENT_WINDOW_OFFSET, 0);
dc.reparentDisplayContent(win0, win0.getSurfaceControl());
dc.updateLocation(win0, DISPLAY_IN_PARENT_WINDOW_OFFSET, 0);
final float[] values = new float[9];
final Matrix matrix = new Matrix();
final SurfaceControl.Transaction t = spy(StubTransaction.class);
final WindowState win1 = createWindow(null, TYPE_APPLICATION, dc, "win1");
win1.mHasSurface = true;
win1.mSurfaceControl = mock(SurfaceControl.class);
win1.mAttrs.surfaceInsets.set(1, 2, 3, 4);
win1.getFrame().offsetTo(WINDOW_OFFSET, 0);
// Simulate layout
win1.mRelayoutCalled = true;
win1.updateSurfacePosition(t);
win1.getTransformationMatrix(values, matrix);
matrix.getValues(values);
assertEquals(OFFSET_SUM, values[Matrix.MTRANS_X], 0f);
assertEquals(0f, values[Matrix.MTRANS_Y], 0f);
}
@Test
public void testCantReceiveTouchDuringRecentsAnimation() {
final WindowState win0 = createWindow(null, TYPE_APPLICATION, "win0");