Merge "Fix position of usbforward.h" into gce-dev
diff --git a/common/vsoc/framebuffer/Android.mk b/common/vsoc/framebuffer/Android.mk
index 969370d..1213e05 100644
--- a/common/vsoc/framebuffer/Android.mk
+++ b/common/vsoc/framebuffer/Android.mk
@@ -42,6 +42,10 @@
     libvsoc
 
 LOCAL_VENDOR_MODULE := true
+# See b/67109557
+ifeq (true, $(TARGET_TRANSLATE_2ND_ARCH))
+LOCAL_MULTILIB := first
+endif
 include $(BUILD_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
diff --git a/common/vsoc/lib/circqueue_impl.h b/common/vsoc/lib/circqueue_impl.h
index deb2978..3888a91 100644
--- a/common/vsoc/lib/circqueue_impl.h
+++ b/common/vsoc/lib/circqueue_impl.h
@@ -35,13 +35,13 @@
 void CircularQueueBase<SizeLog2>::CopyInRange(const char* buffer_in,
                                               const Range& t) {
   size_t bytes = t.end_idx - t.start_idx;
-  uint32_t index = t->start_idx & (BufferSize - 1);
+  uint32_t index = t.start_idx & (BufferSize - 1);
   if (index + bytes < BufferSize) {
     memcpy(buffer_ + index, buffer_in, bytes);
   } else {
     size_t part1_size = BufferSize - index;
     size_t part2_size = bytes - part1_size;
-    mempcy(buffer_ + index, buffer_in, part1_size);
+    memcpy(buffer_ + index, buffer_in, part1_size);
     memcpy(buffer_, buffer_in + part1_size, part2_size);
   }
 }
@@ -104,7 +104,7 @@
 intptr_t CircularByteQueue<SizeLog2>::Read(RegionView* r, char* buffer_out,
                                            size_t max_size) {
   this->lock_.Lock();
-  this->WaitForDataLocked();
+  this->WaitForDataLocked(r);
   Range t;
   t.start_idx = this->r_released_;
   t.end_idx = this->w_pub_;
@@ -113,7 +113,7 @@
   if ((t.end_idx - t.start_idx) > max_size) {
     t.end_idx = t.start_idx + max_size;
   }
-  CopyOutRange(t, buffer_out, max_size);
+  this->CopyOutRange(t, buffer_out, max_size);
   this->r_released_ = t.end_idx;
   this->lock_.Unlock();
   r->SendSignal(layout::Sides::Both, &this->r_released_);
@@ -151,7 +151,7 @@
                                                             char* buffer_out,
                                                             size_t max_size) {
   this->lock_.Lock();
-  this->WaitForDataLocked();
+  this->WaitForDataLocked(r);
   uint32_t packet_size = *reinterpret_cast<uint32_t*>(
       this->buffer_ + (this->r_released_ & (this->BufferSize - 1)));
   if (packet_size > max_size) {
@@ -160,11 +160,13 @@
   }
   Range t;
   t.start_idx = this->r_released_ + sizeof(uint32_t);
-  t.end_idx = t.start_idx + this->packet_size;
-  CopyOutRange(t, buffer_out);
+  t.end_idx = t.start_idx + packet_size;
+  this->CopyOutRange(t, buffer_out);
   this->r_released_ += this->CalculateBufferedSize(packet_size);
   this->lock_.Unlock();
-  r->SendSignal(layout::Sides::Both, &this->r_released_);
+  layout::Sides side;
+  side.value_ = layout::Sides::Both;
+  r->SendSignal(side, &this->r_released_);
   return packet_size;
 }
 
@@ -186,11 +188,13 @@
   header.end_idx = header.start_idx + sizeof(uint32_t);
   Range payload{range.start_idx + sizeof(uint32_t),
                 range.start_idx + sizeof(uint32_t) + bytes};
-  this->CopyInRange(&bytes, header);
+  this->CopyInRange(reinterpret_cast<const char*>(&bytes), header);
   this->CopyInRange(buffer_in, payload);
   this->w_pub_ = range.end_idx;
   this->lock_.Unlock();
-  r->SendSignal(layout::Sides::Both, &this->w_pub_);
+  layout::Sides side;
+  side.value_ = layout::Sides::Both;
+  r->SendSignal(side, &this->w_pub_);
   return bytes;
 }
 
