Brillo と ChromeOSの関係を、system/coreやbtにみる

# Chrome OS と Brilloの関係

[ここ](http://qiita.com/hidenorly/items/25f4ec043e3bbe9cf1a7#android%E3%81%AE%E3%81%A9%E3%81%93%E3%81%A7seccomp%E3%82%92%E4%BD%BF%E3%81%A3%E3%81%A6%E3%81%84%E3%82%8B%E3%81%8B) で、brilloのコードの中には、Chrome OSから持ってきたものがと書きましたが、それは以下のようなcommitからもわかります。

https://android.googlesource.com/platform/system/core/+/74dc62460b8cdd5bfeac47bfe8e759fc04b55ef8

```commit.message
system/core: Rename "chromeos" -> "brillo" in include paths and namespaces

libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.

Bug: 24872993
Change-Id: I797613a38c7444a113f12e38366a424388477276
```

```crash_reporter/crash_collector.cc
 #include <base/strings/string_split.h>
 #include <base/strings/string_util.h>
 #include <base/strings/stringprintf.h>
-#include <chromeos/key_value_store.h>
-#include <chromeos/process.h>
+#include <brillo/key_value_store.h>
+#include <brillo/process.h>
 
 namespace {
 
@@ -340,7 +340,7 @@
 bool CrashCollector::GetLogContents(const FilePath &config_path,
                                     const std::string &exec_name,
                                     const FilePath &output_file) {
-  chromeos::KeyValueStore store;
+  brillo::KeyValueStore store;
   if (!store.Load(config_path)) 
```

https://android.googlesource.com/platform/system/core/+/26aef373a66791e69dec8a1a589a3b2f7f971692

```commit.message
core: Rename libchromeos into libbrillo

BUG: 24872993
Change-Id: Ia47ad51140f7e384822eea9d5de46c9f51ceda11
```

```metricsd/Android.mk
  -fvisibility=default
 metrics_includes := external/gtest/include \
   $(LOCAL_PATH)/include
-libmetrics_shared_libraries := libchrome libchromeos
+libmetrics_shared_libraries := libchrome libbrillo
 metrics_daemon_shared_libraries := $(libmetrics_shared_libraries) \
+  libbrillo-http \
+  libbrillo-dbus \
   libchrome-dbus \
-  libchromeos-http \
-  libchromeos-dbus \
   libdbus \
   libmetrics \
   libprotobuf-cpp-lite \
```

こういうのをみていると、OSの名前とか(特定用途なものの名前)を汎用的なコンポーネントにつけると、流用性が損なわれるのがわかりますね。。。

# build time変数

https://android.googlesource.com/platform/system/extras/+/a659ce97b3ee5aac752c827e57dc036c65661ac9

```system/extras/brillo_config/Android.mk
Add an Android.mk to generate build time configuration.

Some build time variables need to be installed on the image. Instead of
adding those fields in some system services, create a new Android.mk for
it.
```

# brilloのbt service "bluetoothtbd"

https://android.googlesource.com/platform/system/bt/+/brillo-m7-dev/service/bluetoothtbd.rc

```bluetoothtbd.rc
service bluetoothtbd /system/bin/bluetoothtbd
    class main
    user bluetooth
    group system net_bt_admin net_bt_stack
```

https://android.googlesource.com/platform/system/bt/+/888f8856774e9628b670da6ba779a36dd6a19ab9/service/Android.mk

```Android.mk
# Common variables
# ========================================================
btserviceCommonSrc := \
	adapter.cpp \
	adapter_state.cpp \
	daemon.cpp \
	gatt_server.cpp \
	hal/bluetooth_interface.cpp \
	ipc/ipc_handler.cpp \
	ipc/ipc_handler_unix.cpp \
	ipc/ipc_manager.cpp \
	ipc/unix_ipc_host.cpp \
	logging_helpers.cpp \
	settings.cpp \
	util/atomic_string.cpp \
	uuid.cpp
btserviceBinderSrc := \
	ipc/binder/bluetooth_binder_server.cpp \
	ipc/binder/IBluetooth.cpp \
	ipc/binder/IBluetoothCallback.cpp \
	ipc/binder/ipc_handler_binder.cpp
btserviceCommonIncludes := $(LOCAL_PATH)/../
# Native system service for target
# ========================================================
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
	$(btserviceBinderSrc) \
	$(btserviceCommonSrc) \
	main.cpp
LOCAL_C_INCLUDES += $(btserviceCommonIncludes)
LOCAL_CFLAGS += -std=c++11
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := bluetoothtbd
LOCAL_REQUIRED_MODULES = bluetooth.default
LOCAL_STATIC_LIBRARIES += libbtcore
LOCAL_SHARED_LIBRARIES += \
	libbinder \
	libchrome \
	libcutils \
	libhardware \
	liblog \
	libutils
LOCAL_INIT_RC := bluetoothtbd.rc
include $(BUILD_EXECUTABLE)
```

このように、大変シンプルです。しかし、TBDってなんでしょう？？？

(ここでも、libchromeが・・・)

つづく