Merge "Add additional logging to track HAL connection."
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp
index 5813378..1ce88b9 100644
--- a/cmds/atrace/atrace.cpp
+++ b/cmds/atrace/atrace.cpp
@@ -448,8 +448,8 @@
         return false;
     }
 
-    char buf[100];
-    ssize_t n = read(fd, buf, 99);
+    char buf[4097];
+    ssize_t n = read(fd, buf, 4096);
     close(fd);
     if (n == -1) {
         fprintf(stderr, "error reading %s: %s (%d)\n", k_traceClockPath,
@@ -473,38 +473,13 @@
     return strcmp(mode, start) == 0;
 }
 
-// Read the trace_clock sysfs file and return true if it contains the requested
-// value.  The trace_clock file format is:
-// local [global] counter uptime perf
-static bool traceClockContains(const char *mode)
-{
-    int fd = open((g_traceFolder + k_traceClockPath).c_str(), O_RDONLY);
-    if (fd == -1) {
-        fprintf(stderr, "error opening %s: %s (%d)\n", k_traceClockPath,
-            strerror(errno), errno);
-        return false;
-    }
-
-    char buf[100];
-    ssize_t n = read(fd, buf, 99);
-    close(fd);
-    if (n == -1) {
-        fprintf(stderr, "error reading %s: %s (%d)\n", k_traceClockPath,
-            strerror(errno), errno);
-        return false;
-    }
-    buf[n] = '\0';
-
-    return strstr(buf, mode) != NULL;
-}
-
-// Set the clock to the best available option while tracing. Use 'boot' if it's
-// available; otherwise, use 'mono'.
+// Enable or disable the kernel's use of the global clock.  Disabling the global
+// clock will result in the kernel using a per-CPU local clock.
 // Any write to the trace_clock sysfs file will reset the buffer, so only
 // update it if the requested value is not the current value.
-static bool setClock()
+static bool setGlobalClockEnable(bool enable)
 {
-    const char* clock = traceClockContains("boot") ? "boot" : "mono";
+    const char *clock = enable ? "global" : "local";
 
     if (isTraceClock(clock)) {
         return true;
@@ -803,7 +778,7 @@
     ok &= setCategoriesEnableFromFile(g_categoriesFile);
     ok &= setTraceOverwriteEnable(g_traceOverwrite);
     ok &= setTraceBufferSizeKB(g_traceBufferSizeKB);
-    ok &= setClock();
+    ok &= setGlobalClockEnable(true);
     ok &= setPrintTgidEnableIfPresent(true);
     ok &= setKernelTraceFuncs(g_kernelTraceFuncs);
 
@@ -877,6 +852,7 @@
     // Set the options back to their defaults.
     setTraceOverwriteEnable(true);
     setTraceBufferSizeKB(1);
+    setGlobalClockEnable(false);
     setPrintTgidEnableIfPresent(false);
     setKernelTraceFuncs(NULL);
 }
diff --git a/cmds/atrace/atrace.rc b/cmds/atrace/atrace.rc
index cfd2659..cef41be 100644
--- a/cmds/atrace/atrace.rc
+++ b/cmds/atrace/atrace.rc
@@ -124,10 +124,6 @@
     write /sys/kernel/debug/tracing/tracing_on 0
     write /sys/kernel/tracing/tracing_on 0
 
-    # Set the trace clock to boot if it exists, falling back to mono if not.
-    write /d/tracing/trace_clock mono
-    write /d/tracing/trace_clock boot
-
 # Allow only the shell group to read and truncate the kernel trace.
     chown root shell /sys/kernel/debug/tracing/trace
     chown root shell /sys/kernel/tracing/trace
diff --git a/cmds/dumpstate/Android.mk b/cmds/dumpstate/Android.mk
index 669e8d2..a1b6a51 100644
--- a/cmds/dumpstate/Android.mk
+++ b/cmds/dumpstate/Android.mk
@@ -16,8 +16,8 @@
         utils.cpp
 COMMON_SHARED_LIBRARIES := \
         android.hardware.dumpstate@1.0 \
-        android.hidl.manager@1.0 \
         libhidlbase \
+        libhidltransport \
         libbase \
         libbinder \
         libcutils \
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 5dad511..f84d86d 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -998,13 +998,8 @@
     for_each_tid(show_wchan, "BLOCKED PROCESS WAIT-CHANNELS");
     for_each_pid(show_showtime, "PROCESS TIMES (pid cmd user system iowait+percentage)");
 
-    if (true) {
-        // TODO: temporary disabled because /data/misc/bluetooth/logs/btsnoop_hci.log can be huge
-        MYLOGD("Skipping /data/misc/bluetooth/logs");
-    } else {
-        /* Dump Bluetooth HCI logs */
-        ds.AddDir("/data/misc/bluetooth/logs", true);
-    }
+    /* Dump Bluetooth HCI logs */
+    ds.AddDir("/data/misc/bluetooth/logs", true);
 
     if (!ds.do_early_screenshot_) {
         MYLOGI("taking late screenshot\n");
diff --git a/include/gui/BufferItemConsumer.h b/include/gui/BufferItemConsumer.h
index db7e944..217fe6a 100644
--- a/include/gui/BufferItemConsumer.h
+++ b/include/gui/BufferItemConsumer.h
@@ -55,7 +55,7 @@
             uint32_t consumerUsage, int bufferCount = DEFAULT_MAX_BUFFERS,
             bool controlledByApp = false);
 
-    virtual ~BufferItemConsumer();
+    ~BufferItemConsumer() override;
 
     // set the name of the BufferItemConsumer that will be used to identify it in
     // log messages.
diff --git a/include/gui/BufferQueue.h b/include/gui/BufferQueue.h
index bd62d85..ba5cbf7 100644
--- a/include/gui/BufferQueue.h
+++ b/include/gui/BufferQueue.h
@@ -57,7 +57,7 @@
     class ProxyConsumerListener : public BnConsumerListener {
     public:
         explicit ProxyConsumerListener(const wp<ConsumerListener>& consumerListener);
-        virtual ~ProxyConsumerListener();
+        ~ProxyConsumerListener() override;
         void onDisconnect() override;
         void onFrameAvailable(const BufferItem& item) override;
         void onFrameReplaced(const BufferItem& item) override;
diff --git a/include/gui/BufferQueueConsumer.h b/include/gui/BufferQueueConsumer.h
index b383056..f194bdf 100644
--- a/include/gui/BufferQueueConsumer.h
+++ b/include/gui/BufferQueueConsumer.h
@@ -32,7 +32,7 @@
 
 public:
     BufferQueueConsumer(const sp<BufferQueueCore>& core);
-    virtual ~BufferQueueConsumer();
+    ~BufferQueueConsumer() override;
 
     // acquireBuffer attempts to acquire ownership of the next pending buffer in
     // the BufferQueue. If no buffer is pending then it returns
diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h
index 5541468..87bc800 100644
--- a/include/gui/BufferQueueProducer.h
+++ b/include/gui/BufferQueueProducer.h
@@ -30,7 +30,7 @@
     friend class BufferQueue; // Needed to access binderDied
 
     BufferQueueProducer(const sp<BufferQueueCore>& core, bool consumerIsSurfaceFlinger = false);
-    virtual ~BufferQueueProducer();
+    ~BufferQueueProducer() override;
 
     // requestBuffer returns the GraphicBuffer for slot N.
     //
diff --git a/include/gui/ConsumerBase.h b/include/gui/ConsumerBase.h
index 7912528..d1a9b04 100644
--- a/include/gui/ConsumerBase.h
+++ b/include/gui/ConsumerBase.h
@@ -47,7 +47,7 @@
         virtual void onFrameReplaced(const BufferItem& /* item */) {}
     };
 
-    virtual ~ConsumerBase();
+    ~ConsumerBase() override;
 
     // abandon frees all the buffers and puts the ConsumerBase into the
     // 'abandoned' state.  Once put in this state the ConsumerBase can never
diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp
index 74117c8..2f8e637 100644
--- a/libs/gui/IGraphicBufferProducer.cpp
+++ b/libs/gui/IGraphicBufferProducer.cpp
@@ -72,7 +72,7 @@
     {
     }
 
-    virtual ~BpGraphicBufferProducer();
+    ~BpGraphicBufferProducer() override;
 
     virtual status_t requestBuffer(int bufferIdx, sp<GraphicBuffer>* buf) {
         Parcel data, reply;
diff --git a/libs/vr/libbufferhub/buffer_hub_client.cpp b/libs/vr/libbufferhub/buffer_hub_client.cpp
index a1f952e..07c921f 100644
--- a/libs/vr/libbufferhub/buffer_hub_client.cpp
+++ b/libs/vr/libbufferhub/buffer_hub_client.cpp
@@ -216,8 +216,9 @@
            event_fd(), width, height, format, producer_usage, consumer_usage,
            metadata_size, slice_count);
 
+  // (b/37881101) Deprecate producer/consumer usage
   auto status = InvokeRemoteMethod<BufferHubRPC::CreateBuffer>(
-      width, height, format, producer_usage, consumer_usage, metadata_size,
+      width, height, format, (producer_usage | consumer_usage), metadata_size,
       slice_count);
   if (!status) {
     ALOGE(
@@ -257,9 +258,10 @@
            event_fd(), name.c_str(), user_id, group_id, width, height, format,
            producer_usage, consumer_usage, meta_size_bytes, slice_count);
 
+  // (b/37881101) Deprecate producer/consumer usage
   auto status = InvokeRemoteMethod<BufferHubRPC::CreatePersistentBuffer>(
-      name, user_id, group_id, width, height, format, producer_usage,
-      consumer_usage, meta_size_bytes, slice_count);
+      name, user_id, group_id, width, height, format,
+      (producer_usage | consumer_usage), meta_size_bytes, slice_count);
   if (!status) {
     ALOGE(
         "BufferProducer::BufferProducer: Failed to create/get persistent "
@@ -295,8 +297,10 @@
   const int format = HAL_PIXEL_FORMAT_BLOB;
   const size_t meta_size_bytes = 0;
   const size_t slice_count = 1;
+
+  // (b/37881101) Deprecate producer/consumer usage
   auto status = InvokeRemoteMethod<BufferHubRPC::CreateBuffer>(
-      width, height, format, producer_usage, consumer_usage, meta_size_bytes,
+      width, height, format, (producer_usage | consumer_usage), meta_size_bytes,
       slice_count);
   if (!status) {
     ALOGE("BufferProducer::BufferProducer: Failed to create blob: %s",
@@ -333,9 +337,11 @@
   const int format = HAL_PIXEL_FORMAT_BLOB;
   const size_t meta_size_bytes = 0;
   const size_t slice_count = 1;
+
+  // (b/37881101) Deprecate producer/consumer usage
   auto status = InvokeRemoteMethod<BufferHubRPC::CreatePersistentBuffer>(
-      name, user_id, group_id, width, height, format, producer_usage,
-      consumer_usage, meta_size_bytes, slice_count);
+      name, user_id, group_id, width, height, format,
+      (producer_usage | consumer_usage), meta_size_bytes, slice_count);
   if (!status) {
     ALOGE(
         "BufferProducer::BufferProducer: Failed to create persistent "
diff --git a/libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h b/libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h
index 02e9f27..c6f0e1e 100644
--- a/libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h
+++ b/libs/vr/libbufferhub/include/private/dvr/bufferhub_rpc.h
@@ -24,8 +24,7 @@
         width_(buffer.width()),
         height_(buffer.height()),
         format_(buffer.format()),
-        producer_usage_(buffer.usage()),
-        consumer_usage_(buffer.usage()) {
+        usage_(buffer.usage()) {
     // Populate the fd and int vectors: native_handle->data[] is an array of fds
     // followed by an array of opaque ints.
     const int fd_count = buffer.handle()->numFds;
@@ -48,11 +47,9 @@
     for (const auto& fd : fds_)
       fd_ints.push_back(fd.Get());
 
-    // TODO(b/37881101) Get rid of producer/consumer usage.
-    const int ret =
-        buffer->Import(fd_ints.data(), fd_ints.size(), opaque_ints_.data(),
-                       opaque_ints_.size(), width_, height_, stride_, format_,
-                       (producer_usage_ | consumer_usage_));
+    const int ret = buffer->Import(fd_ints.data(), fd_ints.size(),
+                                   opaque_ints_.data(), opaque_ints_.size(),
+                                   width_, height_, stride_, format_, usage_);
     if (ret < 0)
       return ret;
 
@@ -76,20 +73,18 @@
   uint32_t width_;
   uint32_t height_;
   uint32_t format_;
-  uint64_t producer_usage_;
-  uint64_t consumer_usage_;
+  uint64_t usage_;
   std::vector<int> opaque_ints_;
   std::vector<FileHandleType> fds_;
 
   void Clear() {
     id_ = -1;
-    stride_ = width_ = height_ = format_ = producer_usage_ = consumer_usage_ =
-        0;
+    stride_ = width_ = height_ = format_ = usage_ = 0;
   }
 
   PDX_SERIALIZABLE_MEMBERS(NativeBufferHandle<FileHandleType>, id_, stride_,
-                           width_, height_, format_, producer_usage_,
-                           consumer_usage_, opaque_ints_, fds_);
+                           width_, height_, format_, usage_, opaque_ints_,
+                           fds_);
 
   NativeBufferHandle(const NativeBufferHandle&) = delete;
   void operator=(const NativeBufferHandle&) = delete;
@@ -140,20 +135,14 @@
 };
 
 struct UsagePolicy {
-  uint64_t producer_set_mask;
-  uint64_t producer_clear_mask;
-  uint64_t producer_deny_set_mask;
-  uint64_t producer_deny_clear_mask;
-  uint64_t consumer_set_mask;
-  uint64_t consumer_clear_mask;
-  uint64_t consumer_deny_set_mask;
-  uint64_t consumer_deny_clear_mask;
+  uint64_t usage_set_mask;
+  uint64_t usage_clear_mask;
+  uint64_t usage_deny_set_mask;
+  uint64_t usage_deny_clear_mask;
 
  private:
-  PDX_SERIALIZABLE_MEMBERS(UsagePolicy, producer_set_mask, producer_clear_mask,
-                           producer_deny_set_mask, producer_deny_clear_mask,
-                           consumer_set_mask, consumer_clear_mask,
-                           consumer_deny_set_mask, consumer_deny_clear_mask);
+  PDX_SERIALIZABLE_MEMBERS(UsagePolicy, usage_set_mask, usage_clear_mask,
+                           usage_deny_set_mask, usage_deny_clear_mask);
 };
 
 // BufferHub Service RPC interface. Defines the endpoints, op codes, and method
@@ -203,13 +192,13 @@
   // Methods.
   PDX_REMOTE_METHOD(CreateBuffer, kOpCreateBuffer,
                     void(uint32_t width, uint32_t height, uint32_t format,
-                         uint64_t producer_usage, uint64_t consumer_usage,
-                         size_t meta_size_bytes, size_t slice_count));
+                         uint64_t usage, size_t meta_size_bytes,
+                         size_t slice_count));
   PDX_REMOTE_METHOD(CreatePersistentBuffer, kOpCreatePersistentBuffer,
                     void(const std::string& name, int user_id, int group_id,
                          uint32_t width, uint32_t height, uint32_t format,
-                         uint64_t producer_usage, uint64_t consumer_usage,
-                         size_t meta_size_bytes, size_t slice_count));
+                         uint64_t usage, size_t meta_size_bytes,
+                         size_t slice_count));
   PDX_REMOTE_METHOD(GetPersistentBuffer, kOpGetPersistentBuffer,
                     void(const std::string& name));
   PDX_REMOTE_METHOD(GetBuffer, kOpGetBuffer,
@@ -241,8 +230,8 @@
                     kOpProducerQueueAllocateBuffers,
                     std::vector<std::pair<LocalChannelHandle, size_t>>(
                         uint32_t width, uint32_t height, uint32_t format,
-                        uint64_t producer_usage, uint64_t consumer_usage,
-                        size_t slice_count, size_t buffer_count));
+                        uint64_t usage, size_t slice_count,
+                        size_t buffer_count));
   PDX_REMOTE_METHOD(ProducerQueueDetachBuffer, kOpProducerQueueDetachBuffer,
                     void(size_t slot));
   PDX_REMOTE_METHOD(ConsumerQueueImportBuffers, kOpConsumerQueueImportBuffers,
diff --git a/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp b/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
index b431d2f..5b85069 100644
--- a/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
+++ b/libs/vr/libbufferhubqueue/buffer_hub_queue_client.cpp
@@ -317,7 +317,7 @@
 }
 
 ProducerQueue::ProducerQueue(size_t meta_size)
-    : ProducerQueue(meta_size, 0, 0, 0, 0, 0, 0, 0, 0) {}
+    : ProducerQueue(meta_size, 0, 0, 0, 0) {}
 
 ProducerQueue::ProducerQueue(LocalChannelHandle handle)
     : BASE(std::move(handle)) {
@@ -329,22 +329,14 @@
   }
 }
 