diff --git a/guest/hals/gralloc/Android.mk b/guest/hals/gralloc/Android.mk
index 9898033..d3929d1 100644
--- a/guest/hals/gralloc/Android.mk
+++ b/guest/hals/gralloc/Android.mk
@@ -50,4 +50,9 @@
 endif
 
 LOCAL_VENDOR_MODULE := true
+
+# See b/67109557
+ifeq (true, $(TARGET_TRANSLATE_2ND_ARCH))
+LOCAL_MULTILIB := first
+endif
 include $(BUILD_SHARED_LIBRARY)
diff --git a/guest/vsoc/gralloc/Android.mk b/guest/vsoc/gralloc/Android.mk
index 0d4ffbe..9186347 100644
--- a/guest/vsoc/gralloc/Android.mk
+++ b/guest/vsoc/gralloc/Android.mk
@@ -42,4 +42,10 @@
     libvsoc
 
 LOCAL_VENDOR_MODULE := true
+
+# See b/67109557
+ifeq (true, $(TARGET_TRANSLATE_2ND_ARCH))
+LOCAL_MULTILIB := first
+endif
+
 include $(BUILD_SHARED_LIBRARY)
diff --git a/guest/vsoc/lib/Android.mk b/guest/vsoc/lib/Android.mk
index 9fe32c7..8cfd0eb 100644
--- a/guest/vsoc/lib/Android.mk
+++ b/guest/vsoc/lib/Android.mk
@@ -42,6 +42,10 @@
     liblog
 
 LOCAL_VENDOR_MODULE := true
