Merge "Fix consumer closed input channel cause an error occurred (1/2)" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-05-11 05:56:35 +00:00
committed by Android (Google) Code Review
4 changed files with 43 additions and 26 deletions

View File

@@ -4638,14 +4638,17 @@ public final class ViewRootImpl implements ViewParent,
mInputQueueCallback = null;
mInputQueue = null;
}
if (mInputEventReceiver != null) {
mInputEventReceiver.dispose();
mInputEventReceiver = null;
}
try {
mWindowSession.remove(mWindow);
} catch (RemoteException e) {
}
// Dispose receiver would dispose client InputChannel, too. That could send out a socket
// broken event, so we need to unregister the server InputChannel when removing window to
// prevent server side receive the event and prompt error.
if (mInputEventReceiver != null) {
mInputEventReceiver.dispose();
mInputEventReceiver = null;
}
mDisplayManager.unregisterDisplayListener(mDisplayListener);

View File

@@ -191,6 +191,7 @@ public class WindowlessWindowManager implements IWindowSession {
throw new IllegalArgumentException(
"Invalid window token (never added or removed already)");
}
try (SurfaceControl.Transaction t = new SurfaceControl.Transaction()) {
t.remove(state.mSurfaceControl).apply();
}