-ProducerQueue::ProducerQueue(size_t meta_size, uint64_t producer_usage_set_mask,
-                             uint64_t producer_usage_clear_mask,
-                             uint64_t producer_usage_deny_set_mask,
-                             uint64_t producer_usage_deny_clear_mask,
-                             uint64_t consumer_usage_set_mask,
-                             uint64_t consumer_usage_clear_mask,
-                             uint64_t consumer_usage_deny_set_mask,
-                             uint64_t consumer_usage_deny_clear_mask)
+ProducerQueue::ProducerQueue(size_t meta_size, uint64_t usage_set_mask,
+                             uint64_t usage_clear_mask,
+                             uint64_t usage_deny_set_mask,
+                             uint64_t usage_deny_clear_mask)
     : BASE(BufferHubRPC::kClientPath) {
   auto status = InvokeRemoteMethod<BufferHubRPC::CreateProducerQueue>(
-      meta_size,
-      UsagePolicy{producer_usage_set_mask, producer_usage_clear_mask,
-                  producer_usage_deny_set_mask, producer_usage_deny_clear_mask,
-                  consumer_usage_set_mask, consumer_usage_clear_mask,
-                  consumer_usage_deny_set_mask,
-                  consumer_usage_deny_clear_mask});
+      meta_size, UsagePolicy{usage_set_mask, usage_clear_mask,
+                             usage_deny_set_mask, usage_deny_clear_mask});
   if (!status) {
     ALOGE("ProducerQueue::ProducerQueue: Failed to create producer queue: %s",
           status.GetErrorMessage().c_str());
@@ -356,16 +348,8 @@
 }
 
 int ProducerQueue::AllocateBuffer(uint32_t width, uint32_t height,
-                                  uint32_t format, uint32_t usage,
+                                  uint32_t format, uint64_t usage,
                                   size_t slice_count, size_t* out_slot) {
-  return AllocateBuffer(width, height, format, usage, usage, slice_count,
-                        out_slot);
-}
-
-int ProducerQueue::AllocateBuffer(uint32_t width, uint32_t height,
-                                  uint32_t format, uint64_t producer_usage,
-                                  uint64_t consumer_usage, size_t slice_count,
-                                  size_t* out_slot) {
   if (out_slot == nullptr) {
     ALOGE("ProducerQueue::AllocateBuffer: Parameter out_slot cannot be null.");
     return -EINVAL;
@@ -378,11 +362,9 @@
   }
 
   const size_t kBufferCount = 1U;
-
   Status<std::vector<std::pair<LocalChannelHandle, size_t>>> status =
       InvokeRemoteMethod<BufferHubRPC::ProducerQueueAllocateBuffers>(
-          width, height, format, producer_usage, consumer_usage, slice_count,
-          kBufferCount);
+          width, height, format, usage, slice_count, kBufferCount);
   if (!status) {
     ALOGE(
         "ProducerQueue::AllocateBuffer failed to create producer buffer "
diff --git a/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h b/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h
index 6467c3c..1eafe76 100644
--- a/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h
+++ b/libs/vr/libbufferhubqueue/include/private/dvr/buffer_hub_queue_client.h
@@ -279,22 +279,7 @@
                                                uint32_t usage_deny_set_mask,
                                                uint32_t usage_deny_clear_mask) {
     return BASE::Create(sizeof(Meta), usage_set_mask, usage_clear_mask,
-                        usage_deny_set_mask, usage_deny_clear_mask,
-                        usage_set_mask, usage_clear_mask, usage_deny_set_mask,
-                        usage_deny_clear_mask);
-  }
-  template <typename Meta>
-  static std::unique_ptr<ProducerQueue> Create(
-      uint64_t producer_usage_set_mask, uint64_t producer_usage_clear_mask,
-      uint64_t producer_usage_deny_set_mask,
-      uint64_t producer_usage_deny_clear_mask, uint64_t consumer_usage_set_mask,
-      uint64_t consumer_usage_clear_mask, uint64_t consumer_usage_deny_set_mask,
-      uint64_t consumer_usage_deny_clear_mask) {
-    return BASE::Create(sizeof(Meta), producer_usage_set_mask,
-                        producer_usage_clear_mask, producer_usage_deny_set_mask,
-                        producer_usage_deny_clear_mask, consumer_usage_set_mask,
-                        consumer_usage_clear_mask, consumer_usage_deny_set_mask,
-                        consumer_usage_deny_clear_mask);
+                        usage_deny_set_mask, usage_deny_clear_mask);
   }
 
   // Import a |ProducerQueue| from a channel handle.
