SensorService performance improvements.

  i) Send ack for wake_up sensors on the socket connection instead of using Binder RPC.
  ii) Cache events per connection in case there are write failures. Compute cache size
      from FIFO counts of sensors.
 iii) Send FlushCompleteEvent only for apps that explicitly called flush().

Change-Id: I018969736b7794b1b930529586f2294a03ee8667
diff --git a/libs/gui/ISensorEventConnection.cpp b/libs/gui/ISensorEventConnection.cpp
index 8f88141..28fcb53 100644
--- a/libs/gui/ISensorEventConnection.cpp
+++ b/libs/gui/ISensorEventConnection.cpp
@@ -34,8 +34,7 @@
     GET_SENSOR_CHANNEL = IBinder::FIRST_CALL_TRANSACTION,
     ENABLE_DISABLE,
     SET_EVENT_RATE,
-    FLUSH_SENSOR,
-    DECREASE_WAKE_LOCK_REFCOUNT
+    FLUSH_SENSOR
 };
 
 class BpSensorEventConnection : public BpInterface<ISensorEventConnection>
@@ -84,13 +83,6 @@
         remote()->transact(FLUSH_SENSOR, data, &reply);
         return reply.readInt32();
     }
-
-    virtual void decreaseWakeLockRefCount() {
-        Parcel data, reply;
-        data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor());
-        remote()->transact(DECREASE_WAKE_LOCK_REFCOUNT, data, &reply, IBinder::FLAG_ONEWAY);
-        return;
-    }
 };
 
 IMPLEMENT_META_INTERFACE(SensorEventConnection, "android.gui.SensorEventConnection");
@@ -133,11 +125,6 @@
             reply->writeInt32(result);
             return NO_ERROR;
         } break;
-        case DECREASE_WAKE_LOCK_REFCOUNT: {
-            CHECK_INTERFACE(ISensorEventConnection, data, reply);
-            decreaseWakeLockRefCount();
-            return NO_ERROR;
-        } break;
     }
     return BBinder::onTransact(code, data, reply, flags);
 }