+# See b/67109557
+ifeq (true, $(TARGET_TRANSLATE_2ND_ARCH))
+LOCAL_MULTILIB := first
+endif
 include $(BUILD_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
diff --git a/host/frontend/vnc_server/README.md b/host/frontend/vnc_server/README.md
index 52b78d1..a702303 100644
--- a/host/frontend/vnc_server/README.md
+++ b/host/frontend/vnc_server/README.md
@@ -3,7 +3,7 @@
 ## Build instructions
 
 ```shell
-bazel build //host/vnc_server/:vnc_server
+bazel build host/frontend/vnc_server/:vnc_server
 ```
 
 ### Requirements
diff --git a/host/frontend/vnc_server/blackboard.cpp b/host/frontend/vnc_server/blackboard.cpp
index 1c32b59..0e9e52a 100644
--- a/host/frontend/vnc_server/blackboard.cpp
+++ b/host/frontend/vnc_server/blackboard.cpp
@@ -1,10 +1,26 @@
-#include "blackboard.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "host/frontend/vnc_server/blackboard.h"
+
 #include <algorithm>
 #include <utility>
-#include "frame_buffer_watcher.h"
 
-#define LOG_TAG "GceVNCServer"
 #include <glog/logging.h>
+#include "host/frontend/vnc_server/frame_buffer_watcher.h"
 
 using avd::vnc::BlackBoard;
 using avd::vnc::Stripe;
diff --git a/host/frontend/vnc_server/blackboard.h b/host/frontend/vnc_server/blackboard.h
index 30eff20..cd3ef1b 100644
--- a/host/frontend/vnc_server/blackboard.h
+++ b/host/frontend/vnc_server/blackboard.h
@@ -1,14 +1,30 @@
-#ifndef DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_BLACKBOARD_H_
-#define DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_BLACKBOARD_H_
+#pragma once
 
-#include "common/libs/threads/thread_annotations.h"
-#include "vnc_utils.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 
 #include <condition_variable>
 #include <memory>
 #include <mutex>
 #include <unordered_map>
 
+#include "common/libs/threads/thread_annotations.h"
+#include "host/frontend/vnc_server/vnc_utils.h"
+
 namespace avd {
 namespace vnc {
 
@@ -95,5 +111,3 @@
 
 }  // namespace vnc
 }  // namespace avd
-
-#endif
diff --git a/host/frontend/vnc_server/frame_buffer_watcher.cpp b/host/frontend/vnc_server/frame_buffer_watcher.cpp
index 74495a2..d7a9818 100644
--- a/host/frontend/vnc_server/frame_buffer_watcher.cpp
+++ b/host/frontend/vnc_server/frame_buffer_watcher.cpp
@@ -1,5 +1,20 @@
-#include "frame_buffer_watcher.h"
-#include "vnc_utils.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "host/frontend/vnc_server/frame_buffer_watcher.h"
 
 #include <algorithm>
 #include <cstdint>
@@ -10,8 +25,8 @@
 #include <thread>
 #include <utility>
 
-#define LOG_TAG "GceVNCServer"
 #include <glog/logging.h>
+#include "host/frontend/vnc_server/vnc_utils.h"
 
 using avd::vnc::FrameBufferWatcher;
 
diff --git a/host/frontend/vnc_server/frame_buffer_watcher.h b/host/frontend/vnc_server/frame_buffer_watcher.h
index ca11613..d24766c 100644
--- a/host/frontend/vnc_server/frame_buffer_watcher.h
+++ b/host/frontend/vnc_server/frame_buffer_watcher.h
@@ -1,10 +1,20 @@
-#ifndef DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_FRAME_BUFFER_WATCHER_H_
-#define DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_FRAME_BUFFER_WATCHER_H_
+#pragma once
 
-#include "blackboard.h"
-#include "common/libs/threads/thread_annotations.h"
-#include "jpeg_compressor.h"
-#include "simulated_hw_composer.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <memory>
 #include <mutex>
@@ -12,6 +22,11 @@
 #include <utility>
 #include <vector>
 
+#include "common/libs/threads/thread_annotations.h"
+#include "host/frontend/vnc_server/blackboard.h"
+#include "host/frontend/vnc_server/jpeg_compressor.h"
+#include "host/frontend/vnc_server/simulated_hw_composer.h"
+
 namespace avd {
 namespace vnc {
 class FrameBufferWatcher {
@@ -59,5 +74,3 @@
 
 }  // namespace vnc
 }  // namespace avd
-
-#endif
diff --git a/host/frontend/vnc_server/jpeg_compressor.cpp b/host/frontend/vnc_server/jpeg_compressor.cpp
index 6a0f735..a5423f0 100644
--- a/host/frontend/vnc_server/jpeg_compressor.cpp
+++ b/host/frontend/vnc_server/jpeg_compressor.cpp
@@ -1,11 +1,25 @@
-#include "jpeg_compressor.h"
-#include "vnc_utils.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
-#include <jpeglib.h>
 #include <stdio.h>  // stdio.h must appear before jpeglib.h
+#include <jpeglib.h>
 
-#define LOG_TAG "GceVNCServer"
 #include <glog/logging.h>
+#include "host/frontend/vnc_server/jpeg_compressor.h"
+#include "host/frontend/vnc_server/vnc_utils.h"
 
 using avd::vnc::JpegCompressor;
 
diff --git a/host/frontend/vnc_server/jpeg_compressor.h b/host/frontend/vnc_server/jpeg_compressor.h
index 067c0cc..86bd2d3 100644
--- a/host/frontend/vnc_server/jpeg_compressor.h
+++ b/host/frontend/vnc_server/jpeg_compressor.h
@@ -1,12 +1,27 @@
-#ifndef DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_JPEG_COMPRESSOR_H_
-#define DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_JPEG_COMPRESSOR_H_
+#pragma once
 
-#include "vnc_utils.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <cstdint>
 #include <cstdlib>
 #include <memory>
 
+#include "host/frontend/vnc_server/vnc_utils.h"
+
 namespace avd {
 namespace vnc {
 
@@ -35,5 +50,3 @@
 
 }  // namespace vnc
 }  // namespace avd
-
-#endif
diff --git a/host/frontend/vnc_server/keysyms.h b/host/frontend/vnc_server/keysyms.h
index 06f3c14..51d9f07 100644
--- a/host/frontend/vnc_server/keysyms.h
+++ b/host/frontend/vnc_server/keysyms.h
@@ -1,5 +1,20 @@
-#ifndef DEVICE_GOOGLE_GCE_KEYSYMS_H_
-#define DEVICE_GOOGLE_GCE_KEYSYMS_H_
+#pragma once
+
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <cstdint>
 
@@ -37,4 +52,3 @@
 
 }  // namespace xk
 }  // namespace avd
-#endif
diff --git a/host/frontend/vnc_server/main.cpp b/host/frontend/vnc_server/main.cpp
index 5808a2b..3692aac 100644
--- a/host/frontend/vnc_server/main.cpp
+++ b/host/frontend/vnc_server/main.cpp
@@ -1,8 +1,24 @@
-#include "vnc_server.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <algorithm>
 #include <string>
 
+#include "host/frontend/vnc_server/vnc_server.h"
+
 DEFINE_bool(agressive, false, "Whether to use agressive server");
 DEFINE_int32(port, 6444, "Port where to listen for connections");
 