@@ -317,10 +302,7 @@
   // Returns Zero on success and negative error code when buffer allocation
   // fails.
   int AllocateBuffer(uint32_t width, uint32_t height, uint32_t format,
-                     uint32_t usage, size_t slice_count, size_t* out_slot);
-  int AllocateBuffer(uint32_t width, uint32_t height, uint32_t format,
-                     uint64_t producer_usage, uint64_t consumer_usage,
-                     size_t slice_count, size_t* out_slot);
+                     uint64_t usage, size_t slice_count, size_t* out_slot);
 
   // Add a producer buffer to populate the queue. Once added, a producer buffer
   // is available to use (i.e. in |Gain|'ed mode).
@@ -345,14 +327,9 @@
   // arguments as the constructors.
   explicit ProducerQueue(size_t meta_size);
   ProducerQueue(LocalChannelHandle handle);
-  ProducerQueue(size_t meta_size, uint64_t producer_usage_set_mask,
-                uint64_t producer_usage_clear_mask,
-                uint64_t producer_usage_deny_set_mask,
-                uint64_t producer_usage_deny_clear_mask,
-                uint64_t consumer_usage_set_mask,
-                uint64_t consumer_usage_clear_mask,
-                uint64_t consumer_usage_deny_set_mask,
-                uint64_t consumer_usage_deny_clear_mask);
+  ProducerQueue(size_t meta_size, uint64_t usage_set_mask,
+                uint64_t usage_clear_mask, uint64_t usage_deny_set_mask,
+                uint64_t usage_deny_clear_mask);
 
   int OnBufferReady(std::shared_ptr<BufferHubBuffer> buf,
                     LocalHandle* release_fence) override;
