Revert "MTP: add a new parameter for cancelEvents function"

Revert "usb: set sys.usb.mtp.batchcancel to true"

Revert "Add sys.usb.mtp.batchcancel to usb_config_prop"

Revert submission 14910151-mtp_cancel-sc-dev

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_sc-dev&target=cf_x86_64_phone-userdebug&lkgb=7458085&lkbb=7458560&fkbb=7458104, bug b/191120942

Reverted Changes:
I44b2d9c36:Add sys.usb.mtp.batchcancel to usb_config_prop
I4e172fa62:MTP: add a new parameter for cancelEvents function...
Iad744e27e:usb: set sys.usb.mtp.batchcancel to true

Change-Id: I9aa47b80ea56671d277d1eda5deede63875e8a0a
diff --git a/media/mtp/MtpFfsHandle.cpp b/media/mtp/MtpFfsHandle.cpp
index 4d50d66..c8b4a03 100644
--- a/media/mtp/MtpFfsHandle.cpp
+++ b/media/mtp/MtpFfsHandle.cpp
@@ -74,7 +74,6 @@
 
 MtpFfsHandle::MtpFfsHandle(int controlFd) {
     mControl.reset(controlFd);
-    mBatchCancel = android::base::GetBoolProperty("sys.usb.mtp.batchcancel", false);
 }
 
 MtpFfsHandle::~MtpFfsHandle() {}
@@ -371,7 +370,7 @@
 }
 
 int MtpFfsHandle::cancelEvents(struct iocb **iocb, struct io_event *events, unsigned start,
-        unsigned end, bool is_batch_cancel) {
+        unsigned end) {
     // Some manpages for io_cancel are out of date and incorrect.
     // io_cancel will return -EINPROGRESS on success and does
     // not place the event in the given memory. We have to use
@@ -387,10 +386,6 @@
         } else {
             num_events++;
         }
-        if (is_batch_cancel && num_events == 1) {
-            num_events = end - start;
-            break;
-        }
     }
     if (num_events != end - start) {
         ret = -1;
@@ -500,8 +495,7 @@
                 num_events += this_events;
 
                 if (event_ret == -1) {
-                    cancelEvents(mIobuf[i].iocb.data(), ioevs, num_events, mIobuf[i].actual,
-                            mBatchCancel);
+                    cancelEvents(mIobuf[i].iocb.data(), ioevs, num_events, mIobuf[i].actual);
                     return -1;
                 }
                 ret += event_ret;
@@ -518,7 +512,7 @@
                 }
             }
             if (short_packet) {
-                if (cancelEvents(mIobuf[i].iocb.data(), ioevs, short_i, mIobuf[i].actual, false)) {
+                if (cancelEvents(mIobuf[i].iocb.data(), ioevs, short_i, mIobuf[i].actual)) {
                     write_error = true;
                 }
             }
@@ -619,7 +613,7 @@
                         &num_events) != ret) {
                 error = true;
                 cancelEvents(mIobuf[(i-1)%NUM_IO_BUFS].iocb.data(), ioevs, num_events,
-                        mIobuf[(i-1)%NUM_IO_BUFS].actual, false);
+                        mIobuf[(i-1)%NUM_IO_BUFS].actual);
             }
             has_write = false;
         }