diff --git a/host/frontend/vnc_server/mocks.h b/host/frontend/vnc_server/mocks.h
index 315fc9d..e69eb43 100644
--- a/host/frontend/vnc_server/mocks.h
+++ b/host/frontend/vnc_server/mocks.h
@@ -1,3 +1,21 @@
+#pragma once
+
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 struct GceFrameBuffer {
   typedef uint32_t Pixel;
 
diff --git a/host/frontend/vnc_server/simulated_hw_composer.cpp b/host/frontend/vnc_server/simulated_hw_composer.cpp
index f6901ab..5052b94 100644
--- a/host/frontend/vnc_server/simulated_hw_composer.cpp
+++ b/host/frontend/vnc_server/simulated_hw_composer.cpp
@@ -1,8 +1,24 @@
-#include "simulated_hw_composer.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "host/frontend/vnc_server/simulated_hw_composer.h"
 
 #include "common/vsoc/lib/typed_region_view.h"
+#include "host/frontend/vnc_server/vnc_utils.h"
 #include "host/vsoc/gralloc/gralloc_buffer_region.h"
-#include "vnc_utils.h"
 
 using avd::vnc::SimulatedHWComposer;
 using vsoc::gralloc::GrallocBufferRegion;
diff --git a/host/frontend/vnc_server/simulated_hw_composer.h b/host/frontend/vnc_server/simulated_hw_composer.h
index 4e22676..2ac9eb7 100644
--- a/host/frontend/vnc_server/simulated_hw_composer.h
+++ b/host/frontend/vnc_server/simulated_hw_composer.h
@@ -1,18 +1,32 @@
 #pragma once
 
-#include "blackboard.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <condition_variable>
+#include <mutex>
+#ifdef FUZZ_TEST_VNC
+#include <random>
+#endif
+#include <thread>
 
 #include "common/libs/thread_safe_queue/thread_safe_queue.h"
 #include "common/libs/threads/thread_annotations.h"
 #include "common/vsoc/framebuffer/fb_bcast_region.h"
-
-#include <mutex>
-#include <thread>
-
-#include <condition_variable>
-#ifdef FUZZ_TEST_VNC
-#include <random>
-#endif
+#include "host/frontend/vnc_server/blackboard.h"
 
 namespace avd {
 namespace vnc {
diff --git a/host/frontend/vnc_server/tcp_socket.cpp b/host/frontend/vnc_server/tcp_socket.cpp
index 2fe8b34..a8caef5 100644
--- a/host/frontend/vnc_server/tcp_socket.cpp
+++ b/host/frontend/vnc_server/tcp_socket.cpp
@@ -1,10 +1,27 @@
-#include "tcp_socket.h"
-#include <cerrno>
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "host/frontend/vnc_server/tcp_socket.h"
 
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <sys/types.h>
-#define LOG_TAG "GceVNCServer"
+
+#include <cerrno>
+
 #include <glog/logging.h>
 
 using avd::SharedFD;
diff --git a/host/frontend/vnc_server/tcp_socket.h b/host/frontend/vnc_server/tcp_socket.h
index 572d9cf..a130ef4 100644
--- a/host/frontend/vnc_server/tcp_socket.h
+++ b/host/frontend/vnc_server/tcp_socket.h
@@ -1,14 +1,29 @@
-#ifndef DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_TCPSOCKET_H_
-#define DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_TCPSOCKET_H_
+#pragma once
 
-#include "vnc_utils.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "host/frontend/vnc_server/vnc_utils.h"
+
+#include <unistd.h>
 
 #include <cstddef>
 #include <cstdint>
 #include <mutex>
 
-#include <unistd.h>
-
 namespace avd {
 namespace vnc {
 
@@ -63,5 +78,3 @@
 
 }  // namespace vnc
 }  // namespace avd
-
-#endif
diff --git a/host/frontend/vnc_server/VirtualInputDevice.cpp b/host/frontend/vnc_server/virtual_input_device.cpp
similarity index 98%
rename from host/frontend/vnc_server/VirtualInputDevice.cpp
rename to host/frontend/vnc_server/virtual_input_device.cpp
index 038ee79..82c1757 100644
--- a/host/frontend/vnc_server/VirtualInputDevice.cpp
+++ b/host/frontend/vnc_server/virtual_input_device.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "RemoterVirtualInput"
+#include "host/frontend/vnc_server/virtual_input_device.h"
 
 #include <errno.h>
 #include <fcntl.h>
@@ -25,11 +25,11 @@
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+
 #include <vector>
 
 #include <glog/logging.h>
-#include "VirtualInputDevice.h"
-#include "keysyms.h"
+#include "host/frontend/vnc_server/keysyms.h"
 
 namespace avd {
 
diff --git a/host/frontend/vnc_server/VirtualInputDevice.h b/host/frontend/vnc_server/virtual_input_device.h
similarity index 93%
rename from host/frontend/vnc_server/VirtualInputDevice.h
rename to host/frontend/vnc_server/virtual_input_device.h
index 1b9506e..a46bee5 100644
--- a/host/frontend/vnc_server/VirtualInputDevice.h
+++ b/host/frontend/vnc_server/virtual_input_device.h
@@ -1,5 +1,7 @@
+#pragma once
+
 /*
- * Copyright (C) 2014 The Android Open Source Project
+ * Copyright (C) 2017 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,9 +16,6 @@
  * limitations under the License.
  */
 
-#ifndef VIRTUAL_INPUT_DEVICE_H_
-#define VIRTUAL_INPUT_DEVICE_H_
-
 #include <functional>
 #include <map>
 #include <string>
@@ -77,4 +76,3 @@
 };
 
 }  // namespace avd
-#endif
diff --git a/host/frontend/vnc_server/virtual_inputs.cpp b/host/frontend/vnc_server/virtual_inputs.cpp
index 3912f7b..92b27e3 100644
--- a/host/frontend/vnc_server/virtual_inputs.cpp
+++ b/host/frontend/vnc_server/virtual_inputs.cpp
@@ -1,9 +1,26 @@
-#include "virtual_inputs.h"
-#include <gflags/gflags.h>
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "host/frontend/vnc_server/virtual_inputs.h"
 
 #include <mutex>
 #include <thread>
 
+#include <gflags/gflags.h>
+
 DEFINE_string(input_socket, "/tmp/android-cuttlefish-1-input",
               "The name of unix socket where the monkey server is listening "
               "for input commands");
diff --git a/host/frontend/vnc_server/virtual_inputs.h b/host/frontend/vnc_server/virtual_inputs.h
index 502dee4..d0e9ffa 100644
--- a/host/frontend/vnc_server/virtual_inputs.h
+++ b/host/frontend/vnc_server/virtual_inputs.h
@@ -1,16 +1,30 @@
-#ifndef DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_VIRTUAL_INPUTS_H_
-#define DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_VIRTUAL_INPUTS_H_
+#pragma once
 
-#include "VirtualInputDevice.h"
-#include "vnc_utils.h"
-
-#include "common/libs/fs/shared_fd.h"
-#include "common/libs/threads/thread_annotations.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <linux/input.h>
 
 #include <mutex>
 
+#include "common/libs/fs/shared_fd.h"
+#include "common/libs/threads/thread_annotations.h"
+#include "host/frontend/vnc_server/virtual_input_device.h"
+#include "host/frontend/vnc_server/vnc_utils.h"
+
 namespace avd {
 namespace vnc {
 
@@ -34,5 +48,3 @@
 
 }  // namespace vnc
 }  // namespace avd
-
-#endif
diff --git a/host/frontend/vnc_server/vnc_client_connection.cpp b/host/frontend/vnc_server/vnc_client_connection.cpp
index d69a510..1be1df3 100644
--- a/host/frontend/vnc_server/vnc_client_connection.cpp
+++ b/host/frontend/vnc_server/vnc_client_connection.cpp
@@ -1,8 +1,20 @@
-#include "vnc_client_connection.h"
-#include "keysyms.h"
-#include "mocks.h"
-#include "tcp_socket.h"
-#include "vnc_utils.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "host/frontend/vnc_server/vnc_client_connection.h"
 
 #include <netinet/in.h>
 #include <sys/time.h>
@@ -18,11 +30,11 @@
 #include <utility>
 #include <vector>
 
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "VSoCVNCServer"
 #include <glog/logging.h>
+#include "host/frontend/vnc_server/keysyms.h"
+#include "host/frontend/vnc_server/mocks.h"
+#include "host/frontend/vnc_server/tcp_socket.h"
+#include "host/frontend/vnc_server/vnc_utils.h"
 
 using avd::vnc::Message;
 using avd::vnc::Stripe;
diff --git a/host/frontend/vnc_server/vnc_client_connection.h b/host/frontend/vnc_server/vnc_client_connection.h
index d6b7f59..75d9fe1 100644
--- a/host/frontend/vnc_server/vnc_client_connection.h
+++ b/host/frontend/vnc_server/vnc_client_connection.h
@@ -1,10 +1,20 @@
-#ifndef DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_VNC_CLIENT_CONNECTION_H_
-#define DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_VNC_CLIENT_CONNECTION_H_
+#pragma once
 
-#include "blackboard.h"
-#include "tcp_socket.h"
-#include "virtual_inputs.h"
-#include "vnc_utils.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include "common/libs/fs/shared_fd.h"
 #include "common/libs/threads/thread_annotations.h"
@@ -15,6 +25,11 @@
 #include <thread>
 #include <vector>
 
+#include "host/frontend/vnc_server/blackboard.h"
+#include "host/frontend/vnc_server/tcp_socket.h"
+#include "host/frontend/vnc_server/virtual_inputs.h"
+#include "host/frontend/vnc_server/vnc_utils.h"
+
 namespace avd {
 namespace vnc {
 
@@ -154,5 +169,3 @@
 
 }  // namespace vnc
 }  // namespace avd
-
-#endif
diff --git a/host/frontend/vnc_server/vnc_server.cpp b/host/frontend/vnc_server/vnc_server.cpp
index 838d51a..150c38d 100644
--- a/host/frontend/vnc_server/vnc_server.cpp
+++ b/host/frontend/vnc_server/vnc_server.cpp
@@ -1,12 +1,29 @@
-#include "vnc_server.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "host/frontend/vnc_server/vnc_server.h"
+
 #include <glog/logging.h>
-#include "blackboard.h"
-#include "frame_buffer_watcher.h"
-#include "jpeg_compressor.h"
-#include "tcp_socket.h"
-#include "virtual_inputs.h"
-#include "vnc_client_connection.h"
-#include "vnc_utils.h"
+#include "host/frontend/vnc_server/blackboard.h"
+#include "host/frontend/vnc_server/frame_buffer_watcher.h"
+#include "host/frontend/vnc_server/jpeg_compressor.h"
+#include "host/frontend/vnc_server/tcp_socket.h"
+#include "host/frontend/vnc_server/virtual_inputs.h"
+#include "host/frontend/vnc_server/vnc_client_connection.h"
+#include "host/frontend/vnc_server/vnc_utils.h"
 
 using avd::vnc::VncServer;
 
diff --git a/host/frontend/vnc_server/vnc_server.h b/host/frontend/vnc_server/vnc_server.h
index d88457a..8fd26a7 100644
--- a/host/frontend/vnc_server/vnc_server.h
+++ b/host/frontend/vnc_server/vnc_server.h
@@ -1,18 +1,33 @@
-#ifndef DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_VNC_SERVER_H_
-#define DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_VNC_SERVER_H_
+#pragma once
 
-#include "blackboard.h"
-#include "frame_buffer_watcher.h"
-#include "jpeg_compressor.h"
-#include "tcp_socket.h"
-#include "virtual_inputs.h"
-#include "vnc_client_connection.h"
-#include "vnc_utils.h"
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <string>
 #include <thread>
 #include <utility>
 
+#include "host/frontend/vnc_server/blackboard.h"
+#include "host/frontend/vnc_server/frame_buffer_watcher.h"
+#include "host/frontend/vnc_server/jpeg_compressor.h"
+#include "host/frontend/vnc_server/tcp_socket.h"
+#include "host/frontend/vnc_server/virtual_inputs.h"
+#include "host/frontend/vnc_server/vnc_client_connection.h"
+#include "host/frontend/vnc_server/vnc_utils.h"
+
 namespace avd {
 namespace vnc {
 
@@ -39,5 +54,3 @@
 
 }  // namespace vnc
 }  // namespace avd
-
-#endif
diff --git a/host/frontend/vnc_server/vnc_utils.h b/host/frontend/vnc_server/vnc_utils.h
index 6c26cd6..9822a7c 100644
--- a/host/frontend/vnc_server/vnc_utils.h
+++ b/host/frontend/vnc_server/vnc_utils.h
@@ -1,5 +1,20 @@
-#ifndef DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_VNC_UTILS_H_
-#define DEVICE_GOOGLE_GCE_GCE_UTILS_GCE_VNC_SERVER_VNC_UTILS_H_
+#pragma once
+
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
 #include <array>
 #include <cstdint>
@@ -73,5 +88,3 @@
 
 }  // namespace vnc
 }  // namespace avd
-
-#endif