Merge "Test for getHashChain() in IBase." into oc-dev
am: b04aa8907a

Change-Id: I6f552d8967dbb5f1d4f46722823549f6cebd63a1
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..787d47a
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+
+#
+# Below are some minor deviations from the default Google style to
+# accommodate for handling of the large legacy code base.
+#
+
+BasedOnStyle: Google
+CommentPragmas: NOLINT:.*
+DerivePointerAlignment: false
+AllowShortFunctionsOnASingleLine: Inline
+TabWidth: 4
+UseTab: Never
+IndentWidth: 4
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
new file mode 100644
index 0000000..213c93a
--- /dev/null
+++ b/PREUPLOAD.cfg
@@ -0,0 +1,5 @@
+[Options]
+ignore_merged_commits = true
+
+[Builtin Hooks]
+clang_format = true
diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc
index 68cac5f..bb66460 100644
--- a/bluetooth/1.0/default/vendor_interface.cc
+++ b/bluetooth/1.0/default/vendor_interface.cc
@@ -16,8 +16,6 @@
 
 #include "vendor_interface.h"
 
-#include <assert.h>
-
 #define LOG_TAG "android.hardware.bluetooth@1.0-impl"
 #include <android-base/logging.h>
 #include <cutils/properties.h>
@@ -165,7 +163,7 @@
     InitializeCompleteCallback initialize_complete_cb,
     PacketReadCallback event_cb, PacketReadCallback acl_cb,
     PacketReadCallback sco_cb) {
-  assert(!g_vendor_interface);
+  CHECK(!g_vendor_interface);
   g_vendor_interface = new VendorInterface();
   return g_vendor_interface->Open(initialize_complete_cb, event_cb, acl_cb,
                                   sco_cb);
diff --git a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
index 9da58e2..cf9f66e 100644
--- a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
+++ b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
@@ -337,17 +337,16 @@
 TEST_F(NfcHidlTest, CoreInitialized) {
   NfcData data;
   data.resize(1);
-  NfcEvent last_event_;
-  for (int i = 0; i <= 6; i++) {
+  // These parameters might lead to device specific proprietary behavior
+  // Using > 10 values should result in predictable and common results for
+  // most devices.
+  for (int i = 10; i <= 16; i++) {
       data[0] = i;
       EXPECT_EQ(NfcStatus::OK, nfc_->coreInitialized(data));
       // Wait for NfcEvent.POST_INIT_CPLT
-      auto res = nfc_cb_->WaitForCallbackAny();
-      if (res.name.compare(kCallbackNameSendEvent) == 0) {
-          last_event_ = res.args->last_event_;
-      }
+      auto res = nfc_cb_->WaitForCallback(kCallbackNameSendEvent);
       EXPECT_TRUE(res.no_timeout);
-      EXPECT_EQ(NfcEvent::POST_INIT_CPLT, last_event_);
+      EXPECT_EQ(NfcEvent::POST_INIT_CPLT, res.args->last_event_);
   }
 }