Release input surface of drag completely

Once the input surface needs to be hidden, it never shows
again, so the surface can be removed when the drag is done.

Bug: 138656611
Test: atest DragDropControllerTests
Test: After a drag and drop operation is done, there won't
      have lots of error log when constantly touching screen:
      "Window handle drag has no registered input channel".
      And the CloseGuard of the input surface won't complain
      when finalizing.

Change-Id: I262867c118aeb1a6d091132fac15056dee5fa3f1
This commit is contained in:
Riddle Hsu
2019-07-31 01:08:30 +08:00
parent cac13d44ab
commit cf09181b88

View File

@@ -147,12 +147,6 @@ class DragState {
return mIsClosing;
}
private void hideInputSurface() {
if (mInputSurface != null) {
mTransaction.hide(mInputSurface).apply();
}
}
private void showInputSurface() {
if (mInputSurface == null) {
mInputSurface = mService.makeSurfaceBuilder(
@@ -198,8 +192,6 @@ class DragState {
mInputInterceptor = null;
}
hideInputSurface();
// Send drag end broadcast if drag start has been sent.
if (mDragInProgress) {
final int myPid = Process.myPid();
@@ -239,6 +231,10 @@ class DragState {
}
// Clear the internal variables.
if (mInputSurface != null) {
mTransaction.remove(mInputSurface).apply();
mInputSurface = null;
}
if (mSurfaceControl != null) {
mTransaction.reparent(mSurfaceControl, null).apply();
mSurfaceControl = null;