diff --git a/libs/vr/libdisplay/display_manager_client_impl.cpp b/libs/vr/libdisplay/display_manager_client_impl.cpp
index 44b3c4b..941da23 100644
--- a/libs/vr/libdisplay/display_manager_client_impl.cpp
+++ b/libs/vr/libdisplay/display_manager_client_impl.cpp
@@ -32,10 +32,9 @@
 }
 
 std::unique_ptr<IonBuffer> DisplayManagerClient::SetupNamedBuffer(
-    const std::string& name, size_t size, uint64_t producer_usage,
-    uint64_t consumer_usage) {
+    const std::string& name, size_t size, uint64_t usage) {
   auto status = InvokeRemoteMethod<DisplayManagerRPC::SetupNamedBuffer>(
-      name, size, producer_usage, consumer_usage);
+      name, size, usage);
   if (!status) {
     ALOGE(
         "DisplayManagerClient::SetupNamedBuffer: Failed to create the named "
diff --git a/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h b/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h
index b0a7d13..e09a440 100644
--- a/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h
+++ b/libs/vr/libdisplay/include/private/dvr/display_manager_client_impl.h
@@ -19,8 +19,7 @@
 
   std::unique_ptr<IonBuffer> SetupNamedBuffer(const std::string& name,
                                               size_t size,
-                                              uint64_t producer_usage,
-                                              uint64_t consumer_usage);
+                                              uint64_t usage);
 
   using Client::event_fd;
   using Client::GetChannel;
diff --git a/libs/vr/libdisplay/include/private/dvr/display_rpc.h b/libs/vr/libdisplay/include/private/dvr/display_rpc.h
index 778032f..1fcfe03 100644
--- a/libs/vr/libdisplay/include/private/dvr/display_rpc.h
+++ b/libs/vr/libdisplay/include/private/dvr/display_rpc.h
@@ -272,9 +272,7 @@
       int(const std::map<int, DisplaySurfaceAttributes>& updates));
   PDX_REMOTE_METHOD(SetupNamedBuffer, kOpSetupNamedBuffer,
                     LocalNativeBufferHandle(const std::string& name,
-                                            size_t size,
-                                            uint64_t producer_usage,
-                                            uint64_t consumer_usage));
+                                            size_t size, uint64_t usage));
 };
 
 struct ScreenshotData {
diff --git a/libs/vr/libdvr/display_manager_client.cpp b/libs/vr/libdvr/display_manager_client.cpp
index e469e3e..6830085 100644
--- a/libs/vr/libdvr/display_manager_client.cpp
+++ b/libs/vr/libdvr/display_manager_client.cpp
@@ -62,8 +62,8 @@
   android_convertGralloc0To1Usage((uint32_t)gralloc_usage, &producer_usage,
                                   &consumer_usage);
 
-  auto ion_buffer = client->client->SetupNamedBuffer(name, size, producer_usage,
-                                                     consumer_usage);
+  auto ion_buffer = client->client->SetupNamedBuffer(
+      name, size, (producer_usage | consumer_usage));
   if (ion_buffer) {
     return CreateDvrBufferFromIonBuffer(std::move(ion_buffer));
   }
diff --git a/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp b/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp
index caf20a5..6a02342 100644
--- a/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp
+++ b/libs/vr/libdvr/tests/dvr_named_buffer-test.cpp
@@ -73,7 +73,7 @@
   ASSERT_EQ(0, e3);
 
   AHardwareBuffer* hardware_buffer3 = nullptr;
-  int e4 = dvrBufferGetAHardwareBuffer(buffer2, &hardware_buffer3);
+  int e4 = dvrBufferGetAHardwareBuffer(buffer3, &hardware_buffer3);
   ASSERT_EQ(0, e4);
   ASSERT_NE(nullptr, hardware_buffer3);
 
diff --git a/libs/vr/libvrflinger/display_manager_service.cpp b/libs/vr/libvrflinger/display_manager_service.cpp
index 99f93bf..42ffaec 100644
--- a/libs/vr/libvrflinger/display_manager_service.cpp
+++ b/libs/vr/libvrflinger/display_manager_service.cpp
@@ -193,8 +193,7 @@
 pdx::Status<BorrowedNativeBufferHandle>
 DisplayManagerService::OnSetupNamedBuffer(pdx::Message& message,
                                           const std::string& name, size_t size,
-                                          uint64_t producer_usage,
-                                          uint64_t consumer_usage) {
+                                          uint64_t usage) {
   if (message.GetEffectiveUserId() != AID_ROOT &&
       !IsTrustedUid(message.GetEffectiveUserId())) {
     // Only trusted users can setup named buffers.
@@ -202,8 +201,7 @@
           message.GetEffectiveUserId());
     return {};
   }
-  return display_service_->SetupNamedBuffer(name, size, producer_usage,
-                                            consumer_usage);
+  return display_service_->SetupNamedBuffer(name, size, usage);
 }
 
 void DisplayManagerService::OnDisplaySurfaceChange() {
diff --git a/libs/vr/libvrflinger/display_manager_service.h b/libs/vr/libvrflinger/display_manager_service.h
index 7b037de..b2417e5 100644
--- a/libs/vr/libvrflinger/display_manager_service.h
+++ b/libs/vr/libvrflinger/display_manager_service.h
@@ -56,7 +56,7 @@
 
   pdx::Status<BorrowedNativeBufferHandle> OnSetupNamedBuffer(
       pdx::Message& message, const std::string& name, size_t size,
-      uint64_t producer_usage, uint64_t consumer_usage);
+      uint64_t usage);
 
   // Called by the display service to indicate changes to display surfaces that
   // the display manager should evaluate.
