Remove references to libchrome

Removed dependencies on libchrome which was used mostly for logging
and switched over to standard Android log macros.

Bug: None
Test: `m -j32` still succeeds
Change-Id: I0a841c19c15c02f9a031af200e82837f9450d88a
diff --git a/libs/vr/libdisplay/Android.mk b/libs/vr/libdisplay/Android.mk
index 670bdcd..f0e62df 100644
--- a/libs/vr/libdisplay/Android.mk
+++ b/libs/vr/libdisplay/Android.mk
@@ -49,7 +49,6 @@
 	libsync
 
 staticLibraries := \
-	libchrome \
 	libbufferhub \
 	libbufferhubqueue \
 	libdvrcommon \
diff --git a/libs/vr/libdisplay/display_client.cpp b/libs/vr/libdisplay/display_client.cpp
index cfb346d..54098e8 100644
--- a/libs/vr/libdisplay/display_client.cpp
+++ b/libs/vr/libdisplay/display_client.cpp
@@ -1,7 +1,7 @@
 #include "include/private/dvr/display_client.h"
 
-#include <cutils/log.h>
 #include <cutils/native_handle.h>
+#include <log/log.h>
 #include <pdx/default_transport/client_channel.h>
 #include <pdx/default_transport/client_channel_factory.h>
 #include <pdx/status.h>
diff --git a/libs/vr/libdisplay/frame_history.cpp b/libs/vr/libdisplay/frame_history.cpp
index 67e4a09..154afbe 100644
--- a/libs/vr/libdisplay/frame_history.cpp
+++ b/libs/vr/libdisplay/frame_history.cpp
@@ -1,7 +1,7 @@
 #include <private/dvr/frame_history.h>
 
-#include <cutils/log.h>
 #include <errno.h>
+#include <log/log.h>
 #include <sync/sync.h>
 
 #include <pdx/file_handle.h>
diff --git a/libs/vr/libdisplay/gl_fenced_flush.cpp b/libs/vr/libdisplay/gl_fenced_flush.cpp
index 64b2e99..c70d554 100644
--- a/libs/vr/libdisplay/gl_fenced_flush.cpp
+++ b/libs/vr/libdisplay/gl_fenced_flush.cpp
@@ -6,7 +6,7 @@
 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
 #include <utils/Trace.h>
 
-#include <base/logging.h>
+#include <log/log.h>
 
 using android::pdx::LocalHandle;
 
@@ -22,14 +22,14 @@
       eglCreateSyncKHR(display, EGL_SYNC_NATIVE_FENCE_ANDROID, attribs);
   glFlush();
   if (sync_point == EGL_NO_SYNC_KHR) {
-    LOG(ERROR) << "sync_point == EGL_NO_SYNC_KHR";
+    ALOGE("sync_point == EGL_NO_SYNC_KHR");
     return LocalHandle();
   }
   EGLint fence_fd = eglDupNativeFenceFDANDROID(display, sync_point);
   eglDestroySyncKHR(display, sync_point);
 
   if (fence_fd == EGL_NO_NATIVE_FENCE_FD_ANDROID) {
-    LOG(ERROR) << "fence_fd == EGL_NO_NATIVE_FENCE_FD_ANDROID";
+    ALOGE("fence_fd == EGL_NO_NATIVE_FENCE_FD_ANDROID");
     return LocalHandle();
   }
   return LocalHandle(fence_fd);
diff --git a/libs/vr/libdisplay/graphics.cpp b/libs/vr/libdisplay/graphics.cpp
index d599616..d0557a9 100644
--- a/libs/vr/libdisplay/graphics.cpp
+++ b/libs/vr/libdisplay/graphics.cpp
@@ -1,10 +1,11 @@
 #include <dvr/graphics.h>
 
+#include <inttypes.h>
 #include <sys/timerfd.h>
 #include <array>
 #include <vector>
 
-#include <cutils/log.h>
+#include <log/log.h>
 #include <utils/Trace.h>
 
 #ifndef VK_USE_PLATFORM_ANDROID_KHR
