Merge "Rename dump methods to dumpState"
diff --git a/include/binder/IBinder.h b/include/binder/IBinder.h
index b249289..2e62957 100644
--- a/include/binder/IBinder.h
+++ b/include/binder/IBinder.h
@@ -91,12 +91,24 @@
                                         Parcel* reply,
                                         uint32_t flags = 0) = 0;
 
+    // DeathRecipient is pure abstract, there is no virtual method
+    // implementation to put in a translation unit in order to silence the
+    // weak vtables warning.
+    #if defined(__clang__)
+    #pragma clang diagnostic push
+    #pragma clang diagnostic ignored "-Wweak-vtables"
+    #endif
+
     class DeathRecipient : public virtual RefBase
     {
     public:
         virtual void binderDied(const wp<IBinder>& who) = 0;
     };
 
+    #if defined(__clang__)
+    #pragma clang diagnostic pop
+    #endif
+
     /**
      * Register the @a recipient for a notification if this binder
      * goes away.  If this binder object unexpectedly goes away
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index bba3f36..954b976 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -474,6 +474,11 @@
         bool mMutable;
     };
 
+    #if defined(__clang__)
+    #pragma clang diagnostic push
+    #pragma clang diagnostic ignored "-Wweak-vtables"
+    #endif
+
     class FlattenableHelperInterface {
     protected:
         ~FlattenableHelperInterface() { }
@@ -484,12 +489,18 @@
         virtual status_t unflatten(void const* buffer, size_t size, int const* fds, size_t count) = 0;
     };
 
+    #if defined(__clang__)
+    #pragma clang diagnostic pop
+    #endif
+
     template<typename T>
     class FlattenableHelper : public FlattenableHelperInterface {
         friend class Parcel;
         const Flattenable<T>& val;
         explicit FlattenableHelper(const Flattenable<T>& _val) : val(_val) { }
 
+    protected:
+        ~FlattenableHelper() = default;
     public:
         virtual size_t getFlattenedSize() const {
             return val.getFlattenedSize();
@@ -542,7 +553,10 @@
 status_t Parcel::write(const LightFlattenable<T>& val) {
     size_t size(val.getFlattenedSize());
     if (!val.isFixedSize()) {
-        status_t err = writeInt32(size);
+        if (size > INT32_MAX) {
+            return BAD_VALUE;
+        }
+        status_t err = writeInt32(static_cast<int32_t>(size));
         if (err != NO_ERROR) {
             return err;
         }
@@ -573,7 +587,7 @@
         if (err != NO_ERROR) {
             return err;
         }
-        size = s;
+        size = static_cast<size_t>(s);
     }
     if (size) {
         void const* buffer = readInplace(size);
@@ -588,7 +602,7 @@
     if (val.size() > INT32_MAX) {
         return BAD_VALUE;
     }
-    return writeInt32(val.size());
+    return writeInt32(static_cast<int32_t>(val.size()));
 }
 
 template<typename T>
@@ -678,7 +692,7 @@
         return UNEXPECTED_NULL;
     }
 
-    val->resize(size);
+    val->resize(static_cast<size_t>(size));
 
     for (auto& v: *val) {
         status = (this->*read_func)(&v);
@@ -700,7 +714,7 @@
 template<typename T>
 status_t Parcel::readNullableTypedVector(std::unique_ptr<std::vector<T>>* val,
                                          status_t(Parcel::*read_func)(T*) const) const {
-    const int32_t start = dataPosition();
+    const size_t start = dataPosition();
     int32_t size;
     status_t status = readInt32(&size);
     val->reset();
@@ -728,7 +742,7 @@
         return BAD_VALUE;
     }
 
-    status_t status = this->writeInt32(val.size());
+    status_t status = this->writeInt32(static_cast<int32_t>(val.size()));
 
     if (status != OK) {
         return status;
@@ -784,7 +798,7 @@
 
 template<typename T>
 status_t Parcel::readParcelableVector(std::unique_ptr<std::vector<std::unique_ptr<T>>>* val) const {
-    const int32_t start = dataPosition();
+    const size_t start = dataPosition();
     int32_t size;
     status_t status = readInt32(&size);
     val->reset();
@@ -807,7 +821,7 @@
 
 template<typename T>
 status_t Parcel::readParcelable(std::unique_ptr<T>* parcelable) const {
-    const int32_t start = dataPosition();
+    const size_t start = dataPosition();
     int32_t present;
     status_t status = readInt32(&present);
     parcelable->reset();
diff --git a/include/binder/Parcelable.h b/include/binder/Parcelable.h
index faf0d34..d5b57ac 100644
--- a/include/binder/Parcelable.h
+++ b/include/binder/Parcelable.h
@@ -26,6 +26,11 @@
 
 class Parcel;
 
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wweak-vtables"
+#endif
+
 // Abstract interface of all parcelables.
 class Parcelable {
 public:
@@ -46,6 +51,10 @@
     virtual status_t readFromParcel(const Parcel* parcel) = 0;
 };  // class Parcelable
 
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+
 }  // namespace android
 
 #endif // ANDROID_PARCELABLE_H
diff --git a/include/gui/BufferItem.h b/include/gui/BufferItem.h
index f45d852..3ab63d0 100644
--- a/include/gui/BufferItem.h
+++ b/include/gui/BufferItem.h
@@ -46,6 +46,8 @@
     enum { INVALID_BUFFER_SLOT = -1 };
     BufferItem();
     ~BufferItem();
+    BufferItem(const BufferItem&) = default;
+    BufferItem& operator=(const BufferItem&) = default;
 
     static const char* scalingModeName(uint32_t scalingMode);
 
diff --git a/include/gui/DisplayEventReceiver.h b/include/gui/DisplayEventReceiver.h
index a4718b9..cb9b373 100644
--- a/include/gui/DisplayEventReceiver.h
+++ b/include/gui/DisplayEventReceiver.h
@@ -35,13 +35,19 @@
 class BitTube;
 class IDisplayEventConnection;
 
-// ----------------------------------------------------------------------------
+static inline constexpr uint32_t fourcc(char c1, char c2, char c3, char c4) {
+    return static_cast<uint32_t>(c1) << 24 |
+        static_cast<uint32_t>(c2) << 16 |
+        static_cast<uint32_t>(c3) << 8 |
+        static_cast<uint32_t>(c4);
+}
 
+// ----------------------------------------------------------------------------
 class DisplayEventReceiver {
 public:
     enum {
-        DISPLAY_EVENT_VSYNC = 'vsyn',
-        DISPLAY_EVENT_HOTPLUG = 'plug'
+        DISPLAY_EVENT_VSYNC = fourcc('v', 's', 'y', 'n'),
+        DISPLAY_EVENT_HOTPLUG = fourcc('p', 'l', 'u', 'g'),
     };
 
     struct Event {
diff --git a/include/gui/IConsumerListener.h b/include/gui/IConsumerListener.h
index 03f988c..0ab7590 100644
--- a/include/gui/IConsumerListener.h
+++ b/include/gui/IConsumerListener.h
@@ -41,7 +41,7 @@
 class ConsumerListener : public virtual RefBase {
 public:
     ConsumerListener() { }
-    virtual ~ConsumerListener() { }
+    virtual ~ConsumerListener();
 
     // onFrameAvailable is called from queueBuffer each time an additional
     // frame becomes available for consumption. This means that frames that
diff --git a/include/gui/IProducerListener.h b/include/gui/IProducerListener.h
index 3848a6c..4a5ed46 100644
--- a/include/gui/IProducerListener.h
+++ b/include/gui/IProducerListener.h
@@ -33,7 +33,7 @@
 {
 public:
     ProducerListener() {}
-    virtual ~ProducerListener() {}
+    virtual ~ProducerListener();
 
     // onBufferReleased is called from IGraphicBufferConsumer::releaseBuffer to
     // notify the producer that a new buffer is free and ready to be dequeued.
@@ -59,6 +59,7 @@
 class DummyProducerListener : public BnProducerListener
 {
 public:
+    virtual ~DummyProducerListener();
     virtual void onBufferReleased() {}
 };
 
diff --git a/include/gui/Sensor.h b/include/gui/Sensor.h
index 094fd16..7506835 100644
--- a/include/gui/Sensor.h
+++ b/include/gui/Sensor.h
@@ -61,6 +61,9 @@
         uuid_t() : b{0} {}
     };
 
+    Sensor(const Sensor&) = default;
+    Sensor& operator=(const Sensor&) = default;
+
     Sensor(const char * name = "");
     Sensor(struct sensor_t const* hwSensor, int halVersion = 0);
     Sensor(struct sensor_t const& hwSensor, const uuid_t& uuid, int halVersion = 0);
diff --git a/libs/gui/IConsumerListener.cpp b/libs/gui/IConsumerListener.cpp
index 3175b91..ff7b83a 100644
--- a/libs/gui/IConsumerListener.cpp
+++ b/libs/gui/IConsumerListener.cpp
@@ -153,6 +153,7 @@
     return BBinder::onTransact(code, data, reply, flags);
 }
 
+ConsumerListener::~ConsumerListener() = default;
 
 // ---------------------------------------------------------------------------
 }; // namespace android
diff --git a/libs/gui/IProducerListener.cpp b/libs/gui/IProducerListener.cpp
index 9d18ea2..855a488 100644
--- a/libs/gui/IProducerListener.cpp
+++ b/libs/gui/IProducerListener.cpp
@@ -56,4 +56,8 @@
     return BBinder::onTransact(code, data, reply, flags);
 }
 
+ProducerListener::~ProducerListener() = default;
+
+DummyProducerListener::~DummyProducerListener() = default;
+
 } // namespace android