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;
         }
diff --git a/media/mtp/MtpFfsHandle.h b/media/mtp/MtpFfsHandle.h
index e552e03..fe343f7 100644
--- a/media/mtp/MtpFfsHandle.h
+++ b/media/mtp/MtpFfsHandle.h
@@ -17,7 +17,6 @@
 #ifndef _MTP_FFS_HANDLE_H
 #define _MTP_FFS_HANDLE_H
 
-#include <android-base/properties.h>
 #include <android-base/unique_fd.h>
 #include <linux/aio_abi.h>
 #include <mutex>
@@ -58,7 +57,6 @@
     static int getPacketSize(int ffs_fd);
 
     bool mCanceled;
-    bool mBatchCancel;
 
     android::base::unique_fd mControl;
     // "in" from the host's perspective => sink for mtp server
@@ -78,8 +76,7 @@
     int iobufSubmit(struct io_buffer *buf, int fd, unsigned length, bool read);
 
     // Cancel submitted requests from start to end in the given array. Return 0 or -1.
-    int cancelEvents(struct iocb **iocb, struct io_event *events, unsigned start, unsigned end,
-		     bool is_batch_cancel);
+    int cancelEvents(struct iocb **iocb, struct io_event *events, unsigned start, unsigned end);
 
     // Wait for at minimum the given number of events. Returns the amount of data in the returned
     // events. Increments counter by the number of events returned.