@@ -372,8 +373,8 @@
       case DVR_SURFACE_PARAMETER_VK_SWAPCHAIN_IMAGE_FORMAT_OUT:
         break;
       default:
-        ALOGE("Invalid display surface parameter: key=%d value=%ld", p->key,
-              p->value);
+        ALOGE("Invalid display surface parameter: key=%d value=%" PRId64,
+              p->key, p->value);
         return nullptr;
     }
   }
@@ -583,7 +584,8 @@
   static int LockBuffer_DEPRECATED(ANativeWindow* window,
                                    ANativeWindowBuffer* buffer);
 
-  DISALLOW_COPY_AND_ASSIGN(DvrGraphicsContext);
+  DvrGraphicsContext(const DvrGraphicsContext&) = delete;
+  void operator=(const DvrGraphicsContext&) = delete;
 };
 
 DvrGraphicsContext::DvrGraphicsContext()
@@ -743,8 +745,8 @@
     // so that anyone who tries to bind an FBO to context->texture_id
     // will not get an incomplete buffer.
     context->current_buffer = context->buffer_queue->Dequeue();
-    CHECK(context->gl.texture_count ==
-          context->current_buffer->buffer()->slice_count());
+    LOG_ALWAYS_FATAL_IF(context->gl.texture_count !=
+                        context->current_buffer->buffer()->slice_count());
     for (int i = 0; i < context->gl.texture_count; ++i) {
       glBindTexture(context->gl.texture_target_type, context->gl.texture_id[i]);
       glEGLImageTargetTexture2DOES(context->gl.texture_target_type,
@@ -794,12 +796,12 @@
     result = vkCreateAndroidSurfaceKHR(
         context->vk.instance, &android_surface_ci,
         context->vk.allocation_callbacks, &context->vk.surface);
-    CHECK_EQ(result, VK_SUCCESS);
+    LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
     VkBool32 surface_supports_present = VK_FALSE;
     result = vkGetPhysicalDeviceSurfaceSupportKHR(
         context->vk.physical_device, context->vk.present_queue_family,
         context->vk.surface, &surface_supports_present);
-    CHECK_EQ(result, VK_SUCCESS);
+    LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
     if (!surface_supports_present) {
       ALOGE("Error: provided queue family (%u) does not support presentation",
             context->vk.present_queue_family);
@@ -809,21 +811,22 @@
     result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(
         context->vk.physical_device, context->vk.surface,
         &surface_capabilities);
-    CHECK_EQ(result, VK_SUCCESS);
+    LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
     // Determine the swapchain image format.
     uint32_t device_surface_format_count = 0;
     result = vkGetPhysicalDeviceSurfaceFormatsKHR(
         context->vk.physical_device, context->vk.surface,
         &device_surface_format_count, nullptr);
-    CHECK_EQ(result, VK_SUCCESS);
+    LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
     std::vector<VkSurfaceFormatKHR> device_surface_formats(
         device_surface_format_count);
     result = vkGetPhysicalDeviceSurfaceFormatsKHR(
         context->vk.physical_device, context->vk.surface,
         &device_surface_format_count, device_surface_formats.data());
-    CHECK_EQ(result, VK_SUCCESS);
-    CHECK_GT(device_surface_format_count, 0U);
-    CHECK_NE(device_surface_formats[0].format, VK_FORMAT_UNDEFINED);
+    LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
+    LOG_ALWAYS_FATAL_IF(device_surface_format_count == 0U);
+    LOG_ALWAYS_FATAL_IF(device_surface_formats[0].format ==
+                        VK_FORMAT_UNDEFINED);
     VkSurfaceFormatKHR present_surface_format = device_surface_formats[0];
     // Determine the swapchain present mode.
     // TODO(cort): query device_present_modes to make sure MAILBOX is supported.
@@ -832,19 +835,19 @@
     result = vkGetPhysicalDeviceSurfacePresentModesKHR(
         context->vk.physical_device, context->vk.surface,
         &device_present_mode_count, nullptr);
-    CHECK_EQ(result, VK_SUCCESS);
+    LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
     std::vector<VkPresentModeKHR> device_present_modes(
         device_present_mode_count);
     result = vkGetPhysicalDeviceSurfacePresentModesKHR(
         context->vk.physical_device, context->vk.surface,
         &device_present_mode_count, device_present_modes.data());
-    CHECK_EQ(result, VK_SUCCESS);
+    LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
     VkPresentModeKHR present_mode = VK_PRESENT_MODE_MAILBOX_KHR;
     // Extract presentation surface extents, image count, transform, usages,
     // etc.
-    LOG_ASSERT(
-        static_cast<int>(surface_capabilities.currentExtent.width) != -1 &&
-        static_cast<int>(surface_capabilities.currentExtent.height) != -1);
+    LOG_ALWAYS_FATAL_IF(
+        static_cast<int>(surface_capabilities.currentExtent.width) == -1 ||
+        static_cast<int>(surface_capabilities.currentExtent.height) == -1);
     VkExtent2D swapchain_extent = surface_capabilities.currentExtent;
 
     uint32_t desired_image_count = surface_capabilities.minImageCount;
@@ -856,8 +859,8 @@
         surface_capabilities.currentTransform;
     VkImageUsageFlags image_usage_flags =
         surface_capabilities.supportedUsageFlags;
-    CHECK_NE(surface_capabilities.supportedCompositeAlpha,
-             static_cast<VkFlags>(0));
+    LOG_ALWAYS_FATAL_IF(surface_capabilities.supportedCompositeAlpha ==
+                        static_cast<VkFlags>(0));
     VkCompositeAlphaFlagBitsKHR composite_alpha =
         VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
     if (!(surface_capabilities.supportedCompositeAlpha &
@@ -889,18 +892,18 @@
     result = vkCreateSwapchainKHR(context->vk.device, &swapchain_ci,
                                   context->vk.allocation_callbacks,
                                   &context->vk.swapchain);
-    CHECK_EQ(result, VK_SUCCESS);
+    LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
     // Create swapchain image views
     uint32_t image_count = 0;
     result = vkGetSwapchainImagesKHR(context->vk.device, context->vk.swapchain,
                                      &image_count, nullptr);
-    CHECK_EQ(result, VK_SUCCESS);
-    CHECK_GT(image_count, 0U);
+    LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
+    LOG_ALWAYS_FATAL_IF(image_count == 0U);
     context->vk.swapchain_images.resize(image_count);
     result = vkGetSwapchainImagesKHR(context->vk.device, context->vk.swapchain,
                                      &image_count,
                                      context->vk.swapchain_images.data());
-    CHECK_EQ(result, VK_SUCCESS);
+    LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
     context->vk.swapchain_image_views.resize(image_count);
     VkImageViewCreateInfo image_view_ci = {};
     image_view_ci.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
@@ -923,7 +926,7 @@
       result = vkCreateImageView(context->vk.device, &image_view_ci,
                                  context->vk.allocation_callbacks,
                                  &context->vk.swapchain_image_views[i]);
-      CHECK_EQ(result, VK_SUCCESS);
+      LOG_ALWAYS_FATAL_IF(result != VK_SUCCESS);
     }
     // Fill in any requested output parameters.
     for (auto p = parameters; p && p->key != DVR_SURFACE_PARAMETER_NONE; ++p) {
@@ -950,7 +953,7 @@
 // by the Vulkan path.
 int DvrGraphicsContext::Post(android::dvr::NativeBufferProducer* buffer,
                              int fence_fd) {
-  LOG_ASSERT(graphics_api == DVR_GRAPHICS_API_VULKAN);
+  LOG_ALWAYS_FATAL_IF(graphics_api != DVR_GRAPHICS_API_VULKAN);
   ATRACE_NAME(__PRETTY_FUNCTION__);
   ALOGI_IF(TRACE, "DvrGraphicsContext::Post: buffer_id=%d, fence_fd=%d",
            buffer->buffer()->id(), fence_fd);
@@ -967,7 +970,7 @@
   ALOGI_IF(TRACE, "SetSwapInterval: window=%p interval=%d", window, interval);
   DvrGraphicsContext* self = getSelf(window);
   (void)self;
-  LOG_ASSERT(self->graphics_api == DVR_GRAPHICS_API_VULKAN);
+  LOG_ALWAYS_FATAL_IF(self->graphics_api != DVR_GRAPHICS_API_VULKAN);
   return android::NO_ERROR;
 }
 
@@ -977,7 +980,7 @@
   ATRACE_NAME(__PRETTY_FUNCTION__);
 
   DvrGraphicsContext* self = getSelf(window);
-  LOG_ASSERT(self->graphics_api == DVR_GRAPHICS_API_VULKAN);
+  LOG_ALWAYS_FATAL_IF(self->graphics_api != DVR_GRAPHICS_API_VULKAN);
   std::lock_guard<std::mutex> autolock(self->lock_);
 
   if (!self->current_buffer) {
@@ -997,7 +1000,7 @@
   ALOGI_IF(TRACE, "NativeWindow::QueueBuffer: fence_fd=%d", fence_fd);
 
   DvrGraphicsContext* self = getSelf(window);
-  LOG_ASSERT(self->graphics_api == DVR_GRAPHICS_API_VULKAN);
+  LOG_ALWAYS_FATAL_IF(self->graphics_api != DVR_GRAPHICS_API_VULKAN);
   std::lock_guard<std::mutex> autolock(self->lock_);
 
   android::dvr::NativeBufferProducer* native_buffer =
@@ -1007,7 +1010,7 @@
   if (self->buffer_already_posted) {
     // Check that the buffer is the one we expect, but handle it if this happens
     // in production by allowing this buffer to post on top of the previous one.
-    DCHECK(native_buffer == self->current_buffer);
+    LOG_FATAL_IF(native_buffer != self->current_buffer);
     if (native_buffer == self->current_buffer) {
       do_post = false;
       if (fence_fd >= 0)
@@ -1031,7 +1034,7 @@
   ALOGI_IF(TRACE, "DvrGraphicsContext::CancelBuffer: fence_fd: %d", fence_fd);
 
   DvrGraphicsContext* self = getSelf(window);
-  LOG_ASSERT(self->graphics_api == DVR_GRAPHICS_API_VULKAN);
+  LOG_ALWAYS_FATAL_IF(self->graphics_api != DVR_GRAPHICS_API_VULKAN);
   std::lock_guard<std::mutex> autolock(self->lock_);
 
   android::dvr::NativeBufferProducer* native_buffer =
@@ -1042,7 +1045,7 @@
   if (self->buffer_already_posted) {
     // Check that the buffer is the one we expect, but handle it if this happens
     // in production by returning this buffer to the buffer queue.
-    DCHECK(native_buffer == self->current_buffer);
+    LOG_FATAL_IF(native_buffer != self->current_buffer);
     if (native_buffer == self->current_buffer) {
       do_enqueue = false;
     }
@@ -1061,7 +1064,7 @@
 int DvrGraphicsContext::Query(const ANativeWindow* window, int what,
                               int* value) {
   DvrGraphicsContext* self = getSelf(const_cast<ANativeWindow*>(window));
-  LOG_ASSERT(self->graphics_api == DVR_GRAPHICS_API_VULKAN);
+  LOG_ALWAYS_FATAL_IF(self->graphics_api != DVR_GRAPHICS_API_VULKAN);
   std::lock_guard<std::mutex> autolock(self->lock_);
 
   switch (what) {
@@ -1100,7 +1103,7 @@
 
 int DvrGraphicsContext::Perform(ANativeWindow* window, int operation, ...) {
   DvrGraphicsContext* self = getSelf(window);
-  LOG_ASSERT(self->graphics_api == DVR_GRAPHICS_API_VULKAN);
+  LOG_ALWAYS_FATAL_IF(self->graphics_api != DVR_GRAPHICS_API_VULKAN);
   std::lock_guard<std::mutex> autolock(self->lock_);
 
   va_list args;
@@ -1231,7 +1234,7 @@
                            float32x4_t render_pose_orientation,
                            float32x4_t render_pose_translation) {
   ATRACE_NAME("dvrBeginRenderFrameEds");
-  LOG_ASSERT(graphics_context->graphics_api == DVR_GRAPHICS_API_GLES);
+  LOG_ALWAYS_FATAL_IF(graphics_context->graphics_api != DVR_GRAPHICS_API_GLES);
   CHECK_GL();
   // Grab a buffer from the queue and set its pose.
   if (!graphics_context->current_buffer) {
@@ -1270,7 +1273,8 @@
                              uint32_t* swapchain_image_index,
                              VkImageView* swapchain_image_view) {
   ATRACE_NAME("dvrBeginRenderFrameEds");
-  LOG_ASSERT(graphics_context->graphics_api == DVR_GRAPHICS_API_VULKAN);
+  LOG_ALWAYS_FATAL_IF(graphics_context->graphics_api !=
+                      DVR_GRAPHICS_API_VULKAN);
 
   // Acquire a swapchain image. This calls Dequeue() internally.
   VkResult result = vkAcquireNextImageKHR(
@@ -1313,7 +1317,7 @@
     return -EPERM;
   }
   if (num_views > DVR_GRAPHICS_SURFACE_MAX_VIEWS) {
-    LOG(ERROR) << "dvrBeginRenderFrameLateLatch called with too many views.";
+    ALOGE("dvrBeginRenderFrameLateLatch called with too many views.");
     return -EINVAL;
   }
   dvrBeginRenderFrameEds(graphics_context, DVR_POSE_LATE_LATCH,
@@ -1424,7 +1428,7 @@
   ATRACE_NAME("dvrGraphicsPostEarly");
   ALOGI_IF(TRACE, "dvrGraphicsPostEarly");
 
-  LOG_ASSERT(graphics_context->graphics_api == DVR_GRAPHICS_API_GLES);
+  LOG_ALWAYS_FATAL_IF(graphics_context->graphics_api != DVR_GRAPHICS_API_GLES);
 
   // Note that this function can be called before or after
   // dvrBeginRenderFrame.
@@ -1445,7 +1449,7 @@
 }
 
 int dvrPresent(DvrGraphicsContext* graphics_context) {
-  LOG_ASSERT(graphics_context->graphics_api == DVR_GRAPHICS_API_GLES);
+  LOG_ALWAYS_FATAL_IF(graphics_context->graphics_api != DVR_GRAPHICS_API_GLES);
 
   std::array<char, 128> buf;
   snprintf(buf.data(), buf.size(), "dvrPresent|vsync=%d|",
@@ -1482,7 +1486,8 @@
 
 int dvrPresentVk(DvrGraphicsContext* graphics_context,
                  VkSemaphore submit_semaphore, uint32_t swapchain_image_index) {
-  LOG_ASSERT(graphics_context->graphics_api == DVR_GRAPHICS_API_VULKAN);
+  LOG_ALWAYS_FATAL_IF(graphics_context->graphics_api !=
+                      DVR_GRAPHICS_API_VULKAN);
 
   std::array<char, 128> buf;
   snprintf(buf.data(), buf.size(), "dvrPresent|vsync=%d|",
@@ -1549,7 +1554,7 @@
   auto display_surface = graphics_context->display_surface;
   // A DisplaySurface must be created prior to the creation of a
   // VideoMeshSurface.
-  LOG_ASSERT(display_surface != nullptr);
+  LOG_ALWAYS_FATAL_IF(display_surface == nullptr);
 
   LocalChannelHandle surface_handle = display_surface->CreateVideoMeshSurface();
   if (!surface_handle.valid()) {
diff --git a/libs/vr/libdisplay/include/private/dvr/video_mesh_surface_client.h b/libs/vr/libdisplay/include/private/dvr/video_mesh_surface_client.h
index a2659a6..e52d0b9 100644
--- a/libs/vr/libdisplay/include/private/dvr/video_mesh_surface_client.h
+++ b/libs/vr/libdisplay/include/private/dvr/video_mesh_surface_client.h
@@ -1,7 +1,6 @@
 #ifndef ANDROID_DVR_VIDEO_MESH_SURFACE_CLIENT_H_
 #define ANDROID_DVR_VIDEO_MESH_SURFACE_CLIENT_H_
 
-#include <base/macros.h>
 #include <private/dvr/buffer_hub_queue_client.h>
 #include <private/dvr/display_client.h>
 
diff --git a/libs/vr/libdisplay/late_latch.cpp b/libs/vr/libdisplay/late_latch.cpp
index 3681e10..b1a1589 100644
--- a/libs/vr/libdisplay/late_latch.cpp
+++ b/libs/vr/libdisplay/late_latch.cpp
@@ -6,7 +6,7 @@
 #include <iostream>
 #include <string>
 
-#include <base/logging.h>
+#include <log/log.h>
 #include <private/dvr/clock_ns.h>
 #include <private/dvr/debug.h>
 #include <private/dvr/graphics/gpu_profiler.h>
@@ -20,7 +20,6 @@
 #ifndef LOG_TAG
 #define LOG_TAG "latelatch"
 #endif
-#include <cutils/log.h>
 
 #define PE(str, ...)                                                  \
   fprintf(stderr, "[%s:%d] " str, __FILE__, __LINE__, ##__VA_ARGS__); \
@@ -268,18 +267,18 @@
   LocalHandle pose_buffer_fd;
   pose_client_ = dvrPoseCreate();
   if (!pose_client_) {
-    LOG(ERROR) << "LateLatch Error: failed to create pose client";
+    ALOGE("LateLatch Error: failed to create pose client");
   } else {
     int ret = privateDvrPoseGetRingBufferFd(pose_client_, &pose_buffer_fd);
     if (ret < 0) {
-      LOG(ERROR) << "LateLatch Error: failed to get pose ring buffer";
+      ALOGE("LateLatch Error: failed to get pose ring buffer");
     }
   }
 
   glGenBuffers(1, &pose_buffer_object_);
   glGenBuffers(1, &metadata_buffer_id_);
   if (!glBindSharedBufferQCOM) {
-    LOG(ERROR) << "Error: Missing gralloc buffer extension, no pose data";
+    ALOGE("Error: Missing gralloc buffer extension, no pose data");
   } else {
     if (pose_buffer_fd) {
       glBindBuffer(GL_SHADER_STORAGE_BUFFER, pose_buffer_object_);
@@ -346,7 +345,7 @@
 }
 
 void LateLatch::AddLateLatch(const LateLatchInput& data) const {
-  CHECK(is_app_late_latch_);
+  LOG_ALWAYS_FATAL_IF(!is_app_late_latch_);
   CHECK_GL();
   late_latch_program_.Use();
 
@@ -361,7 +360,7 @@
   if (adata)
     *adata = data;
   else
-    LOG(ERROR) << "Error: LateLatchInput gl mapping is null";
+    ALOGE("Error: LateLatchInput gl mapping is null");
   glUnmapBuffer(GL_SHADER_STORAGE_BUFFER);
   glBindBufferBase(GL_SHADER_STORAGE_BUFFER, INPUT_BINDING, input_buffer_id_);
   glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
@@ -410,7 +409,7 @@
 
 void LateLatch::AddEdsLateLatch(const LateLatchInput& data,
                                 GLuint render_pose_buffer_object) const {
-  CHECK(!is_app_late_latch_);
+  LOG_ALWAYS_FATAL_IF(is_app_late_latch_);
   late_latch_program_.Use();
 
   // Fall back on internal buffer when none is provided.
diff --git a/libs/vr/libdisplay/native_buffer_queue.cpp b/libs/vr/libdisplay/native_buffer_queue.cpp
index 2d1e23d..8dd0ee0 100644
--- a/libs/vr/libdisplay/native_buffer_queue.cpp
+++ b/libs/vr/libdisplay/native_buffer_queue.cpp
@@ -1,7 +1,6 @@
 #include "include/private/dvr/native_buffer_queue.h"
 
-#include <base/logging.h>
-#include <cutils/log.h>
+#include <log/log.h>
 #include <sys/epoll.h>
 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
 #include <utils/Trace.h>
@@ -23,7 +22,7 @@
     : surface_(surface),
       buffers_(capacity),
       buffer_queue_(capacity) {
-  CHECK(surface);
+  LOG_ALWAYS_FATAL_IF(!surface);
 
   epoll_fd_ = epoll_create(64);
   if (epoll_fd_ < 0) {
@@ -34,7 +33,7 @@
 
   // The kSurfaceBufferMaxCount must be >= the capacity so that shader code
   // can bind surface buffer array data.
-  CHECK(kSurfaceBufferMaxCount >= capacity);
+  LOG_ALWAYS_FATAL_IF(kSurfaceBufferMaxCount < capacity);
 
   for (size_t i = 0; i < capacity; i++) {
     uint32_t buffer_index = 0;
diff --git a/libs/vr/libdisplay/native_window.cpp b/libs/vr/libdisplay/native_window.cpp
index 63c81ed..24ecd8a 100644
--- a/libs/vr/libdisplay/native_window.cpp
+++ b/libs/vr/libdisplay/native_window.cpp
@@ -1,7 +1,6 @@
 #include <EGL/egl.h>
 
 #include <android/native_window.h>
-#include <base/logging.h>
 #include <cutils/native_handle.h>
 #include <errno.h>
 #include <pthread.h>
@@ -17,7 +16,7 @@
 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
 #include <utils/Trace.h>
 
-#include <cutils/log.h>
+#include <log/log.h>
 
 #include <memory>
 #include <mutex>
@@ -177,7 +176,7 @@
   if (self->next_buffer_already_posted_) {
     // Check that the buffer is the one we expect, but handle it if this happens
     // in production by allowing this buffer to post on top of the previous one.
-    DCHECK(native_buffer == self->next_post_buffer_.get());
+    LOG_FATAL_IF(native_buffer != self->next_post_buffer_.get());
     if (native_buffer == self->next_post_buffer_.get()) {
       do_post = false;
       if (fence_fd >= 0)
@@ -210,7 +209,7 @@
   if (self->next_buffer_already_posted_) {
     // Check that the buffer is the one we expect, but handle it if this happens
     // in production by returning this buffer to the buffer queue.
-    DCHECK(native_buffer == self->next_post_buffer_.get());
+    LOG_FATAL_IF(native_buffer != self->next_post_buffer_.get());
     if (native_buffer == self->next_post_buffer_.get()) {
       do_enqueue = false;
     }
diff --git a/libs/vr/libdisplay/screenshot_client.cpp b/libs/vr/libdisplay/screenshot_client.cpp
index 78f5e0f..3ad0c68 100644
--- a/libs/vr/libdisplay/screenshot_client.cpp
+++ b/libs/vr/libdisplay/screenshot_client.cpp
@@ -1,6 +1,6 @@
 #include "include/private/dvr/screenshot_client.h"
 
-#include <cutils/log.h>
+#include <log/log.h>
 
 #include <mutex>
 
diff --git a/libs/vr/libdisplay/vsync_client.cpp b/libs/vr/libdisplay/vsync_client.cpp
index c4cad50..a0fb313 100644
--- a/libs/vr/libdisplay/vsync_client.cpp
+++ b/libs/vr/libdisplay/vsync_client.cpp
@@ -1,6 +1,6 @@
 #include "include/private/dvr/vsync_client.h"
 
-#include <cutils/log.h>
+#include <log/log.h>
 
 #include <pdx/default_transport/client_channel_factory.h>
 #include <private/dvr/display_rpc.h>