diff --git a/libs/vr/libvrflinger/display_service.cpp b/libs/vr/libvrflinger/display_service.cpp
index 097edce..2dc840e 100644
--- a/libs/vr/libvrflinger/display_service.cpp
+++ b/libs/vr/libvrflinger/display_service.cpp
@@ -327,13 +327,11 @@
 }
 
 pdx::Status<BorrowedNativeBufferHandle> DisplayService::SetupNamedBuffer(
-    const std::string& name, size_t size, int producer_usage,
-    int consumer_usage) {
+    const std::string& name, size_t size, int usage) {
   auto named_buffer = named_buffers_.find(name);
   if (named_buffer == named_buffers_.end()) {
-    auto ion_buffer = std::make_unique<IonBuffer>(
-        static_cast<int>(size), 1, HAL_PIXEL_FORMAT_BLOB,
-        (producer_usage | consumer_usage));
+    auto ion_buffer = std::make_unique<IonBuffer>(static_cast<int>(size), 1,
+                                                  HAL_PIXEL_FORMAT_BLOB, usage);
     named_buffer =
         named_buffers_.insert(std::make_pair(name, std::move(ion_buffer)))
             .first;
diff --git a/libs/vr/libvrflinger/display_service.h b/libs/vr/libvrflinger/display_service.h
index db89064..dd5cac9 100644
--- a/libs/vr/libvrflinger/display_service.h
+++ b/libs/vr/libvrflinger/display_service.h
@@ -40,8 +40,7 @@
   void UpdateActiveDisplaySurfaces();
 
   pdx::Status<BorrowedNativeBufferHandle> SetupNamedBuffer(
-      const std::string& name, size_t size, int producer_usage,
-      int consumer_usage);
+      const std::string& name, size_t size, int usage);
 
   template <class A>
   void ForEachDisplaySurface(A action) const {
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index e186c52..b05b46e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -548,12 +548,15 @@
         mSFEventThread = new EventThread(sfVsyncSrc, *this, true);
         mEventQueue.setEventThread(mSFEventThread);
 
-        // set SFEventThread to SCHED_FIFO to minimize jitter
+        // set EventThread and SFEventThread to SCHED_FIFO to minimize jitter
         struct sched_param param = {0};
         param.sched_priority = 2;
         if (sched_setscheduler(mSFEventThread->getTid(), SCHED_FIFO, &param) != 0) {
             ALOGE("Couldn't set SCHED_FIFO for SFEventThread");
         }
+        if (sched_setscheduler(mEventThread->getTid(), SCHED_FIFO, &param) != 0) {
+            ALOGE("Couldn't set SCHED_FIFO for EventThread");
+        }
 
         // Get a RenderEngine for the given display / config (can't fail)
         mRenderEngine = RenderEngine::create(mEGLDisplay,
diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
index 09d0679..290d31e 100644
--- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
+++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
@@ -520,13 +520,15 @@
     mSFEventThread = new EventThread(sfVsyncSrc, *this, true);
     mEventQueue.setEventThread(mSFEventThread);
 
-    // set SFEventThread to SCHED_FIFO to minimize jitter
+    // set EventThread and SFEventThread to SCHED_FIFO to minimize jitter
     struct sched_param param = {0};
     param.sched_priority = 2;
     if (sched_setscheduler(mSFEventThread->getTid(), SCHED_FIFO, &param) != 0) {
         ALOGE("Couldn't set SCHED_FIFO for SFEventThread");
     }
-
+    if (sched_setscheduler(mEventThread->getTid(), SCHED_FIFO, &param) != 0) {
+        ALOGE("Couldn't set SCHED_FIFO for EventThread");
+    }
 
     // Initialize the H/W composer object.  There may or may not be an
     // actual hardware composer underneath.
diff --git a/services/vr/bufferhubd/buffer_hub.cpp b/services/vr/bufferhubd/buffer_hub.cpp
index 4b1a522..8093b6b 100644
--- a/services/vr/bufferhubd/buffer_hub.cpp
+++ b/services/vr/bufferhubd/buffer_hub.cpp
@@ -53,7 +53,7 @@
   stream << " ";
   stream << std::setw(6) << "Format";
   stream << " ";
-  stream << std::setw(21) << "Usage";
+  stream << std::setw(11) << "Usage";
   stream << " ";
   stream << "Name";
   stream << std::endl;
@@ -80,9 +80,7 @@
       stream << std::setw(6) << info.format;
       stream << " ";
       stream << "0x" << std::hex << std::setfill('0');
-      stream << std::setw(8) << info.producer_usage;
-      stream << "0x";
-      stream << std::setw(8) << info.consumer_usage;
+      stream << std::setw(8) << info.usage;
       stream << std::dec << std::setfill(' ');
       stream << " ";
       stream << info.name;
@@ -140,10 +138,6 @@
   stream << " UsageClearMask";
   stream << " UsageDenySetMask";
   stream << " UsageDenyClearMask";
-  stream << " UsageSetMask";
-  stream << " UsageClearMask";
-  stream << " UsageDenySetMask";
-  stream << " UsageDenyClearMask";
   stream << " ";
   stream << std::endl;
 
@@ -157,28 +151,16 @@
       stream << std::right << std::setw(12) << info.consumer_count;
       stream << std::setw(5) << std::setfill(' ') << "0x";
       stream << std::hex << std::setfill('0');
-      stream << std::setw(8) << info.usage_policy.producer_set_mask;
+      stream << std::setw(8) << info.usage_policy.usage_set_mask;
       stream << std::setw(7) << std::setfill(' ') << "0x";
       stream << std::hex << std::setfill('0');
-      stream << std::setw(8) << info.usage_policy.producer_clear_mask;
+      stream << std::setw(8) << info.usage_policy.usage_clear_mask;
       stream << std::setw(9) << std::setfill(' ') << "0x";
       stream << std::hex << std::setfill('0');
-      stream << std::setw(8) << info.usage_policy.producer_deny_set_mask;
+      stream << std::setw(8) << info.usage_policy.usage_deny_set_mask;
       stream << std::setw(11) << std::setfill(' ') << "0x";
       stream << std::hex << std::setfill('0');
-      stream << std::setw(8) << info.usage_policy.producer_deny_clear_mask;
-      stream << std::setw(5) << std::setfill(' ') << "0x";
-      stream << std::hex << std::setfill('0');
-      stream << std::setw(8) << info.usage_policy.consumer_set_mask;
-      stream << std::setw(7) << std::setfill(' ') << "0x";
-      stream << std::hex << std::setfill('0');
-      stream << std::setw(8) << info.usage_policy.consumer_clear_mask;
-      stream << std::setw(9) << std::setfill(' ') << "0x";
-      stream << std::hex << std::setfill('0');
-      stream << std::setw(8) << info.usage_policy.consumer_deny_set_mask;
-      stream << std::setw(11) << std::setfill(' ') << "0x";
-      stream << std::hex << std::setfill('0');
-      stream << std::setw(8) << info.usage_policy.consumer_deny_clear_mask;
+      stream << std::setw(8) << info.usage_policy.usage_deny_clear_mask;
       stream << std::hex << std::setfill('0');
       stream << std::endl;
     }
@@ -259,18 +241,16 @@
 
 Status<void> BufferHubService::OnCreateBuffer(Message& message, uint32_t width,
                                               uint32_t height, uint32_t format,
-                                              uint64_t producer_usage,
-                                              uint64_t consumer_usage,
+                                              uint64_t usage,
                                               size_t meta_size_bytes,
                                               size_t slice_count) {
   // Use the producer channel id as the global buffer id.
   const int buffer_id = message.GetChannelId();
   ALOGD_IF(TRACE,
            "BufferHubService::OnCreateBuffer: buffer_id=%d width=%u height=%u "
-           "format=%u producer_usage=%" PRIx64 " consumer_usage=%" PRIx64
-           " meta_size_bytes=%zu slice_count=%zu",
-           buffer_id, width, height, format, producer_usage, consumer_usage,
-           meta_size_bytes, slice_count);
+           "format=%u usage=%" PRIx64 " meta_size_bytes=%zu slice_count=%zu",
+           buffer_id, width, height, format, usage, meta_size_bytes,
+           slice_count);
 
   // See if this channel is already attached to a buffer.
   if (const auto channel = message.GetChannel<BufferHubChannel>()) {
@@ -280,8 +260,7 @@
   }
 
   auto status = ProducerChannel::Create(this, buffer_id, width, height, format,
-                                        producer_usage, consumer_usage,
-                                        meta_size_bytes, slice_count);
+                                        usage, meta_size_bytes, slice_count);
   if (status) {
     message.SetChannel(status.take());
     return {};
@@ -294,16 +273,15 @@
 
 Status<void> BufferHubService::OnCreatePersistentBuffer(
     Message& message, const std::string& name, int user_id, int group_id,
-    uint32_t width, uint32_t height, uint32_t format, uint64_t producer_usage,
-    uint64_t consumer_usage, size_t meta_size_bytes, size_t slice_count) {
+    uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
+    size_t meta_size_bytes, size_t slice_count) {
   const int channel_id = message.GetChannelId();
   ALOGD_IF(TRACE,
            "BufferHubService::OnCreatePersistentBuffer: channel_id=%d name=%s "
            "user_id=%d group_id=%d width=%u height=%u format=%u "
-           "producer_usage=%" PRIx64 " consumer_usage=%" PRIx64
-           " meta_size_bytes=%zu slice_count=%zu",
+           "usage=%" PRIx64 " meta_size_bytes=%zu slice_count=%zu",
            channel_id, name.c_str(), user_id, group_id, width, height, format,
-           producer_usage, consumer_usage, meta_size_bytes, slice_count);
+           usage, meta_size_bytes, slice_count);
 
   // See if this channel is already attached to a buffer.
   if (const auto channel = message.GetChannel<BufferHubChannel>()) {
@@ -324,9 +302,8 @@
           "not have permission to access named buffer: name=%s euid=%d egid=%d",
           name.c_str(), euid, euid);
       return ErrorStatus(EPERM);
-    } else if (!buffer->CheckParameters(width, height, format, producer_usage,
-                                        consumer_usage, meta_size_bytes,
-                                        slice_count)) {
+    } else if (!buffer->CheckParameters(width, height, format, usage,
+                                        meta_size_bytes, slice_count)) {
       ALOGE(
           "BufferHubService::OnCreatePersistentBuffer: Requested an existing "
           "buffer with different parameters: name=%s",
@@ -344,9 +321,9 @@
       return {};
     }
   } else {
-    auto status = ProducerChannel::Create(
-        this, channel_id, width, height, format, producer_usage, consumer_usage,
-        meta_size_bytes, slice_count);
+    auto status =
+        ProducerChannel::Create(this, channel_id, width, height, format, usage,
+                                meta_size_bytes, slice_count);
     if (!status) {
       ALOGE("BufferHubService::OnCreateBuffer: Failed to create producer!!");
       return status.error_status();
diff --git a/services/vr/bufferhubd/buffer_hub.h b/services/vr/bufferhubd/buffer_hub.h
index 4cb1eb9..817b01e 100644
--- a/services/vr/bufferhubd/buffer_hub.h
+++ b/services/vr/bufferhubd/buffer_hub.h
@@ -51,18 +51,16 @@
     uint32_t width = 0;
     uint32_t height = 0;
     uint32_t format = 0;
-    uint64_t producer_usage = 0;
-    uint64_t consumer_usage = 0;
+    uint64_t usage = 0;
     size_t slice_count = 0;
     std::string name;
 
     // Data filed for producer queue.
     size_t capacity = 0;
-    UsagePolicy usage_policy{0, 0, 0, 0, 0, 0, 0, 0};
+    UsagePolicy usage_policy{0, 0, 0, 0};
 
     BufferInfo(int id, size_t consumer_count, uint32_t width, uint32_t height,
-               uint32_t format, uint64_t producer_usage,
-               uint64_t consumer_usage, size_t slice_count,
+               uint32_t format, uint64_t usage, size_t slice_count,
                const std::string& name)
         : id(id),
           type(kProducerType),
@@ -70,8 +68,7 @@
           width(width),
           height(height),
           format(format),
-          producer_usage(producer_usage),
-          consumer_usage(consumer_usage),
+          usage(usage),
           slice_count(slice_count),
           name(name) {}
 
@@ -159,16 +156,16 @@
   std::unordered_map<std::string, std::shared_ptr<ProducerChannel>>
       named_buffers_;
 
-  pdx::Status<void> OnCreateBuffer(pdx::Message& message, uint32_t width, uint32_t height,
-                     uint32_t format, uint64_t producer_usage,
-                     uint64_t consumer_usage, size_t meta_size_bytes,
-                     size_t slice_count);
-  pdx::Status<void> OnCreatePersistentBuffer(pdx::Message& message, const std::string& name,
-                               int user_id, int group_id, uint32_t width,
-                               uint32_t height, uint32_t format,
-                               uint64_t producer_usage, uint64_t consumer_usage,
-                               size_t meta_size_bytes, size_t slice_count);
-  pdx::Status<void> OnGetPersistentBuffer(pdx::Message& message, const std::string& name);
+  pdx::Status<void> OnCreateBuffer(pdx::Message& message, uint32_t width,
+                                   uint32_t height, uint32_t format,
+                                   uint64_t usage, size_t meta_size_bytes,
+                                   size_t slice_count);
+  pdx::Status<void> OnCreatePersistentBuffer(
+      pdx::Message& message, const std::string& name, int user_id, int group_id,
+      uint32_t width, uint32_t height, uint32_t format, uint64_t usage,
+      size_t meta_size_bytes, size_t slice_count);
+  pdx::Status<void> OnGetPersistentBuffer(pdx::Message& message,
+                                          const std::string& name);
   pdx::Status<QueueInfo> OnCreateProducerQueue(pdx::Message& message,
                                                size_t meta_size_bytes,
                                                const UsagePolicy& usage_policy);
diff --git a/services/vr/bufferhubd/producer_channel.cpp b/services/vr/bufferhubd/producer_channel.cpp
index c4b1319..e452d04 100644
--- a/services/vr/bufferhubd/producer_channel.cpp
+++ b/services/vr/bufferhubd/producer_channel.cpp
@@ -26,8 +26,7 @@
 
 ProducerChannel::ProducerChannel(BufferHubService* service, int channel_id,
                                  uint32_t width, uint32_t height,
-                                 uint32_t format, uint64_t producer_usage,
-                                 uint64_t consumer_usage,
+                                 uint32_t format, uint64_t usage,
                                  size_t meta_size_bytes, size_t slice_count,
                                  int* error)
     : BufferHubChannel(service, channel_id, channel_id, kProducerType),
@@ -37,8 +36,7 @@
       meta_size_bytes_(meta_size_bytes),
       meta_(meta_size_bytes ? new uint8_t[meta_size_bytes] : nullptr) {
   for (auto& ion_buffer : slices_) {
-    const int ret = ion_buffer.Alloc(width, height, format,
-                                     (producer_usage | consumer_usage));
+    const int ret = ion_buffer.Alloc(width, height, format, usage);
     if (ret < 0) {
       ALOGE("ProducerChannel::ProducerChannel: Failed to allocate buffer: %s",
             strerror(-ret));
@@ -53,12 +51,12 @@
 
 Status<std::shared_ptr<ProducerChannel>> ProducerChannel::Create(
     BufferHubService* service, int channel_id, uint32_t width, uint32_t height,
-    uint32_t format, uint64_t producer_usage, uint64_t consumer_usage,
-    size_t meta_size_bytes, size_t slice_count) {
+    uint32_t format, uint64_t usage, size_t meta_size_bytes,
+    size_t slice_count) {
   int error;
-  std::shared_ptr<ProducerChannel> producer(new ProducerChannel(
-      service, channel_id, width, height, format, producer_usage,
-      consumer_usage, meta_size_bytes, slice_count, &error));
+  std::shared_ptr<ProducerChannel> producer(
+      new ProducerChannel(service, channel_id, width, height, format, usage,
+                          meta_size_bytes, slice_count, &error));
   if (error < 0)
     return ErrorStatus(-error);
   else
@@ -76,8 +74,7 @@
 BufferHubChannel::BufferInfo ProducerChannel::GetBufferInfo() const {
   return BufferInfo(buffer_id(), consumer_channels_.size(), slices_[0].width(),
                     slices_[0].height(), slices_[0].format(),
-                    slices_[0].usage(), slices_[0].usage(),
-                    slices_.size(), name_);
+                    slices_[0].usage(), slices_.size(), name_);
 }
 
 void ProducerChannel::HandleImpulse(Message& message) {
@@ -369,14 +366,12 @@
 
 // Returns true if the given parameters match the underlying buffer parameters.
 bool ProducerChannel::CheckParameters(uint32_t width, uint32_t height,
-                                      uint32_t format, uint64_t producer_usage,
-                                      uint64_t consumer_usage,
+                                      uint32_t format, uint64_t usage,
                                       size_t meta_size_bytes,
                                       size_t slice_count) {
   return slices_.size() == slice_count && meta_size_bytes == meta_size_bytes_ &&
          slices_[0].width() == width && slices_[0].height() == height &&
-         slices_[0].format() == format &&
-         slices_[0].usage() == (producer_usage | consumer_usage);
+         slices_[0].format() == format && slices_[0].usage() == usage;
 }
 
 }  // namespace dvr
diff --git a/services/vr/bufferhubd/producer_channel.h b/services/vr/bufferhubd/producer_channel.h
index f04c8a5..6de619d 100644
--- a/services/vr/bufferhubd/producer_channel.h
+++ b/services/vr/bufferhubd/producer_channel.h
@@ -32,8 +32,8 @@
 
   static pdx::Status<std::shared_ptr<ProducerChannel>> Create(
       BufferHubService* service, int channel_id, uint32_t width,
-      uint32_t height, uint32_t format, uint64_t producer_usage,
-      uint64_t consumer_usage, size_t meta_size_bytes, size_t slice_count);
+      uint32_t height, uint32_t format, uint64_t usage, size_t meta_size_bytes,
+      size_t slice_count);
 
   ~ProducerChannel() override;
 
@@ -62,8 +62,8 @@
 
   bool CheckAccess(int euid, int egid);
   bool CheckParameters(uint32_t width, uint32_t height, uint32_t format,
-                       uint64_t producer_usage, uint64_t consumer_usage,
-                       size_t meta_size_bytes, size_t slice_count);
+                       uint64_t usage, size_t meta_size_bytes,
+                       size_t slice_count);
 
   pdx::Status<void> OnProducerMakePersistent(Message& message,
                                              const std::string& name,
@@ -95,9 +95,8 @@
   std::string name_;
 
   ProducerChannel(BufferHubService* service, int channel, uint32_t width,
-                  uint32_t height, uint32_t format, uint64_t producer_usage,
-                  uint64_t consumer_usage, size_t meta_size_bytes,
-                  size_t slice_count, int* error);
+                  uint32_t height, uint32_t format, uint64_t usage,
+                  size_t meta_size_bytes, size_t slice_count, int* error);
 
   pdx::Status<void> OnProducerPost(
       Message& message, LocalFence acquire_fence,
diff --git a/services/vr/bufferhubd/producer_queue_channel.cpp b/services/vr/bufferhubd/producer_queue_channel.cpp
index dc2a47e..bd8eed8 100644
--- a/services/vr/bufferhubd/producer_queue_channel.cpp
+++ b/services/vr/bufferhubd/producer_queue_channel.cpp
@@ -34,19 +34,14 @@
     const UsagePolicy& usage_policy) {
   // Configuration between |usage_deny_set_mask| and |usage_deny_clear_mask|
   // should be mutually exclusive.
-  if ((usage_policy.producer_deny_set_mask &
-       usage_policy.producer_deny_clear_mask) ||
-      (usage_policy.consumer_deny_set_mask &
-       usage_policy.consumer_deny_clear_mask)) {
+  if ((usage_policy.usage_deny_set_mask &
+       usage_policy.usage_deny_clear_mask)) {
     ALOGE(
         "BufferHubService::OnCreateProducerQueue: illegal usage mask "
-        "configuration: producer_deny_set_mask=%" PRIx64
-        " producer_deny_clear_mask=%" PRIx64 " consumer_deny_set_mask=%" PRIx64
-        " consumer_deny_clear_mask=%" PRIx64,
-        usage_policy.producer_deny_set_mask,
-        usage_policy.producer_deny_clear_mask,
-        usage_policy.consumer_deny_set_mask,
-        usage_policy.consumer_deny_clear_mask);
+        "configuration: usage_deny_set_mask=%" PRIx64
+        " usage_deny_clear_mask=%" PRIx64,
+        usage_policy.usage_deny_set_mask,
+        usage_policy.usage_deny_clear_mask);
     return ErrorStatus(EINVAL);
   }
 
@@ -134,8 +129,7 @@
 Status<std::vector<std::pair<RemoteChannelHandle, size_t>>>
 ProducerQueueChannel::OnProducerQueueAllocateBuffers(
     Message& message, uint32_t width, uint32_t height, uint32_t format,
-    uint64_t producer_usage, uint64_t consumer_usage, size_t slice_count,
-    size_t buffer_count) {
+    uint64_t usage, size_t slice_count, size_t buffer_count) {
   ATRACE_NAME("ProducerQueueChannel::OnProducerQueueAllocateBuffers");
   ALOGD_IF(TRACE,
            "ProducerQueueChannel::OnProducerQueueAllocateBuffers: "
@@ -145,58 +139,32 @@
   std::vector<std::pair<RemoteChannelHandle, size_t>> buffer_handles;
 
   // Deny buffer allocation violating preset rules.
-  if (producer_usage & usage_policy_.producer_deny_set_mask) {
+  if (usage & usage_policy_.usage_deny_set_mask) {
     ALOGE(
-        "ProducerQueueChannel::OnProducerQueueAllocateBuffers: producer_usage: "
-        "%" PRIx64
-        " is not permitted. Violating producer_deny_set_mask, the following "
-        "bits shall not be set: %" PRIx64 ".",
-        producer_usage, usage_policy_.producer_deny_set_mask);
+        "ProducerQueueChannel::OnProducerQueueAllocateBuffers: usage: %" PRIx64
+        " is not permitted. Violating usage_deny_set_mask, the following  bits "
+        "shall not be set: %" PRIx64 ".",
+        usage, usage_policy_.usage_deny_set_mask);
     return ErrorStatus(EINVAL);
   }
 
-  if (consumer_usage & usage_policy_.consumer_deny_set_mask) {
+  if (~usage & usage_policy_.usage_deny_clear_mask) {
     ALOGE(
-        "ProducerQueueChannel::OnProducerQueueAllocateBuffers: consumer_usage: "
-        "%" PRIx64
-        " is not permitted. Violating consumer_deny_set_mask, the following "
-        "bits shall not be set: %" PRIx64 ".",
-        consumer_usage, usage_policy_.consumer_deny_set_mask);
-    return ErrorStatus(EINVAL);
-  }
-
-  if (~producer_usage & usage_policy_.producer_deny_clear_mask) {
-    ALOGE(
-        "ProducerQueueChannel::OnProducerQueueAllocateBuffers: producer_usage: "
-        "%" PRIx64
-        " is not permitted. Violating producer_deny_clear_mask, the following "
+        "ProducerQueueChannel::OnProducerQueueAllocateBuffers: usage: %" PRIx64
+        " is not permitted. Violating usage_deny_clear_mask, the following "
         "bits must be set: %" PRIx64 ".",
-        producer_usage, usage_policy_.producer_deny_clear_mask);
+        usage, usage_policy_.usage_deny_clear_mask);
     return ErrorStatus(EINVAL);
   }
 
-  if (~consumer_usage & usage_policy_.consumer_deny_clear_mask) {
-    ALOGE(
-        "ProducerQueueChannel::OnProducerQueueAllocateBuffers: consumer_usage: "
-        "%" PRIx64
-        " is not permitted. Violating consumer_deny_clear_mask, the following "
-        "bits must be set: %" PRIx64 ".",
-        consumer_usage, usage_policy_.consumer_deny_clear_mask);
-    return ErrorStatus(EINVAL);
-  }
-  // Force set mask and clear mask. Note that |usage_policy_.X_set_mask_| takes
-  // precedence and will overwrite |usage_policy_.X_clear_mask|.
-  uint64_t effective_producer_usage =
-      (producer_usage & ~usage_policy_.producer_clear_mask) |
-      usage_policy_.producer_set_mask;
-  uint64_t effective_consumer_usage =
-      (consumer_usage & ~usage_policy_.consumer_clear_mask) |
-      usage_policy_.consumer_set_mask;
+  // Force set mask and clear mask. Note that |usage_policy_.usage_set_mask_|
+  // takes precedence and will overwrite |usage_policy_.usage_clear_mask|.
+  uint64_t effective_usage =
+      (usage & ~usage_policy_.usage_clear_mask) | usage_policy_.usage_set_mask;
 
   for (size_t i = 0; i < buffer_count; i++) {
-    auto status =
-        AllocateBuffer(message, width, height, format, effective_producer_usage,
-                       effective_consumer_usage, slice_count);
+    auto status = AllocateBuffer(message, width, height, format,
+                                 effective_usage, slice_count);
     if (!status) {
       ALOGE(
           "ProducerQueueChannel::OnProducerQueueAllocateBuffers: Failed to "
@@ -212,9 +180,7 @@
 Status<std::pair<RemoteChannelHandle, size_t>>
 ProducerQueueChannel::AllocateBuffer(Message& message, uint32_t width,
                                      uint32_t height, uint32_t format,
-                                     uint64_t producer_usage,
-                                     uint64_t consumer_usage,
-                                     size_t slice_count) {
+                                     uint64_t usage, size_t slice_count) {
   ATRACE_NAME("ProducerQueueChannel::AllocateBuffer");
   ALOGD_IF(TRACE,
            "ProducerQueueChannel::AllocateBuffer: producer_channel_id=%d",
@@ -239,15 +205,13 @@
 
   ALOGD_IF(TRACE,
            "ProducerQueueChannel::AllocateBuffer: buffer_id=%d width=%u "
-           "height=%u format=%u producer_usage=%" PRIx64
-           " consumer_usage=%" PRIx64 " slice_count=%zu",
-           buffer_id, width, height, format, producer_usage, consumer_usage,
-           slice_count);
+           "height=%u format=%u usage=%" PRIx64 " slice_count=%zu",
+           buffer_id, width, height, format, usage, slice_count);
   auto buffer_handle = status.take();
 
-  auto producer_channel_status = ProducerChannel::Create(
-      service(), buffer_id, width, height, format, producer_usage,
-      consumer_usage, meta_size_bytes_, slice_count);
+  auto producer_channel_status =
+      ProducerChannel::Create(service(), buffer_id, width, height, format,
+                              usage, meta_size_bytes_, slice_count);
   if (!producer_channel_status) {
     ALOGE(
         "ProducerQueueChannel::AllocateBuffer: Failed to create producer "
diff --git a/services/vr/bufferhubd/producer_queue_channel.h b/services/vr/bufferhubd/producer_queue_channel.h
index 09b0243..13c9ddc 100644
--- a/services/vr/bufferhubd/producer_queue_channel.h
+++ b/services/vr/bufferhubd/producer_queue_channel.h
@@ -35,8 +35,7 @@
   pdx::Status<std::vector<std::pair<pdx::RemoteChannelHandle, size_t>>>
   OnProducerQueueAllocateBuffers(pdx::Message& message, uint32_t width,
                                  uint32_t height, uint32_t format,
-                                 uint64_t producer_usage,
-                                 uint64_t consumer_usage, size_t slice_count,
+                                 uint64_t usage, size_t slice_count,
                                  size_t buffer_count);
 
   // Detach a BufferHubProducer indicated by |slot|. Note that the buffer must
@@ -59,7 +58,7 @@
   // allocated buffer.
   pdx::Status<std::pair<pdx::RemoteChannelHandle, size_t>> AllocateBuffer(
       pdx::Message& message, uint32_t width, uint32_t height, uint32_t format,
-      uint64_t producer_usage, uint64_t consumer_usage, size_t slice_count);
+      uint64_t usage, size_t slice_count);
 
   // Size of the meta data associated with all the buffers allocated from the
   // queue. Now we assume the metadata size is immutable once the queue is