Add pre/post callback to IDragDropCallback
Previoulsy we uses mWriteLock to avoid race condition between DragDropController and IDragDropCallback. However it turns out we have dead lock here. 1. DragDropController invokes performDrag for drag operation B with holding write lock. 2. The Callback initiates other drag operation A before processing B. 3. A does not complete because DragDropController holding write lock for B. B does not complete because the callback try to process request A before B. The CL removes write lock and separates the existing callback methods into two: pre and post callbacks. 1. DragDropController invokes prePerfromDrag for drag operaiton B, which blocks. 2. The callback initiates other drag operation A before processing B. 3. DragDropController invokes prePerfromDrag for drag operaiton A, which returns immediately. DragDropController processes A and invokes postPefromCallback for A. 4. The Callback unblocks prePerfromDrag for B. Bug: 65564090 Test: android.server.wm.CrossAppDragAndDropTests, manually check the drag and drop behavior on test app. Change-Id: I393a031cb276d6fa7ea56909959d0f2c5d621125
Loading
Please register or sign in to comment