BQ: Replace items from back of queue

It's possible to have one or more non-droppable items in the queue
ahead of a droppable item. In that case we want to replace the
droppable one at the end of the queue. By changing the policy to
always replace the last item in the queue (if it's droppable) we
ensure that there will never be more than one droppable item in the
queue and that it will always be the last one.

Bug 27129258

Change-Id: I9a6234fe12a0095ccb93ceb9cdb74616944900b0
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 6ccd4ff..c640f58 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -251,7 +251,7 @@
             ALOGE("Can't replace a frame on an empty queue");
             return;
         }
-        mQueueItems.editItemAt(0) = item;
+        mQueueItems.editItemAt(mQueueItems.size() - 1) = item;
 
         // Wake up any pending callbacks
         mLastFrameNumberReceived = item.mFrameNumber;